quotation v2 service

This commit is contained in:
Stephan D
2026-02-18 22:06:51 +01:00
parent a33be56247
commit 1c5d3d202b
30 changed files with 799 additions and 231 deletions

View File

@@ -4,8 +4,6 @@ package common.payment.v1;
option go_package = "github.com/tech/sendico/pkg/proto/common/payment/v1;paymentv1";
import "google/protobuf/wrappers.proto";
// -------------------------
// Card network (payment system)

View File

@@ -8,6 +8,6 @@ option go_package = "github.com/tech/sendico/pkg/proto/common/payment/v1;payment
// SettlementMode defines how to treat fees/FX variance for payouts.
enum SettlementMode {
SETTLEMENT_UNSPECIFIED = 0;
SETTLEMENT_FIX_SOURCE = 1; // customer pays fees; sent amount fixed
SETTLEMENT_FIX_RECEIVED = 2; // receiver gets fixed amount; source flexes
SETTLEMENT_FIX_SOURCE = 1;
SETTLEMENT_FIX_RECEIVED = 2;
}

View File

@@ -8,12 +8,12 @@ import "google/protobuf/timestamp.proto";
import "api/proto/common/storable/v1/storable.proto";
import "api/proto/common/money/v1/money.proto";
import "api/proto/common/payment/v1/asset.proto";
import "api/proto/common/payment/v1/settlement.proto";
import "api/proto/billing/fees/v1/fees.proto";
import "api/proto/oracle/v1/oracle.proto";
enum QuoteState {
QUOTE_STATE_UNSPECIFIED = 0;
QUOTE_STATE_INDICATIVE = 1;
QUOTE_STATE_EXECUTABLE = 2;
QUOTE_STATE_BLOCKED = 3;
@@ -22,7 +22,6 @@ enum QuoteState {
enum QuoteBlockReason {
QUOTE_BLOCK_REASON_UNSPECIFIED = 0;
QUOTE_BLOCK_REASON_ROUTE_UNAVAILABLE = 1;
QUOTE_BLOCK_REASON_LIMIT_BLOCKED = 2;
QUOTE_BLOCK_REASON_RISK_BLOCKED = 3;
@@ -46,6 +45,12 @@ enum RouteHopRole {
ROUTE_HOP_ROLE_DESTINATION = 3;
}
enum FeeTreatment {
FEE_TREATMENT_UNSPECIFIED = 0;
FEE_TREATMENT_ADD_TO_SOURCE = 1;
FEE_TREATMENT_DEDUCT_FROM_DESTINATION = 2;
}
message RouteHop {
uint32 index = 1;
string rail = 2;
@@ -67,13 +72,11 @@ message RouteSpecification {
string rail = 1;
string provider = 2;
string payout_method = 3;
reserved 4, 5;
reserved "settlement_asset", "settlement_model";
string network = 6;
string route_ref = 7;
string pricing_profile_ref = 8;
repeated RouteHop hops = 9;
RouteSettlement settlement = 10;
string network = 4;
string route_ref = 5;
string pricing_profile_ref = 6;
repeated RouteHop hops = 7;
RouteSettlement settlement = 8;
}
// Execution assumptions and constraints evaluated at quotation time.
@@ -91,24 +94,27 @@ message ExecutionConditions {
message PaymentQuote {
common.storable.v1.Storable storable = 1;
QuoteState state = 2;
QuoteBlockReason block_reason = 4;
reserved 3, 13;
reserved "kind", "lifecycle", "executable";
QuoteBlockReason block_reason = 3;
common.money.v1.Money debit_amount = 5;
common.money.v1.Money credit_amount = 6;
// Transfer principal amount before fees.
common.money.v1.Money transfer_principal_amount = 4;
// Expected destination settlement amount.
common.money.v1.Money destination_amount = 5;
repeated fees.v1.DerivedPostingLine fee_lines = 7;
repeated fees.v1.AppliedRule fee_rules = 8;
repeated fees.v1.DerivedPostingLine fee_lines = 6;
repeated fees.v1.AppliedRule fee_rules = 7;
oracle.v1.Quote fx_quote = 9;
oracle.v1.Quote fx_quote = 8;
string quote_ref = 10;
string quote_ref = 9;
google.protobuf.Timestamp expires_at = 11;
google.protobuf.Timestamp priced_at = 12;
google.protobuf.Timestamp expires_at = 10;
google.protobuf.Timestamp priced_at = 11;
RouteSpecification route = 14;
ExecutionConditions execution_conditions = 15;
common.money.v1.Money total_cost = 16;
RouteSpecification route = 12;
ExecutionConditions execution_conditions = 13;
// Total amount expected to be debited from payer side (principal +/- fee lines in source currency).
common.money.v1.Money payer_total_debit_amount = 14;
common.payment.v1.SettlementMode resolved_settlement_mode = 15;
FeeTreatment resolved_fee_treatment = 16;
}

View File

@@ -5,14 +5,25 @@ package payments.quotation.v2;
option go_package = "github.com/tech/sendico/pkg/proto/payments/quotation/v2;quotationv2";
import "api/proto/payments/shared/v1/shared.proto";
import "api/proto/payments/transfer/v1/transfer.proto";
import "api/proto/common/money/v1/money.proto";
import "api/proto/common/payment/v1/settlement.proto";
import "api/proto/payments/endpoint/v1/endpoint.proto";
import "api/proto/payments/quotation/v2/interface.proto";
message QuoteIntent {
payments.endpoint.v1.PaymentEndpoint source = 1;
payments.endpoint.v1.PaymentEndpoint destination = 2;
common.money.v1.Money amount = 3;
common.payment.v1.SettlementMode settlement_mode = 4;
payments.quotation.v2.FeeTreatment fee_treatment = 5;
string settlement_currency = 6;
string comment = 7;
}
message QuotePaymentRequest {
payments.shared.v1.RequestMeta meta = 1;
string idempotency_key = 2;
payments.transfer.v1.TransferIntent intent = 3;
payments.quotation.v2.QuoteIntent intent = 3;
bool preview_only = 4;
string initiator_ref = 5;
}
@@ -25,7 +36,7 @@ message QuotePaymentResponse {
message QuotePaymentsRequest {
payments.shared.v1.RequestMeta meta = 1;
string idempotency_key = 2;
repeated payments.transfer.v1.TransferIntent intents = 3;
repeated payments.quotation.v2.QuoteIntent intents = 3;
bool preview_only = 4;
string initiator_ref = 5;
}