refactored payment orchestration
This commit is contained in:
@@ -2,6 +2,9 @@ syntax = "proto3";
|
||||
package common.gateway.v1;
|
||||
option go_package = "github.com/tech/sendico/pkg/proto/common/gateway/v1;gatewayv1";
|
||||
|
||||
import "common/money/v1/money.proto";
|
||||
|
||||
|
||||
enum Operation {
|
||||
OPERATION_UNSPECIFIED = 0;
|
||||
OPERATION_AUTHORIZE = 1;
|
||||
@@ -162,3 +165,26 @@ message GatewayInstanceDescriptor {
|
||||
string version = 7;
|
||||
bool is_enabled = 8;
|
||||
}
|
||||
|
||||
// OperationResult represents the outcome status of an operation in a gateway
|
||||
enum OperationResult {
|
||||
OPERATION_RESULT_UNSPECIFIED = 0;
|
||||
OPERATION_RESULT_SUCCESS = 1;
|
||||
OPERATION_RESULT_FAILED = 2;
|
||||
OPERATION_RESULT_CANCELLED = 3;
|
||||
}
|
||||
|
||||
message OperationError {
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
bool can_retry = 3;
|
||||
bool should_rollback = 4;
|
||||
}
|
||||
|
||||
message OperationExecutionStatus {
|
||||
string idempotency_key = 1;
|
||||
string operation_ref = 2;
|
||||
common.money.v1.Money executed_money = 3;
|
||||
OperationResult status = 4;
|
||||
OperationError error = 5;
|
||||
}
|
||||
@@ -54,13 +54,17 @@ enum OperationType {
|
||||
|
||||
enum OperationStatus {
|
||||
OPERATION_STATUS_UNSPECIFIED = 0;
|
||||
SUBMITTED = 1;
|
||||
PENDING = 2;
|
||||
CONFIRMED = 3;
|
||||
FAILED = 4;
|
||||
CANCELED = 5;
|
||||
|
||||
OPERATION_CREATED = 1; // record exists, not started
|
||||
OPERATION_PROCESSING = 2; // we are working on it
|
||||
OPERATION_WAITING = 3; // waiting external world
|
||||
|
||||
OPERATION_SUCCESS = 4; // final success
|
||||
OPERATION_FAILED = 5; // final failure
|
||||
OPERATION_CANCELLED = 6; // final cancelled
|
||||
}
|
||||
|
||||
|
||||
enum ParamType {
|
||||
PARAM_TYPE_UNSPECIFIED = 0;
|
||||
STRING = 1;
|
||||
@@ -101,7 +105,7 @@ message ConnectorCapabilities {
|
||||
string version = 2;
|
||||
repeated AccountKind supported_account_kinds = 3;
|
||||
repeated OperationType supported_operation_types = 4;
|
||||
repeated string supported_assets = 5; // canonical asset string (USD, ETH, USDT-TRC20)
|
||||
repeated string supported_assets = 5; // canonical asset string (USD, ETH, USDT-TRC20)
|
||||
repeated string supported_networks = 6; // optional, connector-defined names
|
||||
repeated ParamSpec open_account_params = 7;
|
||||
repeated OperationParamSpec operation_params = 8;
|
||||
@@ -173,6 +177,8 @@ message Operation {
|
||||
google.protobuf.Timestamp updated_at = 13;
|
||||
common.account_role.v1.AccountRole from_role = 14;
|
||||
common.account_role.v1.AccountRole to_role = 15;
|
||||
string operation_ref = 16;
|
||||
string intent_ref = 17;
|
||||
}
|
||||
|
||||
message OperationReceipt {
|
||||
|
||||
@@ -36,14 +36,17 @@ enum DepositStatus {
|
||||
|
||||
enum TransferStatus {
|
||||
TRANSFER_STATUS_UNSPECIFIED = 0;
|
||||
TRANSFER_PENDING = 1;
|
||||
TRANSFER_SIGNING = 2;
|
||||
TRANSFER_SUBMITTED = 3;
|
||||
TRANSFER_CONFIRMED = 4;
|
||||
TRANSFER_FAILED = 5;
|
||||
TRANSFER_CANCELLED = 6;
|
||||
|
||||
TRANSFER_CREATED = 1; // record exists, not started
|
||||
TRANSFER_PROCESSING = 2; // we are working on it (signing, building tx, etc)
|
||||
TRANSFER_WAITING = 3; // waiting external world (network/provider)
|
||||
|
||||
TRANSFER_SUCCESS = 4; // final success
|
||||
TRANSFER_FAILED = 5; // final failure
|
||||
TRANSFER_CANCELLED = 6; // final cancelled
|
||||
}
|
||||
|
||||
|
||||
// Asset captures the chain/token pair so downstream systems can route correctly.
|
||||
message Asset {
|
||||
ChainNetwork chain = 1;
|
||||
@@ -148,6 +151,8 @@ message Transfer {
|
||||
string failure_reason = 12;
|
||||
google.protobuf.Timestamp created_at = 13;
|
||||
google.protobuf.Timestamp updated_at = 14;
|
||||
string intent_ref = 15;
|
||||
string payment_ref = 16;
|
||||
}
|
||||
|
||||
message SubmitTransferRequest {
|
||||
@@ -158,7 +163,9 @@ message SubmitTransferRequest {
|
||||
common.money.v1.Money amount = 5;
|
||||
repeated ServiceFeeBreakdown fees = 6;
|
||||
map<string, string> metadata = 7;
|
||||
string client_reference = 8;
|
||||
string operation_ref = 8;
|
||||
string intent_ref = 9;
|
||||
string payment_ref = 10;
|
||||
}
|
||||
|
||||
message SubmitTransferResponse {
|
||||
@@ -214,7 +221,9 @@ message EnsureGasTopUpRequest {
|
||||
string target_wallet_ref = 4;
|
||||
common.money.v1.Money estimated_total_fee = 5;
|
||||
map<string, string> metadata = 6;
|
||||
string client_reference = 7;
|
||||
string payment_ref = 7;
|
||||
string intent_ref = 8;
|
||||
string operation_ref = 9;
|
||||
}
|
||||
|
||||
message EnsureGasTopUpResponse {
|
||||
|
||||
@@ -7,18 +7,22 @@ option go_package = "github.com/tech/sendico/pkg/proto/gateway/mntx/v1;mntxv1";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common/gateway/v1/gateway.proto";
|
||||
|
||||
// Status of a payout request handled by Monetix.
|
||||
// Lifecycle status of a payout handled by Monetix.
|
||||
enum PayoutStatus {
|
||||
PAYOUT_STATUS_UNSPECIFIED = 0;
|
||||
PAYOUT_STATUS_PENDING = 1;
|
||||
PAYOUT_STATUS_PROCESSED = 2;
|
||||
PAYOUT_STATUS_FAILED = 3;
|
||||
|
||||
PAYOUT_STATUS_CREATED = 1; // request created, not sent
|
||||
PAYOUT_STATUS_WAITING = 2; // waiting provider processing
|
||||
PAYOUT_STATUS_SUCCESS = 3; // final success
|
||||
PAYOUT_STATUS_FAILED = 4; // final failure
|
||||
PAYOUT_STATUS_CANCELLED = 5; // final cancelled
|
||||
}
|
||||
|
||||
|
||||
// Request to initiate a Monetix card payout.
|
||||
message CardPayoutRequest {
|
||||
string payout_id = 1; // internal payout id, mapped to Monetix payment_id
|
||||
int64 project_id = 2; // optional override; defaults to configured project id
|
||||
string payout_id = 1; // internal payout id, mapped to Monetix payment_id
|
||||
int64 project_id = 2; // optional override; defaults to configured project id
|
||||
string customer_id = 3;
|
||||
string customer_first_name = 4;
|
||||
string customer_middle_name = 5;
|
||||
@@ -29,13 +33,16 @@ message CardPayoutRequest {
|
||||
string customer_state = 10;
|
||||
string customer_city = 11;
|
||||
string customer_address = 12;
|
||||
int64 amount_minor = 13; // amount in minor units
|
||||
string currency = 14; // ISO-4217 alpha-3
|
||||
int64 amount_minor = 13; // amount in minor units
|
||||
string currency = 14; // ISO-4217 alpha-3
|
||||
string card_pan = 15;
|
||||
uint32 card_exp_year = 16;
|
||||
uint32 card_exp_month = 17;
|
||||
string card_holder = 18;
|
||||
map<string, string> metadata = 30;
|
||||
string operation_ref = 31;
|
||||
string idempotency_key = 32;
|
||||
string intent_ref = 33;
|
||||
}
|
||||
|
||||
// Persisted payout state for retrieval and status updates.
|
||||
@@ -51,6 +58,9 @@ message CardPayoutState {
|
||||
string provider_payment_id = 9;
|
||||
google.protobuf.Timestamp created_at = 10;
|
||||
google.protobuf.Timestamp updated_at = 11;
|
||||
string operation_ref = 12;
|
||||
string idempotency_key = 13;
|
||||
string intent_ref = 14;
|
||||
}
|
||||
|
||||
// Response returned immediately after submitting a payout to Monetix.
|
||||
@@ -105,6 +115,9 @@ message CardTokenPayoutRequest {
|
||||
string card_holder = 16;
|
||||
string masked_pan = 17;
|
||||
map<string, string> metadata = 30;
|
||||
string operation_ref = 31;
|
||||
string idempotency_key = 32;
|
||||
string intent_ref = 33;
|
||||
}
|
||||
|
||||
// Response returned immediately after submitting a token payout to Monetix.
|
||||
|
||||
@@ -116,6 +116,7 @@ message PaymentIntent {
|
||||
SettlementMode settlement_mode = 9;
|
||||
Customer customer = 10;
|
||||
string settlement_currency = 11;
|
||||
string ref = 12;
|
||||
}
|
||||
|
||||
message Customer {
|
||||
@@ -167,6 +168,7 @@ message ExecutionStep {
|
||||
string destination_ref = 6;
|
||||
string transfer_ref = 7;
|
||||
map<string, string> metadata = 8;
|
||||
string operation_ref = 9;
|
||||
}
|
||||
|
||||
message ExecutionPlan {
|
||||
@@ -179,12 +181,11 @@ message PaymentStep {
|
||||
string gateway_id = 2; // required for external rails
|
||||
common.gateway.v1.RailOperation action = 3;
|
||||
common.money.v1.Money amount = 4;
|
||||
string ref = 5;
|
||||
string step_id = 6;
|
||||
string instance_id = 7;
|
||||
repeated string depends_on = 8;
|
||||
string commit_policy = 9;
|
||||
repeated string commit_after = 10;
|
||||
string step_id = 5;
|
||||
string instance_id = 6;
|
||||
repeated string depends_on = 7;
|
||||
string commit_policy = 8;
|
||||
repeated string commit_after = 9;
|
||||
}
|
||||
|
||||
message PaymentPlan {
|
||||
|
||||
Reference in New Issue
Block a user