Class SavedPaymentMethodSetupResult

java.lang.Object
com.broadleafcommerce.paymentgateway.domain.SavedPaymentMethodSetupResult
All Implemented Interfaces:
Serializable

public class SavedPaymentMethodSetupResult extends Object implements Serializable
Some payment gateways require extra time or verification steps to finish creating the saved payment method. When we receive the result of the saved payment method creation (e.g. via a webhook request), we intend to map the gateway's response into this object, which will then be used to finalize the creation of a "SavedPaymentMethod".
Author:
Dima Myroniuk (dmyroniuk)
See Also:
  • Constructor Details

    • SavedPaymentMethodSetupResult

      public SavedPaymentMethodSetupResult()
  • Method Details

    • getSuccessful

      @Nullable public Boolean getSuccessful()
      Whether the saved payment method is created successfully.
      Returns:
      true if the saved payment method is created successfully, false if failed, null if undetermined
    • getPaymentGatewayStatus

      public String getPaymentGatewayStatus()
      Returns the payment gateway status. It can be of any value and should be used mainly for debugging, analyzing any issues.
      Returns:
      the payment gateway status
    • getGatewayReferenceId

      public String getGatewayReferenceId()
      Returns the saved payment method id known by the payment gateway.

      This is an ID that is used to fetch the saved payment method that should be updated by the webhook handler.

      For example, to create the saved payment method for the ACH payments in Stripe, you have to create the SetupIntent object and after that create the saved payment method entity in the PaymentTransactionServices. It is possible that this payment method cannot be verified instantly by the customer's bank. In this case, Stripe will send the webhook event "setup_intent.succeeded" or "setup_intent.setup_failed" when it is confirmed by the customer. And to have an ability to update the correct payment method in PaymentTransactionServices we have to fetch it by this reference ID. For Stripe this value should be the SetupIntent ID.

      Returns:
      the saved payment method id known by the payment gateway
    • getErrorMessage

      @Nullable public String getErrorMessage()
      Returns the error message if creating the saved payment method is failed.
      Returns:
      the error message if any
    • getTenantId

      public String getTenantId()
      The tenant id that the saved payment method belongs to.
      Returns:
      the tenant id that the saved payment method belongs to
    • getAdditionalAttributes

      public Map<String,String> getAdditionalAttributes()
      Contains the additional information about the webhook event.
      Returns:
      the additional information about the webhook event
    • setSuccessful

      public void setSuccessful(@Nullable Boolean successful)
      Whether the saved payment method is created successfully.
      Parameters:
      successful - whether the saved payment method is created successfully
    • setPaymentGatewayStatus

      public void setPaymentGatewayStatus(String paymentGatewayStatus)
      Returns the payment gateway status. It can be of any value and should be used mainly for debugging, analyzing any issues.
      Parameters:
      paymentGatewayStatus - the payment gateway status
    • setGatewayReferenceId

      public void setGatewayReferenceId(String gatewayReferenceId)
      Returns the saved payment method id known by the payment gateway.

      This is an ID that is used to fetch the saved payment method that should be updated by the webhook handler.

      For example, to create the saved payment method for the ACH payments in Stripe, you have to create the SetupIntent object and after that create the saved payment method entity in the PaymentTransactionServices. It is possible that this payment method cannot be verified instantly by the customer's bank. In this case, Stripe will send the webhook event "setup_intent.succeeded" or "setup_intent.setup_failed" when it is confirmed by the customer. And to have an ability to update the correct payment method in PaymentTransactionServices we have to fetch it by this reference ID. For Stripe this value should be the SetupIntent ID.

      Parameters:
      gatewayReferenceId - the saved payment method id known by the payment gateway
    • setErrorMessage

      public void setErrorMessage(@Nullable String errorMessage)
      Returns the error message if creating the saved payment method is failed.
      Parameters:
      errorMessage - the error message if any
    • setTenantId

      public void setTenantId(String tenantId)
      The tenant id that the saved payment method belongs to.
      Parameters:
      tenantId - the tenant id that the saved payment method belongs to
    • setAdditionalAttributes

      public void setAdditionalAttributes(Map<String,String> additionalAttributes)
      Contains the additional information about the webhook event.
      Parameters:
      additionalAttributes - the additional information about the webhook event