Class DefaultWalletService<W extends WalletWithPaymentAccounts,R extends BillingProcessingRequestWithFullDetails>
java.lang.Object
com.broadleafcommerce.billing.service.impl.DefaultWalletService<W,R>
- All Implemented Interfaces:
WalletService<W,R>
public class DefaultWalletService<W extends WalletWithPaymentAccounts,R extends BillingProcessingRequestWithFullDetails>
extends Object
implements WalletService<W,R>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWalletService(SavedPaymentMethodProvider<SavedPaymentMethod> provider, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected AddressbuildAddress(Address billingAddress) protected WalletbuildWallet(String userId, List<SavedPaymentMethod> savedPaymentMethods) protected WbuildWalletWithPaymentAccounts(String userId, List<SavedPaymentMethod> savedPaymentMethods) getActiveAccountIds(List<SavedPaymentMethod> savedPaymentMethods) protected StringgetCardType(SavedPaymentMethod savedPaymentMethod) protected StringgetDefaultAccountId(List<SavedPaymentMethod> savedPaymentMethods) protected IntegergetExpirationMonth(SavedPaymentMethod savedPaymentMethod) protected IntegergetExpirationYear(SavedPaymentMethod savedPaymentMethod) protected StringgetMaskedAccountNumber(SavedPaymentMethod savedPaymentMethod) protected StringgetNameOnAccount(SavedPaymentMethod savedPaymentMethod) protected StringgetPhoneNumber(Address billingAddress) protected Map<String,PaymentAccount> getPreferredAccountsByProcessingRequestId(List<R> billingProcessingRequestsWithFullDetails, Map<String, W> walletsByProcessingRequestId) protected Optional<PaymentAccount>getPreferredPaymentAccount(String preferredPaymentAccountId, W walletWithAccounts) getPreferredPaymentAccountIds(List<R> billingProcessingRequestWithFullDetails) protected SavedPaymentMethodProvider<SavedPaymentMethod>protected com.broadleafcommerce.common.extension.TypeFactorygetUserIds(List<R> billingProcessingRequestWithFullDetails) getWalletWithPaymentAccountsByProcessingRequestId(List<R> billingProcessingRequestWithFullDetails, List<W> walletsWithAccounts) getWalletWithPaymentAccountsByUserId(List<W> walletWithAccounts) protected booleanisPreferredAccountFirst(String preferredPaymentAccountId, List<PaymentAccount> activePaymentAccounts) mapSavedPaymentMethodsToWalletsWithAccounts(List<SavedPaymentMethod> savedPaymentMethods) protected PaymentAccountmapSavedPaymentMethodToPaymentAccount(SavedPaymentMethod savedPaymentMethod) protected List<PaymentAccount>putPreferredAccountFirstInList(PaymentAccount preferredPaymentAccount, List<PaymentAccount> activeAccounts) readWalletsWithPaymentAccounts(List<R> billingProcessingRequestsWithFullDetails, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gather a map ofWalletWithPaymentAccountsobjects identified byBillingProcessingRequest.getId()protected WsortWalletPaymentAccounts(W walletWithPaymentAccounts, PaymentAccount preferredAccount)
-
Constructor Details
-
DefaultWalletService
public DefaultWalletService(SavedPaymentMethodProvider<SavedPaymentMethod> provider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
readWalletsWithPaymentAccounts
@Nullable public Map<String,W> readWalletsWithPaymentAccounts(List<R> billingProcessingRequestsWithFullDetails, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WalletServiceGather a map ofWalletWithPaymentAccountsobjects identified byBillingProcessingRequest.getId()- Specified by:
readWalletsWithPaymentAccountsin interfaceWalletService<W extends WalletWithPaymentAccounts,R extends BillingProcessingRequestWithFullDetails> - Returns:
- a map of
BillingProcessingRequest.getId()to aWalletWithPaymentAccounts
-
getUserIds
-
getPreferredAccountsByProcessingRequestId
-
getPreferredPaymentAccountIds
-
getPreferredPaymentAccount
protected Optional<PaymentAccount> getPreferredPaymentAccount(String preferredPaymentAccountId, W walletWithAccounts) -
putPreferredAccountFirstInList
protected List<PaymentAccount> putPreferredAccountFirstInList(PaymentAccount preferredPaymentAccount, List<PaymentAccount> activeAccounts) -
isPreferredAccountFirst
protected boolean isPreferredAccountFirst(String preferredPaymentAccountId, List<PaymentAccount> activePaymentAccounts) -
sortWalletPaymentAccounts
protected W sortWalletPaymentAccounts(W walletWithPaymentAccounts, @Nullable PaymentAccount preferredAccount) -
getWalletWithPaymentAccountsByUserId
-
getWalletWithPaymentAccountsByProcessingRequestId
-
mapSavedPaymentMethodsToWalletsWithAccounts
protected List<W> mapSavedPaymentMethodsToWalletsWithAccounts(List<SavedPaymentMethod> savedPaymentMethods) -
buildWalletWithPaymentAccounts
protected W buildWalletWithPaymentAccounts(String userId, List<SavedPaymentMethod> savedPaymentMethods) -
buildWallet
-
getDefaultAccountId
-
getActiveAccountIds
-
mapSavedPaymentMethodToPaymentAccount
protected PaymentAccount mapSavedPaymentMethodToPaymentAccount(SavedPaymentMethod savedPaymentMethod) -
getCardType
-
getNameOnAccount
-
getMaskedAccountNumber
-
getExpirationMonth
-
getExpirationYear
-
buildAddress
-
getPhoneNumber
-
getProvider
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-