Package com.privatechain.examples.spring
Class BlockchainRestController.PaymentTransaction
java.lang.Object
com.privatechain.core.model.Transaction
com.privatechain.examples.spring.BlockchainRestController.PaymentTransaction
- Enclosing class:
BlockchainRestController
Simple payment transaction used by the REST demo.
Defined as a private static inner class so this module does not need to
depend on example-simple-chain (which would create a cross-example
dependency). The JsonTypeInfo annotation
on Transaction writes the concrete class name (_type) into every
JSON payload, enabling full round-trips (AC-09).
-
Field Summary
Fields inherited from class com.privatechain.core.model.Transaction
metadata -
Constructor Summary
ConstructorsConstructorDescriptionPaymentTransaction(UUID id, String senderAddress, String receiverAddress, BigDecimal amount, Instant timestamp, Map<String, Object> metadata, String currency) Jackson deserialization constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ISO-4217 currency code.of(String sender, String receiver, BigDecimal amount, String currency) Factory for clean construction in the controller.byte[]Extends the base signable bytes with|currencyso the currency field is cryptographically bound to the signature.Methods inherited from class com.privatechain.core.model.Transaction
equals, getAmount, getId, getMetadata, getReceiverAddress, getSenderAddress, getSignature, getTimestamp, hashCode, isSigned, sign, toString
-
Constructor Details
-
PaymentTransaction
public PaymentTransaction(UUID id, String senderAddress, String receiverAddress, BigDecimal amount, Instant timestamp, Map<String, Object> metadata, String currency) Jackson deserialization constructor.- Parameters:
id- transaction UUIDsenderAddress- sender addressreceiverAddress- receiver addressamount- transfer amounttimestamp- UTC creation timemetadata- arbitrary key-value metadatacurrency- ISO-4217 currency code
-
-
Method Details
-
of
public static BlockchainRestController.PaymentTransaction of(String sender, String receiver, BigDecimal amount, String currency) Factory for clean construction in the controller.- Parameters:
sender- sender addressreceiver- receiver addressamount- transfer amountcurrency- ISO-4217 currency code- Returns:
- a new unsigned
PaymentTransaction
-
getCurrency
Returns the ISO-4217 currency code.- Returns:
- non-null currency code string
-
toSignableBytes
public byte[] toSignableBytes()Extends the base signable bytes with|currencyso the currency field is cryptographically bound to the signature.- Overrides:
toSignableBytesin classTransaction- Returns:
- signable byte array covering all fields including currency
-