Class BlockchainRestController.PaymentTransaction

java.lang.Object
com.privatechain.core.model.Transaction
com.privatechain.examples.spring.BlockchainRestController.PaymentTransaction
Enclosing class:
BlockchainRestController

public static final class BlockchainRestController.PaymentTransaction extends Transaction
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).

  • 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 UUID
      senderAddress - sender address
      receiverAddress - receiver address
      amount - transfer amount
      timestamp - UTC creation time
      metadata - arbitrary key-value metadata
      currency - 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 address
      receiver - receiver address
      amount - transfer amount
      currency - ISO-4217 currency code
      Returns:
      a new unsigned PaymentTransaction
    • getCurrency

      public String getCurrency()
      Returns the ISO-4217 currency code.
      Returns:
      non-null currency code string
    • toSignableBytes

      public byte[] toSignableBytes()
      Extends the base signable bytes with |currency so the currency field is cryptographically bound to the signature.
      Overrides:
      toSignableBytes in class Transaction
      Returns:
      signable byte array covering all fields including currency