Class SavedPaymentMethod
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,com.broadleafcommerce.data.tracking.core.policy.Owned,Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanGeneral use map to capture any additional attributes needed for this saved payment method.The billing address of this saved payment method.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.General use map to capture any display properties for this saved payment method.Returns the saved payment method ID known by the payment gateway.The gateway used to process this saved payment method.getId()The id of this saved payment method.The timestamp of the last transaction made by this saved payment method.The result code returned from the gateway on the last transaction.getName()The name of this saved payment method.The next action for this payment method to complete its setup.ThePayment.getId()that this saved payment was created from.The id of the entity that owns this saved payment method.Describes the owning user of the saved payment method.Map to capture any information about the payment method needed to perform gateway transactions.The status of this saved payment method.getType()The type of this saved payment method like Credit Card or Gift Card.The version of this saved payment.The visibility of the payment method to child accounts.inthashCode()booleanWhether this saved payment is the default payment method for the owner entity.voidsetAttributes(Map<String, String> attributes) General use map to capture any additional attributes needed for this saved payment method.voidsetBillingAddress(Address billingAddress) The billing address of this saved payment method.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetDefaultForOwner(boolean defaultForOwner) Whether this saved payment is the default payment method for the owner entity.voidsetDisplayAttributes(Map<String, String> displayAttributes) General use map to capture any display properties for this saved payment method.voidsetGatewayReferenceId(String gatewayReferenceId) Returns the saved payment method ID known by the payment gateway.voidsetGatewayType(String gatewayType) The gateway used to process this saved payment method.voidThe id of this saved payment method.voidsetLastTransactionDateTime(Instant lastTransactionDateTime) The timestamp of the last transaction made by this saved payment method.voidsetLastTransactionResultCode(String lastTransactionResultCode) The result code returned from the gateway on the last transaction.voidThe name of this saved payment method.voidsetNextAction(SavedPaymentMethodNextAction nextAction) The next action for this payment method to complete its setup.voidsetOriginatingPaymentId(String originatingPaymentId) ThePayment.getId()that this saved payment was created from.voidsetOwningUserId(String owningUserId) The id of the entity that owns this saved payment method.voidsetOwningUserType(String owningUserType) Describes the owning user of the saved payment method.voidsetPaymentMethodProperties(Map<String, String> paymentMethodProperties) Map to capture any information about the payment method needed to perform gateway transactions.voidThe status of this saved payment method.voidThe type of this saved payment method like Credit Card or Gift Card.voidsetVersion(Integer version) The version of this saved payment.voidsetVisibleToChildren(String visibleToChildren) The visibility of the payment method to child accounts.toString()
-
Constructor Details
-
SavedPaymentMethod
public SavedPaymentMethod()
-
-
Method Details
-
getOwnerIdentifier
- Specified by:
getOwnerIdentifierin interfacecom.broadleafcommerce.data.tracking.core.policy.Owned
-
getId
The id of this saved payment method.- Returns:
- The id of this saved payment method.
-
getName
The name of this saved payment method. This name is typically something like "Visa ending in 1234".- Returns:
- The name of this saved payment method.
-
getStatus
The status of this saved payment method.This status is used to check whether this payment method is available to be used. By default, if it is equal to "AVAILABLE_TO_USE" it means that it can be used.
If the status is
DefaultSavedPaymentMethodStatus.REQUIRES_ACTIONnextActionis required.Some payment gateways require extra verification before the saved payment method can be used. We typically expect the result of the verification to be communicated via webhook interactions using
TransactionWebhookEndpoint.handleSavedPaymentMethodWebhook(java.lang.String, org.springframework.http.HttpHeaders, java.util.Map<java.lang.String, java.lang.String>, jakarta.servlet.http.HttpServletRequest)- Returns:
- The name of this saved payment method.
- See Also:
-
DefaultSavedPaymentMethodStatusSavedPaymentMethodWebhookService.handleWebhook(java.lang.String, org.springframework.http.HttpHeaders, java.lang.String, java.util.Map<java.lang.String, java.lang.String>)SavedPaymentMethodService.readAllAvailableToUseByOwningUserTypeAndOwningUserId(java.lang.String, java.lang.String, org.springframework.data.domain.Pageable, cz.jirutka.rsql.parser.ast.Node, com.broadleafcommerce.data.tracking.core.context.ContextInfo)
-
isDefaultForOwner
public boolean isDefaultForOwner()Whether this saved payment is the default payment method for the owner entity.- Returns:
- True if this saved payment is the default payment method for the owner, otherwise false.
-
getOriginatingPaymentId
ThePayment.getId()that this saved payment was created from. This is typically populated when a multi-use payment token is produced by executing a transaction against a single-use token via a checkout interaction.- Returns:
- The
Payment.getId()that this saved payment was created from
-
getOwningUserType
Describes the owning user of the saved payment method. For example, the saved payment could belong to a Broadleaf customer or an account, therefore this value might be BLC_CUSTOMER, or BLC_ACCOUNT.- Returns:
- The type describing the owning user of the saved payment method
-
getOwningUserId
The id of the entity that owns this saved payment method. For example, this may be a customer id, or an account id.- Returns:
- The id of the entity that owns this saved payment method.
-
getType
The type of this saved payment method like Credit Card or Gift Card.- Returns:
- The type of this saved payment method like Credit Card or Gift Card.
-
getGatewayType
The gateway used to process this saved payment method. Only a SINGLE payment gateway can be used for a payment.- Returns:
- The gateway used to process this saved payment method.
-
getPaymentMethodProperties
Map to capture any information about the payment method needed to perform gateway transactions.- Returns:
- Map to capture any information about the payment method needed to perform gateway transactions
-
getAttributes
General use map to capture any additional attributes needed for this saved payment method.- Returns:
- General use map to capture any additional attributes needed for this saved payment method
-
getDisplayAttributes
General use map to capture any display properties for this saved payment method.- Returns:
- General use map to capture any display properties for this saved payment method
-
getLastTransactionDateTime
The timestamp of the last transaction made by this saved payment method.- Returns:
- the last transaction date and time of the saved payment method
-
getLastTransactionResultCode
The result code returned from the gateway on the last transaction.- Returns:
- the result code from the last transaction for this saved payment method
-
getBillingAddress
The billing address of this saved payment method.- Returns:
- the billing address of this saved payment method
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
getVersion
The version of this saved payment. Used for checking that the requested version of the saved payment is up-to-date before saving changes. Required for any request which results in an update being made to the saved payment. This should never be manually incremented/decremented. -
getVisibleToChildren
The visibility of the payment method to child accounts.This is typically for B2B use cases where the
getOwningUserType()isDefaultSavedPaymentMethodOwningUserTypes.BLC_ACCOUNT. Should beDefaultChildrenVisibilityType.NOfor typical B2C use cases.- Returns:
- The visibility of the payment method to child accounts
- See Also:
-
getGatewayReferenceId
Returns the saved payment method ID known by the payment gateway. This value should be unique within a single tenant and can't be updated after creation. Note: if you can't guarantee uniqueness of the gateway's ID for the payment method, then we recommend generating your own unique ID to link the Broadleaf saved payment method & the gateway's payment method.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
-
getNextAction
The next action for this payment method to complete its setup. This action is required if thestatusisDefaultSavedPaymentMethodStatus.REQUIRES_ACTION.- Returns:
- the next action for this payment method
-
setId
The id of this saved payment method.- Parameters:
id- The id of this saved payment method.
-
setName
The name of this saved payment method. This name is typically something like "Visa ending in 1234".- Parameters:
name- The name of this saved payment method.
-
setStatus
The status of this saved payment method.This status is used to check whether this payment method is available to be used. By default, if it is equal to "AVAILABLE_TO_USE" it means that it can be used.
If the status is
DefaultSavedPaymentMethodStatus.REQUIRES_ACTIONnextActionis required.Some payment gateways require extra verification before the saved payment method can be used. We typically expect the result of the verification to be communicated via webhook interactions using
TransactionWebhookEndpoint.handleSavedPaymentMethodWebhook(java.lang.String, org.springframework.http.HttpHeaders, java.util.Map<java.lang.String, java.lang.String>, jakarta.servlet.http.HttpServletRequest)- Parameters:
name- The name of this saved payment method.- See Also:
-
DefaultSavedPaymentMethodStatusSavedPaymentMethodWebhookService.handleWebhook(java.lang.String, org.springframework.http.HttpHeaders, java.lang.String, java.util.Map<java.lang.String, java.lang.String>)SavedPaymentMethodService.readAllAvailableToUseByOwningUserTypeAndOwningUserId(java.lang.String, java.lang.String, org.springframework.data.domain.Pageable, cz.jirutka.rsql.parser.ast.Node, com.broadleafcommerce.data.tracking.core.context.ContextInfo)
-
setDefaultForOwner
public void setDefaultForOwner(boolean defaultForOwner) Whether this saved payment is the default payment method for the owner entity.- Parameters:
defaultForOwner- Whether this saved payment is the default payment method for the owner entity.
-
setOriginatingPaymentId
ThePayment.getId()that this saved payment was created from. This is typically populated when a multi-use payment token is produced by executing a transaction against a single-use token via a checkout interaction.- Parameters:
originatingPaymentId- ThePayment.getId()that this saved payment was created from
-
setOwningUserType
Describes the owning user of the saved payment method. For example, the saved payment could belong to a Broadleaf customer or an account, therefore this value might be BLC_CUSTOMER, or BLC_ACCOUNT.- Parameters:
owningUserType- The type describing the owning user of the saved payment method
-
setOwningUserId
The id of the entity that owns this saved payment method. For example, this may be a customer id, or an account id.- Parameters:
owningUserId- The id of the entity that owns this saved payment method.
-
setType
The type of this saved payment method like Credit Card or Gift Card.- Parameters:
type- The type of this saved payment method like Credit Card or Gift Card.
-
setGatewayType
The gateway used to process this saved payment method. Only a SINGLE payment gateway can be used for a payment.- Parameters:
gatewayType- The gateway used to process this saved payment method.
-
setPaymentMethodProperties
Map to capture any information about the payment method needed to perform gateway transactions.- Parameters:
paymentMethodProperties- Map to capture any information about the payment method needed to perform gateway transactions
-
setAttributes
General use map to capture any additional attributes needed for this saved payment method.- Parameters:
attributes- General use map to capture any additional attributes needed for this payment method
-
setDisplayAttributes
General use map to capture any display properties for this saved payment method.- Parameters:
displayAttributes- General use map to capture any display properties for this payment method
-
setLastTransactionDateTime
The timestamp of the last transaction made by this saved payment method.- Parameters:
lastTransactionDateTime- the last transaction date and time of the saved payment method
-
setLastTransactionResultCode
The result code returned from the gateway on the last transaction.- Parameters:
lastTransactionResultCode- the result code from the last transaction for this saved payment method
-
setBillingAddress
The billing address of this saved payment method.- Parameters:
billingAddress- the billing address of this saved payment method
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
setVersion
The version of this saved payment. Used for checking that the requested version of the saved payment is up-to-date before saving changes. Required for any request which results in an update being made to the saved payment. This should never be manually incremented/decremented. -
setVisibleToChildren
The visibility of the payment method to child accounts.This is typically for B2B use cases where the
getOwningUserType()isDefaultSavedPaymentMethodOwningUserTypes.BLC_ACCOUNT. Should beDefaultChildrenVisibilityType.NOfor typical B2C use cases.- Parameters:
visibleToChildren- The visibility of the payment method to child accounts- See Also:
-
setGatewayReferenceId
Returns the saved payment method ID known by the payment gateway. This value should be unique within a single tenant and can't be updated after creation. Note: if you can't guarantee uniqueness of the gateway's ID for the payment method, then we recommend generating your own unique ID to link the Broadleaf saved payment method & the gateway's payment method.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
-
setNextAction
The next action for this payment method to complete its setup. This action is required if thestatusisDefaultSavedPaymentMethodStatus.REQUIRES_ACTION.- Parameters:
nextAction- the next action for this payment method
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-