Class DefaultSapDigitalPaymentService
- java.lang.Object
-
- de.hybris.platform.cissapdigitalpayment.service.impl.DefaultSapDigitalPaymentService
-
- All Implemented Interfaces:
SapDigitalPaymentService
public class DefaultSapDigitalPaymentService extends java.lang.Object implements SapDigitalPaymentService
Default implementation ofSapDigitalPaymentService
-
-
Constructor Summary
Constructors Constructor Description DefaultSapDigitalPaymentService()
-
Method Summary
-
-
-
Method Detail
-
authorize
public PaymentTransactionEntryModel authorize(java.lang.String merchantTransactionCode, java.lang.String paymentProvider, AddressModel deliveryAddress, CisSapDigitalPaymentAuthorizationResult dpAuthResult)
Authorize the payment transaction. If the payment transaction is success from the SAP Digital Payments, a new PaymentTransactionEntryModel object is created, set its transaction type to AUTHORIZATION, populate the transaction and authorization fields.- Specified by:
authorize
in interfaceSapDigitalPaymentService
- Parameters:
merchantTransactionCode
- - merchant transaction codepaymentProvider
- - payment providerdeliveryAddress
- - delivery address captured during the checkoutdpAuthResult
- - SAP Digital payments authorization result- Returns:
- PaymentTransactionEntryModel
-
capture
public PaymentTransactionEntryModel capture(PaymentTransactionModel transaction) throws SapDigitalPaymentCaptureException
Settle the payment authorization. Iterate the payment transaction to find a transaction entry of type AUTHORIZATION, Creates a List, and call the SAP Digital payment client charge api, checks the response status. For successful response, extract the capture transaction details to a new PaymentTransactionEntryModel object with payment transaction type as CAPTURE. - Specified by:
capture
in interfaceSapDigitalPaymentService
- Parameters:
transaction
- - payment transaction associated with the order- Returns:
- PaymentTransactionEntryModel - payment transaction entry object
- Throws:
SapDigitalPaymentCaptureException
-
refund
public PaymentTransactionEntryModel refund(PaymentTransactionModel transaction, java.math.BigDecimal amountToRefund) throws SapDigitalPaymentRefundException
Refund the payment to the same card used for placing the order- Specified by:
refund
in interfaceSapDigitalPaymentService
- Parameters:
transaction
- - payment transaction associated with the return request's order.amountToRefund
- - amount to be refunded- Returns:
- PaymentTransactionEntryModel - payment transaction entry created for the refund request
- Throws:
SapDigitalPaymentRefundException
- - Payment refund exception
-
getCardRegistrationUrl
public java.lang.String getCardRegistrationUrl()
This method will get the card registration URL from the SAP Digital payment- Specified by:
getCardRegistrationUrl
in interfaceSapDigitalPaymentService
- Returns:
- registration URL
-
createPollRegisteredCardProcess
public void createPollRegisteredCardProcess(java.lang.String sessionId)
CreatesSapDigitPayPollCardProcessModel
and triggers the process- Specified by:
createPollRegisteredCardProcess
in interfaceSapDigitalPaymentService
- Parameters:
sessionId
- - sessionId w.r.t registered card
-
createPaymentSubscription
public CreditCardPaymentInfoModel createPaymentSubscription(CCPaymentInfoData paymentInfoData, java.util.Map<java.lang.String,java.lang.Object> params)
Creates a payment subscription and returns theCreditCardPaymentInfoModel
- Specified by:
createPaymentSubscription
in interfaceSapDigitalPaymentService
- Parameters:
paymentInfoData
- - credit card payment info dataparams
- - pass the parameters like cart, user, payment provider etc- Returns:
CreditCardPaymentInfoModel
-
saveCreditCardPaymentDetailsToCart
public boolean saveCreditCardPaymentDetailsToCart(java.lang.String paymentInfoId, java.util.Map<java.lang.String,java.lang.Object> params)
Saves the payment details to the cart.- Specified by:
saveCreditCardPaymentDetailsToCart
in interfaceSapDigitalPaymentService
- Parameters:
paymentInfoId
- - payment info IDparams
- -Map
- Returns:
Boolean
-
saveDeliveryAddressToPaymentInfoData
protected void saveDeliveryAddressToPaymentInfoData(CCPaymentInfoData paymentInfoData, CartModel currentCart)
Saves the delivery address to payment info
-
populateCardInfo
protected CardInfo populateCardInfo(CCPaymentInfoData paymentInfoData)
-
checkIfCurrentUserIsTheCartUser
protected boolean checkIfCurrentUserIsTheCartUser(UserModel currentUser, CartModel currentCart)
-
isAnonymousCheckout
protected boolean isAnonymousCheckout(UserModel currentUser)
-
getTransactionStatus
protected java.lang.String getTransactionStatus(CisSapDigitalPaymentTransactionResult transactionResult)
Retries the transaction status- Parameters:
transactionResult
- -- Returns:
String
-
constructAuthorizationDateTime
protected java.util.Date constructAuthorizationDateTime(java.lang.String authorizationDateTime)
Returns the authorization date and time. In case of errors, return a newDate
-
getSubscriptionId
protected java.lang.String getSubscriptionId(CisSapDigitalPaymentSource source)
Check for the subscription ID from the authorization response. If empty,set an empty string
-
isSapDigitalPaymentTransaction
public boolean isSapDigitalPaymentTransaction(PaymentTransactionModel txn)
Checks if the transaction happened with SAP Digital payment transaction- Specified by:
isSapDigitalPaymentTransaction
in interfaceSapDigitalPaymentService
- Parameters:
txn
- -PaymentTransactionModel
- Returns:
Boolean
-
getCisSapDigitalPaymentService
public CisSapDigitalPaymentService getCisSapDigitalPaymentService()
- Returns:
- the cisSapDigitalPaymentService
-
setCisSapDigitalPaymentService
public void setCisSapDigitalPaymentService(CisSapDigitalPaymentService cisSapDigitalPaymentService)
- Parameters:
cisSapDigitalPaymentService
- the cisSapDigitalPaymentService to set
-
getModelService
public ModelService getModelService()
- Returns:
- the modelService
-
setModelService
public void setModelService(ModelService modelService)
- Parameters:
modelService
- the modelService to set
-
getPaymentService
public PaymentService getPaymentService()
- Returns:
- the paymentService
-
setPaymentService
public void setPaymentService(PaymentService paymentService)
- Parameters:
paymentService
- the paymentService to set
-
getCommonI18NService
public CommonI18NService getCommonI18NService()
- Returns:
- the commonI18NService
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
- Parameters:
commonI18NService
- the commonI18NService to set
-
getPaymentFormActionUrlStrategy
public PaymentFormActionUrlStrategy getPaymentFormActionUrlStrategy()
- Returns:
- the paymentFormActionUrlStrategy
-
setPaymentFormActionUrlStrategy
public void setPaymentFormActionUrlStrategy(PaymentFormActionUrlStrategy paymentFormActionUrlStrategy)
- Parameters:
paymentFormActionUrlStrategy
- the paymentFormActionUrlStrategy to set
-
getBusinessProcessService
public BusinessProcessService getBusinessProcessService()
- Returns:
- the businessProcessService
-
setBusinessProcessService
public void setBusinessProcessService(BusinessProcessService businessProcessService)
- Parameters:
businessProcessService
- the businessProcessService to set
-
getCartService
public CartService getCartService()
- Returns:
- the cartService
-
setCartService
public void setCartService(CartService cartService)
- Parameters:
cartService
- the cartService to set
-
getCommerceCardTypeService
public CommerceCardTypeService getCommerceCardTypeService()
- Returns:
- the commerceCardTypeService
-
setCommerceCardTypeService
public void setCommerceCardTypeService(CommerceCardTypeService commerceCardTypeService)
- Parameters:
commerceCardTypeService
- the commerceCardTypeService to set
-
getCustomerAccountService
public CustomerAccountService getCustomerAccountService()
- Returns:
- the customerAccountService
-
setCustomerAccountService
public void setCustomerAccountService(CustomerAccountService customerAccountService)
- Parameters:
customerAccountService
- the customerAccountService to set
-
getCommerceCheckoutService
public CommerceCheckoutService getCommerceCheckoutService()
- Returns:
- the commerceCheckoutService
-
setCommerceCheckoutService
public void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)
- Parameters:
commerceCheckoutService
- the commerceCheckoutService to set
-
getAddressConverter
public Converter<AddressModel,AddressData> getAddressConverter()
- Returns:
- the addressConverter
-
setAddressConverter
public void setAddressConverter(Converter<AddressModel,AddressData> addressConverter)
- Parameters:
addressConverter
- the addressConverter to set
-
getUserService
public UserService getUserService()
- Returns:
- the userService
-
setUserService
public void setUserService(UserService userService)
- Parameters:
userService
- the userService to set
-
getBaseStoreService
public BaseStoreService getBaseStoreService()
- Returns:
- the baseStoreService
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
- Parameters:
baseStoreService
- the baseStoreService to set
-
getCalculationService
public CalculationService getCalculationService()
- Returns:
- the calculationService
-
setCalculationService
public void setCalculationService(CalculationService calculationService)
- Parameters:
calculationService
- the calculationService to set
-
getSapDigiPayAuthTranResult
public java.util.Map<java.lang.String,java.lang.String> getSapDigiPayAuthTranResult()
- Returns:
- the sapDigiPayAuthTranResult
-
getSapDigitalPaymentConfigurationStrategy
public SapDigitalPaymentConfigurationStrategy getSapDigitalPaymentConfigurationStrategy()
- Returns:
- the sapDigitalPaymentConfigurationStrategy
-
setSapDigitalPaymentConfigurationStrategy
public void setSapDigitalPaymentConfigurationStrategy(SapDigitalPaymentConfigurationStrategy sapDigitalPaymentConfigurationStrategy)
- Parameters:
sapDigitalPaymentConfigurationStrategy
- the sapDigitalPaymentConfigurationStrategy to set
-
setSapDigiPayAuthTranResult
public void setSapDigiPayAuthTranResult(java.util.Map<java.lang.String,java.lang.String> sapDigiPayAuthTranResult)
- Parameters:
sapDigiPayAuthTranResult
- the sapDigiPayAuthTranResult to set
-
-