Files
sendico/api/proto/payments/quotation/v2/interface.proto
2026-02-18 01:35:28 +01:00

119 lines
3.3 KiB
Protocol Buffer

syntax = "proto3";
package payments.quotation.v2;
option go_package = "github.com/tech/sendico/pkg/proto/payments/quotation/v2;quotationv2";
import "google/protobuf/timestamp.proto";
import "api/proto/common/storable/v1/storable.proto";
import "api/proto/common/money/v1/money.proto";
import "api/proto/billing/fees/v1/fees.proto";
import "api/proto/oracle/v1/oracle.proto";
enum QuoteKind {
QUOTE_KIND_UNSPECIFIED = 0;
QUOTE_KIND_EXECUTABLE = 1; // can be executed now (subject to execution-time checks)
QUOTE_KIND_INDICATIVE = 2; // informational only
}
enum QuoteLifecycle {
QUOTE_LIFECYCLE_UNSPECIFIED = 0;
QUOTE_LIFECYCLE_ACTIVE = 1;
QUOTE_LIFECYCLE_EXPIRED = 2;
}
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;
QUOTE_BLOCK_REASON_INSUFFICIENT_LIQUIDITY = 4;
QUOTE_BLOCK_REASON_PRICE_STALE = 5;
QUOTE_BLOCK_REASON_AMOUNT_TOO_SMALL = 6;
QUOTE_BLOCK_REASON_AMOUNT_TOO_LARGE = 7;
}
enum QuoteExecutionReadiness {
QUOTE_EXECUTION_READINESS_UNSPECIFIED = 0;
QUOTE_EXECUTION_READINESS_LIQUIDITY_READY = 1;
QUOTE_EXECUTION_READINESS_LIQUIDITY_OBTAINABLE = 2;
QUOTE_EXECUTION_READINESS_INDICATIVE = 3;
}
enum RouteHopRole {
ROUTE_HOP_ROLE_UNSPECIFIED = 0;
ROUTE_HOP_ROLE_SOURCE = 1;
ROUTE_HOP_ROLE_TRANSIT = 2;
ROUTE_HOP_ROLE_DESTINATION = 3;
}
message RouteHop {
uint32 index = 1;
string rail = 2;
string gateway = 3;
string instance_id = 4;
string network = 5;
RouteHopRole role = 6;
}
// Abstract execution route selected during quotation.
// This is not an execution plan and must not contain operational steps.
message RouteSpecification {
string rail = 1;
string provider = 2;
string payout_method = 3;
string settlement_asset = 4;
string settlement_model = 5;
string network = 6;
string route_ref = 7;
string pricing_profile_ref = 8;
repeated RouteHop hops = 9;
}
// Execution assumptions and constraints evaluated at quotation time.
// Operational planning is performed by the execution layer later.
message ExecutionConditions {
QuoteExecutionReadiness readiness = 1;
bool batching_eligible = 2;
bool prefunding_required = 3;
bool prefunding_cost_included = 4;
bool liquidity_check_required_at_execution = 5;
string latency_hint = 6;
repeated string assumptions = 7;
}
message PaymentQuote {
common.storable.v1.Storable storable = 1;
QuoteKind kind = 2;
QuoteLifecycle lifecycle = 3;
// Execution-status rules:
// 1) kind=QUOTE_KIND_INDICATIVE => execution_status must be unset.
// 2) lifecycle=QUOTE_LIFECYCLE_EXPIRED => execution_status must be unset.
// 3) kind=QUOTE_KIND_EXECUTABLE and lifecycle=QUOTE_LIFECYCLE_ACTIVE => execution_status must be set.
oneof execution_status {
bool executable = 13; // must be true when set
QuoteBlockReason block_reason = 4;
}
common.money.v1.Money debit_amount = 5;
common.money.v1.Money credit_amount = 6;
repeated fees.v1.DerivedPostingLine fee_lines = 7;
repeated fees.v1.AppliedRule fee_rules = 8;
oracle.v1.Quote fx_quote = 9;
string quote_ref = 10;
google.protobuf.Timestamp expires_at = 11;
google.protobuf.Timestamp priced_at = 12;
RouteSpecification route = 14;
ExecutionConditions execution_conditions = 15;
common.money.v1.Money total_cost = 16;
}