Package com.tnsai.payment
Record Class Quote
java.lang.Object
java.lang.Record
com.tnsai.payment.Quote
- Record Components:
quoteId- broker-issued identifier; opaque to the caller, presented onPaymentBroker.settle(com.tnsai.payment.Quote)payer- who's payingpayee- who's getting paidservice- what's being paid forpriceUSD- broker-computed total in USDidempotencyKey- unique per logical payment intent; caller supplies it so retries land on the same paymentissuedAt- wall-clock instant the broker minted the quoteexpiresAt- wall-clock instant past which the quote is no longer settle-able
public record Quote(String quoteId, AgentPrincipal payer, AgentPrincipal payee, Service service, BigDecimal priceUSD, String idempotencyKey, Instant issuedAt, Instant expiresAt)
extends Record
Priced commitment for a
Service between two
AgentPrincipal agents (TNS-298). Returned by
PaymentBroker.quote(com.tnsai.identity.AgentPrincipal, com.tnsai.identity.AgentPrincipal, com.tnsai.payment.Service) and consumed by
PaymentBroker.settle(com.tnsai.payment.Quote).
Quotes are valid until expiresAt; the broker rejects
settlement attempts past expiry. Idempotency keys let callers retry
a settlement (network-flaky path) without re-charging.
- Since:
- 0.10.0 (TNS-298)
-
Constructor Summary
ConstructorsConstructorDescriptionQuote(String quoteId, AgentPrincipal payer, AgentPrincipal payee, Service service, BigDecimal priceUSD, String idempotencyKey, Instant issuedAt, Instant expiresAt) Creates an instance of aQuoterecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theidempotencyKeyrecord component.booleantruewhennowfalls strictly pastexpiresAt.issuedAt()Returns the value of theissuedAtrecord component.payee()Returns the value of thepayeerecord component.payer()Returns the value of thepayerrecord component.priceUSD()Returns the value of thepriceUSDrecord component.quoteId()Returns the value of thequoteIdrecord component.service()Returns the value of theservicerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Quote
public Quote(String quoteId, AgentPrincipal payer, AgentPrincipal payee, Service service, BigDecimal priceUSD, String idempotencyKey, Instant issuedAt, Instant expiresAt) Creates an instance of aQuoterecord class.- Parameters:
quoteId- the value for thequoteIdrecord componentpayer- the value for thepayerrecord componentpayee- the value for thepayeerecord componentservice- the value for theservicerecord componentpriceUSD- the value for thepriceUSDrecord componentidempotencyKey- the value for theidempotencyKeyrecord componentissuedAt- the value for theissuedAtrecord componentexpiresAt- the value for theexpiresAtrecord component
-
-
Method Details
-
isExpired
truewhennowfalls strictly pastexpiresAt. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
quoteId
Returns the value of thequoteIdrecord component.- Returns:
- the value of the
quoteIdrecord component
-
payer
Returns the value of thepayerrecord component.- Returns:
- the value of the
payerrecord component
-
payee
Returns the value of thepayeerecord component.- Returns:
- the value of the
payeerecord component
-
service
Returns the value of theservicerecord component.- Returns:
- the value of the
servicerecord component
-
priceUSD
Returns the value of thepriceUSDrecord component.- Returns:
- the value of the
priceUSDrecord component
-
idempotencyKey
Returns the value of theidempotencyKeyrecord component.- Returns:
- the value of the
idempotencyKeyrecord component
-
issuedAt
Returns the value of theissuedAtrecord component.- Returns:
- the value of the
issuedAtrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-