Class PaymentMethodBuilder

java.lang.Object
com.commercetools.api.models.payment_method.PaymentMethodBuilder
All Implemented Interfaces:
Builder<PaymentMethod>

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

     PaymentMethod paymentMethod = PaymentMethod.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .paymentMethodStatus(PaymentMethodStatus.ACTIVE)
             .default(true)
             .build()
 
  • Constructor Details

    • PaymentMethodBuilder

      public PaymentMethodBuilder()
  • Method Details

    • id

      public PaymentMethodBuilder id(String id)

      Unique identifier of the PaymentMethod.

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

      public PaymentMethodBuilder version(Long version)

      Current version of the PaymentMethod.

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

      public PaymentMethodBuilder createdAt(ZonedDateTime createdAt)

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

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

      public PaymentMethodBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      public PaymentMethodBuilder key(@Nullable String key)

      User-defined unique identifier of the PaymentMethod.

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

      Name of the PaymentMethod.

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

      Name of the PaymentMethod.

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

      public PaymentMethodBuilder name(@Nullable LocalizedString name)

      Name of the PaymentMethod.

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

      Reference to a Customer associated with the PaymentMethod.

      If businessUnit is set, the Customer is an Associate of the Business Unit.

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

      Reference to a Customer associated with the PaymentMethod.

      If businessUnit is set, the Customer is an Associate of the Business Unit.

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

      public PaymentMethodBuilder customer(@Nullable CustomerReference customer)

      Reference to a Customer associated with the PaymentMethod.

      If businessUnit is set, the Customer is an Associate of the Business Unit.

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

      Reference to a BusinessUnit associated with the PaymentMethod.

      Only available for B2B-enabled Projects.

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

      Reference to a BusinessUnit associated with the PaymentMethod.

      Only available for B2B-enabled Projects.

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

      public PaymentMethodBuilder businessUnit(@Nullable BusinessUnitKeyReference businessUnit)

      Reference to a BusinessUnit associated with the PaymentMethod.

      Only available for B2B-enabled Projects.

      Parameters:
      businessUnit - value to be set
      Returns:
      Builder
    • method

      public PaymentMethodBuilder method(@Nullable String method)

      Payment Method used for the Payment—for example, a credit card or direct debit.

      Parameters:
      method - value to be set
      Returns:
      Builder
    • paymentInterface

      public PaymentMethodBuilder paymentInterface(@Nullable String paymentInterface)

      Payment service that processes the Payment—for example, a PSP.

      Parameters:
      paymentInterface - value to be set
      Returns:
      Builder
    • interfaceAccount

      public PaymentMethodBuilder interfaceAccount(@Nullable String interfaceAccount)

      Account or instance of the payment interface when multiple accounts are used (per interface).

      Parameters:
      interfaceAccount - value to be set
      Returns:
      Builder
    • token

      Tokenized representation of the PaymentMethod used by the payment interface.

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

      Tokenized representation of the PaymentMethod used by the payment interface.

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

      public PaymentMethodBuilder token(@Nullable PaymentMethodToken token)

      Tokenized representation of the PaymentMethod used by the payment interface.

      Parameters:
      token - value to be set
      Returns:
      Builder
    • paymentMethodStatus

      public PaymentMethodBuilder paymentMethodStatus(PaymentMethodStatus paymentMethodStatus)

      Status of the PaymentMethod.

      Parameters:
      paymentMethodStatus - value to be set
      Returns:
      Builder
    • _default

      public PaymentMethodBuilder _default(Boolean _default)

      Indicates if the PaymentMethod is the default.

      The default applies per Customer, Business Unit, or the combination of both (Associate).

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

      Custom Fields of the PaymentMethod.

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

      Custom Fields of the PaymentMethod.

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

      public PaymentMethodBuilder custom(@Nullable CustomFields custom)

      Custom Fields of the PaymentMethod.

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

      IDs and references that last modified the PaymentMethod.

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

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

      IDs and references that last modified the PaymentMethod.

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

      public PaymentMethodBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the PaymentMethod.

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

      IDs and references that created the PaymentMethod.

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

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

      IDs and references that created the PaymentMethod.

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

      public PaymentMethodBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the PaymentMethod.

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

      public String getId()

      Unique identifier of the PaymentMethod.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the PaymentMethod.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the PaymentMethod.

      Returns:
      key
    • getName

      @Nullable public LocalizedString getName()

      Name of the PaymentMethod.

      Returns:
      name
    • getCustomer

      @Nullable public CustomerReference getCustomer()

      Reference to a Customer associated with the PaymentMethod.

      If businessUnit is set, the Customer is an Associate of the Business Unit.

      Returns:
      customer
    • getBusinessUnit

      @Nullable public BusinessUnitKeyReference getBusinessUnit()

      Reference to a BusinessUnit associated with the PaymentMethod.

      Only available for B2B-enabled Projects.

      Returns:
      businessUnit
    • getMethod

      @Nullable public String getMethod()

      Payment Method used for the Payment—for example, a credit card or direct debit.

      Returns:
      method
    • getPaymentInterface

      @Nullable public String getPaymentInterface()

      Payment service that processes the Payment—for example, a PSP.

      Returns:
      paymentInterface
    • getInterfaceAccount

      @Nullable public String getInterfaceAccount()

      Account or instance of the payment interface when multiple accounts are used (per interface).

      Returns:
      interfaceAccount
    • getToken

      @Nullable public PaymentMethodToken getToken()

      Tokenized representation of the PaymentMethod used by the payment interface.

      Returns:
      token
    • getPaymentMethodStatus

      public PaymentMethodStatus getPaymentMethodStatus()

      Status of the PaymentMethod.

      Returns:
      paymentMethodStatus
    • getDefault

      public Boolean getDefault()

      Indicates if the PaymentMethod is the default.

      The default applies per Customer, Business Unit, or the combination of both (Associate).

      Returns:
      default
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the PaymentMethod.

      Returns:
      custom
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the PaymentMethod.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the PaymentMethod.

      Returns:
      createdBy
    • build

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

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

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

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