Class CreatePaymentAccountEventListener
- java.lang.Object
-
- com.broadleafcommerce.customer.messaging.CreatePaymentAccountEventListener
-
@DataRouteByKey("customer") @Deprecated(since="1.7.2", forRemoval=true) public class CreatePaymentAccountEventListener extends ObjectDeprecated, for removal: This API element is subject to removal in a future version.since 1.7.2. The creation of saved payment methods as a portion of the checkout process is now handled via a post-transaction hook in PaymentTransactionServices. If the saved payment method storage location isBLC_CUSTOMER_SERVICES, then this listener should be enabled for a time to handle any existing messages whose saved payment methods were not created via the PaymentTransactionServices hook. Once a day or two have passed after adopting the PaymentTransactionServices changes, this listener can be disabled.An event listener that triggers when an order is successfully submitted. Responsible for checking the completed cart for any newly specified payment methods that the user wishes to save for future usage or usage of any previously saved payment methods to record the latest results.This listener is only needed for the transitional period of upgrading the PaymentTransactionServices to 1.0.2, to ensure that payment accounts are created for unprocessed messages after the upgrade. Once a day or two have passed after adopting the PaymentTransactionServices upgrade, this listener can be disabled by declaring
broadleaf.customer.messaging.payment-account.create.enabled=falseNote that this listener is only relevant if the saved payment method storage location is
BLC_CUSTOMER_SERVICES, which can be set using thebroadleaf.customer.saved-payment-method.storage-locationandbroadleaf.paymenttransaction.saved-payment-method.storage-locationproperties.- Author:
- Chris Kittrell (ckittrell)
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPPLICATION_ID_PATHDeprecated, for removal: This API element is subject to removal in a future version.static StringCART_ID_PATHDeprecated, for removal: This API element is subject to removal in a future version.static StringCART_STATUS_PATHDeprecated, for removal: This API element is subject to removal in a future version.protected CreatePaymentAccountEventPropertiescreatePaymentAccountEventPropertiesDeprecated, for removal: This API element is subject to removal in a future version.static StringCUSTOMER_CONTEXT_ID_PATHDeprecated, for removal: This API element is subject to removal in a future version.static StringCUSTOMER_ID_PATHDeprecated, for removal: This API element is subject to removal in a future version.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionServiceidempotentConsumptionServiceDeprecated, for removal: This API element is subject to removal in a future version.protected com.fasterxml.jackson.databind.ObjectMapperobjectMapperDeprecated, for removal: This API element is subject to removal in a future version.protected PaymentAccountService<PaymentAccount>paymentAccountServiceDeprecated, for removal: This API element is subject to removal in a future version.protected PaymentProvider<Payment>paymentProviderDeprecated, for removal: This API element is subject to removal in a future version.protected static StringSUBMITTEDDeprecated, for removal: This API element is subject to removal in a future version.protected static StringSUCCESSDeprecated, for removal: This API element is subject to removal in a future version.static StringTENANT_ID_PATHDeprecated, for removal: This API element is subject to removal in a future version.protected com.broadleafcommerce.common.extension.TypeFactorytypeFactoryDeprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Summary
Constructors Constructor Description CreatePaymentAccountEventListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, PaymentAccountService<PaymentAccount> paymentAccountService, PaymentProvider<Payment> paymentProvider, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfo(@NonNull com.jayway.jsonpath.DocumentContext jsonContext)Deprecated, for removal: This API element is subject to removal in a future version.Builds aContextInfofor the application context id and tenant idprotected PaymentAccountbuildPaymentAccount(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.Builds aPaymentAccountbased on the provided cartPaymentprotected StringgetCardExpirationMonthAttributeName()Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetCardExpirationYearAttributeName()Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetCardNumberAttributeName()Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetCardType(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetCardTypeAttributeName()Deprecated, for removal: This API element is subject to removal in a future version.CreatePaymentAccountEventPropertiesgetCreatePaymentAccountEventProperties()Deprecated, for removal: This API element is subject to removal in a future version.protected InstantgetDateRecorded(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected com.jayway.jsonpath.DocumentContextgetDocumentContext(@NonNull String payload)Deprecated, for removal: This API element is subject to removal in a future version.Parses the message payload into a `DocumentContext` which allows for JsonPath parsing using Jackson providers.protected IntegergetExpirationMonth(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected IntegergetExpirationYear(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetGatewayResponseCode(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionServicegetIdempotentConsumptionService()Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetLastFour(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected PaymentTransactiongetLatestSuccessfulTransaction(Payment payment)Deprecated, for removal: This API element is subject to removal in a future version.protected com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()Deprecated, for removal: This API element is subject to removal in a future version.protected PaymentAccountService<PaymentAccount>getPaymentAccountService()Deprecated, for removal: This API element is subject to removal in a future version.protected PaymentProvider<Payment>getPaymentProvider()Deprecated, for removal: This API element is subject to removal in a future version.protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()Deprecated, for removal: This API element is subject to removal in a future version.protected booleanisSubmittedOrder(com.jayway.jsonpath.DocumentContext jsonContext)Deprecated, for removal: This API element is subject to removal in a future version.voidlisten(org.springframework.messaging.Message<String> message)Deprecated, for removal: This API element is subject to removal in a future version.Event listener entry point.protected voidprocessMessage(@NonNull org.springframework.messaging.Message<String> message)Deprecated, for removal: This API element is subject to removal in a future version.Handles the interpretation of the message payload & if necessary, createsPaymentAccount(s)for the customervoidsetCreatePaymentAccountEventProperties(CreatePaymentAccountEventProperties properties)Deprecated, for removal: This API element is subject to removal in a future version.
-
-
-
Field Detail
-
SUBMITTED
protected static final String SUBMITTED
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
SUCCESS
protected static final String SUCCESS
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CART_STATUS_PATH
public static final String CART_STATUS_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CART_ID_PATH
public static final String CART_ID_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
APPLICATION_ID_PATH
public static final String APPLICATION_ID_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
TENANT_ID_PATH
public static final String TENANT_ID_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CUSTOMER_CONTEXT_ID_PATH
public static final String CUSTOMER_CONTEXT_ID_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
CUSTOMER_ID_PATH
public static final String CUSTOMER_ID_PATH
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
- Constant Field Values
-
idempotentConsumptionService
protected final com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService
Deprecated, for removal: This API element is subject to removal in a future version.
-
paymentAccountService
protected final PaymentAccountService<PaymentAccount> paymentAccountService
Deprecated, for removal: This API element is subject to removal in a future version.
-
paymentProvider
protected final PaymentProvider<Payment> paymentProvider
Deprecated, for removal: This API element is subject to removal in a future version.
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
Deprecated, for removal: This API element is subject to removal in a future version.
-
typeFactory
protected final com.broadleafcommerce.common.extension.TypeFactory typeFactory
Deprecated, for removal: This API element is subject to removal in a future version.
-
createPaymentAccountEventProperties
protected CreatePaymentAccountEventProperties createPaymentAccountEventProperties
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Detail
-
CreatePaymentAccountEventListener
public CreatePaymentAccountEventListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, PaymentAccountService<PaymentAccount> paymentAccountService, PaymentProvider<Payment> paymentProvider, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Detail
-
setCreatePaymentAccountEventProperties
@Autowired public void setCreatePaymentAccountEventProperties(CreatePaymentAccountEventProperties properties)
Deprecated, for removal: This API element is subject to removal in a future version.
-
listen
@StreamListener("checkoutCompletionInputCustomer") public void listen(org.springframework.messaging.Message<String> message)Deprecated, for removal: This API element is subject to removal in a future version.Event listener entry point. Checks if the message has already been received and, if not, begins processing it.- Parameters:
message- the message to be processed
-
processMessage
protected void processMessage(@NonNull @NonNull org.springframework.messaging.Message<String> message)Deprecated, for removal: This API element is subject to removal in a future version.Handles the interpretation of the message payload & if necessary, createsPaymentAccount(s)for the customer- Parameters:
message- the message to be processed
-
getDocumentContext
protected com.jayway.jsonpath.DocumentContext getDocumentContext(@NonNull @NonNull String payload)Deprecated, for removal: This API element is subject to removal in a future version.Parses the message payload into a `DocumentContext` which allows for JsonPath parsing using Jackson providers.- Parameters:
payload- the message payload- Returns:
- a `DocumentContext` representation of the message payload
-
isSubmittedOrder
protected boolean isSubmittedOrder(com.jayway.jsonpath.DocumentContext jsonContext)
Deprecated, for removal: This API element is subject to removal in a future version.
-
buildContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfo(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)Deprecated, for removal: This API element is subject to removal in a future version.Builds aContextInfofor the application context id and tenant id- Parameters:
jsonContext- The json representation of the message payload- Returns:
- the
ContextInfoof the completed checkout
-
buildPaymentAccount
protected PaymentAccount buildPaymentAccount(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.Builds aPaymentAccountbased on the provided cartPayment- Parameters:
payment- a cart payment that was used during checkout- Returns:
- The populated PaymentAccount object
-
getCardType
@Nullable protected String getCardType(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCardTypeAttributeName
protected String getCardTypeAttributeName()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getLastFour
@Nullable protected String getLastFour(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCardNumberAttributeName
protected String getCardNumberAttributeName()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getExpirationMonth
@Nullable protected Integer getExpirationMonth(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCardExpirationMonthAttributeName
protected String getCardExpirationMonthAttributeName()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getExpirationYear
@Nullable protected Integer getExpirationYear(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCardExpirationYearAttributeName
protected String getCardExpirationYearAttributeName()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getDateRecorded
protected Instant getDateRecorded(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getGatewayResponseCode
protected String getGatewayResponseCode(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getLatestSuccessfulTransaction
protected PaymentTransaction getLatestSuccessfulTransaction(Payment payment)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getPaymentAccountService
protected PaymentAccountService<PaymentAccount> getPaymentAccountService()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getPaymentProvider
protected PaymentProvider<Payment> getPaymentProvider()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCreatePaymentAccountEventProperties
public CreatePaymentAccountEventProperties getCreatePaymentAccountEventProperties()
Deprecated, for removal: This API element is subject to removal in a future version.
-
-