Class DefaultCreditAccountTransactionExecutionService
java.lang.Object
com.broadleafcommerce.creditaccount.service.DefaultCreditAccountTransactionExecutionService
- All Implemented Interfaces:
CreditAccountTransactionExecutionService
public class DefaultCreditAccountTransactionExecutionService
extends Object
implements CreditAccountTransactionExecutionService
- Author:
- Dima Myroniuk (dmyroniuk)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCreditAccountTransactionExecutionService(CreditAccountService<CreditAccount> creditAccountService, TransactionService<Transaction> transactionService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected TransactionExecutionResponsebuildResponse(@NonNull CreditAccount creditAccount, @NonNull Transaction transaction) protected TransactioncreateTransaction(@NonNull CreditAccount creditAccount, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) credit(@NonNull String accountNumber, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates the credit transaction for the credit account.credit(@NonNull String creditAccountType, @NonNull String accountNumber, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates the credit transaction for the credit account.debit(@NonNull String accountNumber, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates the debit transaction for the credit account.debit(@NonNull String creditAccountType, @NonNull String accountNumber, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates the debit transaction for the credit account.protected TransactionExecutionResponseexecuteTransaction(@NonNull CreditAccount creditAccount, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected TransactionExecutionResponseexecuteTransaction(@NonNull TransactionType transactionType, @NonNull CreditAccount creditAccount, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsprotected CreditAccountService<CreditAccount>protected CreditExpirationServiceprotected TransactionService<Transaction>protected com.broadleafcommerce.common.extension.TypeFactoryprotected List<com.broadleafcommerce.data.tracking.core.service.Update<Transaction>>populateExpirationTransactionDetails(@NonNull Transaction executedDebitTransaction, @NonNull List<Transaction> expiringCreditTransactions) protected voidrecordExpiringCreditTransactionUsages(@NonNull CreditAccount creditAccount, @NonNull Transaction executedTransaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) If the executed transaction with aDefaultTransactionType.DEBITtype and there are any expiring transactions, this method will update theTransaction.getAmountRemaining()andTransaction.getRelatedTransactionDetails()of them.voidsetCreditExpirationService(CreditExpirationService creditExpirationService) protected voidupdateSourceUserIfCSR(@NonNull TransactionExecutionRequest request) protected voidvalidate(@NonNull CreditAccount creditAccount, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Constructor Details
-
DefaultCreditAccountTransactionExecutionService
public DefaultCreditAccountTransactionExecutionService(CreditAccountService<CreditAccount> creditAccountService, TransactionService<Transaction> transactionService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
credit
@Transactional("creditAccountTransactionManager") public TransactionExecutionResponse credit(@NonNull @NonNull String accountNumber, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountTransactionExecutionServiceCreates the credit transaction for the credit account.- Specified by:
creditin interfaceCreditAccountTransactionExecutionService- Parameters:
accountNumber- the credit account numberrequest- the request to execute the transactioncontextInfo- context information related to multitenancy- Returns:
- the executed transaction
-
credit
@Transactional("creditAccountTransactionManager") public TransactionExecutionResponse credit(@NonNull @NonNull String creditAccountType, @NonNull @NonNull String accountNumber, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountTransactionExecutionServiceCreates the credit transaction for the credit account.- Specified by:
creditin interfaceCreditAccountTransactionExecutionService- Parameters:
creditAccountType- the credit account typeaccountNumber- the credit account numberrequest- the request to execute the transactioncontextInfo- context information related to multitenancy- Returns:
- the executed transaction
-
debit
@Transactional("creditAccountTransactionManager") public TransactionExecutionResponse debit(@NonNull @NonNull String accountNumber, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountTransactionExecutionServiceCreates the debit transaction for the credit account.- Specified by:
debitin interfaceCreditAccountTransactionExecutionService- Parameters:
accountNumber- the credit account numberrequest- the request to execute the transactioncontextInfo- context information related to multitenancy- Returns:
- the executed transaction
-
debit
@Transactional("creditAccountTransactionManager") public TransactionExecutionResponse debit(@NonNull @NonNull String creditAccountType, @NonNull @NonNull String accountNumber, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CreditAccountTransactionExecutionServiceCreates the debit transaction for the credit account.- Specified by:
debitin interfaceCreditAccountTransactionExecutionService- Parameters:
creditAccountType- the credit account typeaccountNumber- the credit account numberrequest- the request to execute the transactioncontextInfo- context information related to multitenancy- Returns:
- the executed transaction
-
validate
protected void validate(@NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
createTransaction
protected Transaction createTransaction(@NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
executeTransaction
protected TransactionExecutionResponse executeTransaction(@NonNull @NonNull TransactionType transactionType, @NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
executeTransaction
protected TransactionExecutionResponse executeTransaction(@NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
updateSourceUserIfCSR
-
buildResponse
protected TransactionExecutionResponse buildResponse(@NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull Transaction transaction) -
recordExpiringCreditTransactionUsages
protected void recordExpiringCreditTransactionUsages(@NonNull @NonNull CreditAccount creditAccount, @NonNull @NonNull Transaction executedTransaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) If the executed transaction with aDefaultTransactionType.DEBITtype and there are any expiring transactions, this method will update theTransaction.getAmountRemaining()andTransaction.getRelatedTransactionDetails()of them.- Parameters:
creditAccount- the credit accountexecutedTransaction- the executed transactioncontextInfo- context information related to multitenancy
-
populateExpirationTransactionDetails
protected List<com.broadleafcommerce.data.tracking.core.service.Update<Transaction>> populateExpirationTransactionDetails(@NonNull @NonNull Transaction executedDebitTransaction, @NonNull @NonNull List<Transaction> expiringCreditTransactions) -
getCreditAccountService
-
getTransactionService
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setCreditExpirationService
-
getCreditExpirationService
-