Class PaymentBuilder

java.lang.Object
com.commercetools.api.models.payment.PaymentBuilder
All Implemented Interfaces:
Builder<Payment>

public class PaymentBuilder extends Object implements Builder<Payment>
PaymentBuilder
Example to create an instance using the builder pattern

     Payment payment = Payment.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .amountPlanned(amountPlannedBuilder -> amountPlannedBuilder)
             .paymentMethodInfo(paymentMethodInfoBuilder -> paymentMethodInfoBuilder)
             .paymentStatus(paymentStatusBuilder -> paymentStatusBuilder)
             .plusTransactions(transactionsBuilder -> transactionsBuilder)
             .plusInterfaceInteractions(interfaceInteractionsBuilder -> interfaceInteractionsBuilder)
             .build()
 
  • Constructor Details

    • PaymentBuilder

      public PaymentBuilder()
  • Method Details

    • id

      public PaymentBuilder id(String id)

      Unique identifier of the Payment.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public PaymentBuilder version(Long version)

      Current version of the Payment.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public PaymentBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Payment was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public PaymentBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Payment was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the Payment.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • withLastModifiedBy

      public PaymentBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the Payment.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • lastModifiedBy

      public PaymentBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Payment.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the Payment.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • withCreatedBy

      public PaymentBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the Payment.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • createdBy

      public PaymentBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Payment.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • customer

      Reference to a Customer associated with the Payment.

      Parameters:
      builder - function to build the customer value
      Returns:
      Builder
    • withCustomer

      Reference to a Customer associated with the Payment.

      Parameters:
      builder - function to build the customer value
      Returns:
      Builder
    • customer

      public PaymentBuilder customer(@Nullable CustomerReference customer)

      Reference to a Customer associated with the Payment.

      Parameters:
      customer - value to be set
      Returns:
      Builder
    • anonymousId

      public PaymentBuilder anonymousId(@Nullable String anonymousId)

      Anonymous session associated with the Payment.

      Parameters:
      anonymousId - value to be set
      Returns:
      Builder
    • interfaceId

      public PaymentBuilder interfaceId(@Nullable String interfaceId)

      Identifier used by the payment service that processes the Payment (for example, a PSP). The combination of interfaceId and the paymentInterface field on PaymentMethodInfo must be unique.

      Parameters:
      interfaceId - value to be set
      Returns:
      Builder
    • amountPlanned

      Money value the Payment intends to receive from the customer. The value typically matches the Cart or Order gross total.

      Parameters:
      builder - function to build the amountPlanned value
      Returns:
      Builder
    • withAmountPlanned

      Money value the Payment intends to receive from the customer. The value typically matches the Cart or Order gross total.

      Parameters:
      builder - function to build the amountPlanned value
      Returns:
      Builder
    • amountPlanned

      public PaymentBuilder amountPlanned(CentPrecisionMoney amountPlanned)

      Money value the Payment intends to receive from the customer. The value typically matches the Cart or Order gross total.

      Parameters:
      amountPlanned - value to be set
      Returns:
      Builder
    • paymentMethodInfo

      Information regarding the payment interface (for example, a PSP), and the specific payment method used.

      Parameters:
      builder - function to build the paymentMethodInfo value
      Returns:
      Builder
    • withPaymentMethodInfo

      public PaymentBuilder withPaymentMethodInfo(Function<PaymentMethodInfoBuilder,PaymentMethodInfo> builder)

      Information regarding the payment interface (for example, a PSP), and the specific payment method used.

      Parameters:
      builder - function to build the paymentMethodInfo value
      Returns:
      Builder
    • paymentMethodInfo

      public PaymentBuilder paymentMethodInfo(PaymentMethodInfo paymentMethodInfo)

      Information regarding the payment interface (for example, a PSP), and the specific payment method used.

      Parameters:
      paymentMethodInfo - value to be set
      Returns:
      Builder
    • paymentStatus

      Current status of the Payment.

      Parameters:
      builder - function to build the paymentStatus value
      Returns:
      Builder
    • withPaymentStatus

      public PaymentBuilder withPaymentStatus(Function<PaymentStatusBuilder,PaymentStatus> builder)

      Current status of the Payment.

      Parameters:
      builder - function to build the paymentStatus value
      Returns:
      Builder
    • paymentStatus

      public PaymentBuilder paymentStatus(PaymentStatus paymentStatus)

      Current status of the Payment.

      Parameters:
      paymentStatus - value to be set
      Returns:
      Builder
    • transactions

      public PaymentBuilder transactions(Transaction... transactions)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      transactions - value to be set
      Returns:
      Builder
    • transactions

      public PaymentBuilder transactions(List<Transaction> transactions)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      transactions - value to be set
      Returns:
      Builder
    • plusTransactions

      public PaymentBuilder plusTransactions(Transaction... transactions)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      transactions - value to be set
      Returns:
      Builder
    • plusTransactions

      public PaymentBuilder plusTransactions(Function<TransactionBuilder,TransactionBuilder> builder)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      builder - function to build the transactions value
      Returns:
      Builder
    • withTransactions

      public PaymentBuilder withTransactions(Function<TransactionBuilder,TransactionBuilder> builder)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      builder - function to build the transactions value
      Returns:
      Builder
    • addTransactions

      public PaymentBuilder addTransactions(Function<TransactionBuilder,Transaction> builder)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      builder - function to build the transactions value
      Returns:
      Builder
    • setTransactions

      public PaymentBuilder setTransactions(Function<TransactionBuilder,Transaction> builder)

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Parameters:
      builder - function to build the transactions value
      Returns:
      Builder
    • interfaceInteractions

      public PaymentBuilder interfaceInteractions(CustomFields... interfaceInteractions)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      interfaceInteractions - value to be set
      Returns:
      Builder
    • interfaceInteractions

      public PaymentBuilder interfaceInteractions(List<CustomFields> interfaceInteractions)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      interfaceInteractions - value to be set
      Returns:
      Builder
    • plusInterfaceInteractions

      public PaymentBuilder plusInterfaceInteractions(CustomFields... interfaceInteractions)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      interfaceInteractions - value to be set
      Returns:
      Builder
    • plusInterfaceInteractions

      public PaymentBuilder plusInterfaceInteractions(Function<CustomFieldsBuilder,CustomFieldsBuilder> builder)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      builder - function to build the interfaceInteractions value
      Returns:
      Builder
    • withInterfaceInteractions

      public PaymentBuilder withInterfaceInteractions(Function<CustomFieldsBuilder,CustomFieldsBuilder> builder)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      builder - function to build the interfaceInteractions value
      Returns:
      Builder
    • addInterfaceInteractions

      public PaymentBuilder addInterfaceInteractions(Function<CustomFieldsBuilder,CustomFields> builder)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      builder - function to build the interfaceInteractions value
      Returns:
      Builder
    • setInterfaceInteractions

      public PaymentBuilder setInterfaceInteractions(Function<CustomFieldsBuilder,CustomFields> builder)

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Parameters:
      builder - function to build the interfaceInteractions value
      Returns:
      Builder
    • custom

      Custom Fields for the Payment.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields for the Payment.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public PaymentBuilder custom(@Nullable CustomFields custom)

      Custom Fields for the Payment.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • key

      public PaymentBuilder key(@Nullable String key)

      User-defined unique identifier of the Payment.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the Payment.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Payment.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Payment was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Payment was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Payment.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Payment.

      Returns:
      createdBy
    • getCustomer

      @Nullable public CustomerReference getCustomer()

      Reference to a Customer associated with the Payment.

      Returns:
      customer
    • getAnonymousId

      @Nullable public String getAnonymousId()

      Anonymous session associated with the Payment.

      Returns:
      anonymousId
    • getInterfaceId

      @Nullable public String getInterfaceId()

      Identifier used by the payment service that processes the Payment (for example, a PSP). The combination of interfaceId and the paymentInterface field on PaymentMethodInfo must be unique.

      Returns:
      interfaceId
    • getAmountPlanned

      public CentPrecisionMoney getAmountPlanned()

      Money value the Payment intends to receive from the customer. The value typically matches the Cart or Order gross total.

      Returns:
      amountPlanned
    • getPaymentMethodInfo

      public PaymentMethodInfo getPaymentMethodInfo()

      Information regarding the payment interface (for example, a PSP), and the specific payment method used.

      Returns:
      paymentMethodInfo
    • getPaymentStatus

      public PaymentStatus getPaymentStatus()

      Current status of the Payment.

      Returns:
      paymentStatus
    • getTransactions

      public List<Transaction> getTransactions()

      Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState.

      Returns:
      transactions
    • getInterfaceInteractions

      public List<CustomFields> getInterfaceInteractions()

      Represents information exchange with the payment service, for example, a PSP. An interaction may be a request sent, or a response or notification received from the payment service.

      Returns:
      interfaceInteractions
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields for the Payment.

      Returns:
      custom
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Payment.

      Returns:
      key
    • build

      public Payment build()
      builds Payment with checking for non-null required values
      Specified by:
      build in interface Builder<Payment>
      Returns:
      Payment
    • buildUnchecked

      public Payment buildUnchecked()
      builds Payment without checking for non-null required values
      Returns:
      Payment
    • of

      public static PaymentBuilder of()
      factory method for an instance of PaymentBuilder
      Returns:
      builder
    • of

      public static PaymentBuilder of(Payment template)
      create builder for Payment instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder