Class MyPaymentBuilder

java.lang.Object
com.commercetools.api.models.me.MyPaymentBuilder
All Implemented Interfaces:
Builder<MyPayment>

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

     MyPayment myPayment = MyPayment.builder()
             .id("{id}")
             .version(0.3)
             .amountPlanned(amountPlannedBuilder -> amountPlannedBuilder)
             .paymentMethodInfo(paymentMethodInfoBuilder -> paymentMethodInfoBuilder)
             .plusTransactions(transactionsBuilder -> transactionsBuilder)
             .build()
 
  • Constructor Details

    • MyPaymentBuilder

      public MyPaymentBuilder()
  • Method Details

    • id

      public MyPaymentBuilder id(String id)

      Unique identifier of the Payment.

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

      public MyPaymentBuilder version(Long version)

      Current version of the Payment.

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

      Reference to a Customer associated with the Payment. Set automatically with a password flow token. Either customer or anonymousId is present.

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

      Reference to a Customer associated with the Payment. Set automatically with a password flow token. Either customer or anonymousId is present.

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

      public MyPaymentBuilder customer(@Nullable CustomerReference customer)

      Reference to a Customer associated with the Payment. Set automatically with a password flow token. Either customer or anonymousId is present.

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

      public MyPaymentBuilder anonymousId(@Nullable String anonymousId)

      Anonymous session associated with the Payment. Set automatically with a token for an anonymous session. Either customer or anonymousId is present.

      Parameters:
      anonymousId - 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 MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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
    • transactions

      public MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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 MyPaymentBuilder 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
    • custom

      Custom Fields defined for the Payment.

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

      Custom Fields defined for the Payment.

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

      public MyPaymentBuilder custom(@Nullable CustomFields custom)

      Custom Fields defined for the Payment.

      Parameters:
      custom - 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
    • getCustomer

      @Nullable public CustomerReference getCustomer()

      Reference to a Customer associated with the Payment. Set automatically with a password flow token. Either customer or anonymousId is present.

      Returns:
      customer
    • getAnonymousId

      @Nullable public String getAnonymousId()

      Anonymous session associated with the Payment. Set automatically with a token for an anonymous session. Either customer or anonymousId is present.

      Returns:
      anonymousId
    • 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
    • getTransactions

      public List<Transaction> getTransactions()

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

      Returns:
      transactions
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields defined for the Payment.

      Returns:
      custom
    • build

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

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

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

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