Class DefaultAlipayPaymentService
- java.lang.Object
-
- de.hybris.platform.payment.impl.DefaultPaymentServiceImpl
-
- de.hybris.platform.chinesepspalipayservices.payment.DefaultAlipayPaymentService
-
- All Implemented Interfaces:
ChinesePaymentService,PaymentService
public class DefaultAlipayPaymentService extends DefaultPaymentServiceImpl implements ChinesePaymentService
Default implementation ofChinesePaymentService
-
-
Constructor Summary
Constructors Constructor Description DefaultAlipayPaymentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildString(java.lang.StringBuilder builder, java.lang.String s)booleancancelPayment(java.lang.String orderCode)Canceling the payment with the 3rd part payment service provider serverprotected java.util.Map<java.lang.String,java.lang.String>convertKey2CamelCase(java.util.Map<java.lang.String,java.lang.String> snakeCaseMap)protected AlipayCancelPaymentRequestDatacreateAlipayCancelPaymentRequestDataByOrder(OrderModel order)protected AlipayDirectPayRequestDatacreateAlipayDirectPayRequestDataByOrder(OrderModel order)protected AlipayPaymentStatusRequestDatacreateAlipayPaymentStatusRequestDataByOrder(OrderModel order)protected java.util.Optional<AlipayRefundRequestData>createAlipayRefundRequestDataByOrder(OrderModel order)protected AlipayConfigurationgetAlipayConfiguration()protected AlipayCreateRequestStrategygetAlipayCreateRequestStrategy()protected AlipayHandleResponseStrategygetAlipayHandleResponseStrategy()protected AlipayOrderServicegetAlipayOrderService()protected AlipayPaymentInfoStrategygetAlipayPaymentInfoStrategy()protected AlipayPaymentTransactionStrategygetAlipayPaymentTransactionStrategy()protected AlipayResponseValidationStrategygetAlipayResponseValidationStrategy()protected BaseSiteServicegetBaseSiteService()protected ChineseOrderServicegetChineseOrderService()protected CMSSiteServicegetCmsSiteService()protected CommerceCheckoutServicegetCommerceCheckoutService()protected CommerceCommonI18NServicegetCommerceCommonI18NService()protected MediaServicegetMediaService()protected ModelServicegetModelService()protected OrderModelgetOrderModelByCode(java.lang.String orderCode)retrieve OrderModel by order codejava.lang.StringgetPaymentRequestUrl(java.lang.String orderCode)Getting the PaymentRequestUrl to be send to the 3rd part payment service provider serverjava.lang.StringgetPspLogoUrl()Getting the Logo of the 3rd part payment service providersjava.util.Optional<java.lang.String>getRefundRequestUrl(java.lang.String orderCode)Getting the RefundRequestUrl to be send to the 3rd part payment service provider serverprotected SiteBaseUrlResolutionServicegetSiteBaseUrlResolutionService()protected java.lang.StringgetUrlEncodePattern()java.lang.StringhandleAsyncResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handling the Asyn-response of the 3rd part payment service provider serverprotected voidhandleErrorResponse(java.util.Map<java.lang.String,java.lang.String> responseMap)protected java.lang.StringhandleNotification(java.util.Map<java.lang.String,java.lang.String> responseMap, javax.servlet.http.HttpServletResponse response)protected voidhandleRefundNotification(java.util.Map<java.lang.String,java.lang.String> responseMap, javax.servlet.http.HttpServletResponse response)protected java.lang.StringhandleReturnInfo(java.util.Map<java.lang.String,java.lang.String> responseMap)java.lang.StringhandleSyncResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handling the Sync-response of the 3rd part payment service provider serverprotected booleanisOrderNonRefundable(OrderModel order)voidsetAlipayConfiguration(AlipayConfiguration alipayConfiguration)voidsetAlipayCreateRequestStrategy(AlipayCreateRequestStrategy alipayCreateRequestStrategy)voidsetAlipayHandleResponseStrategy(AlipayHandleResponseStrategy alipayHandleResponseStrategy)voidsetAlipayOrderService(AlipayOrderService alipayOrderService)voidsetAlipayPaymentInfoStrategy(AlipayPaymentInfoStrategy alipayPaymentInfoStrategy)voidsetAlipayPaymentTransactionStrategy(AlipayPaymentTransactionStrategy alipayPaymentTransactionStrategy)voidsetAlipayResponseValidationStrategy(AlipayResponseValidationStrategy alipayResponseValidationStrategy)voidsetBaseSiteService(BaseSiteService baseSiteService)voidsetChineseOrderService(ChineseOrderService chineseOrderService)voidsetCmsSiteService(CMSSiteService cmsSiteService)voidsetCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)voidsetCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)voidsetMediaService(MediaService mediaService)voidsetModelService(ModelService modelService)booleansetPaymentInfo(CartModel cartModel, ChinesePaymentInfoModel chinesePaymentInfoModel)Saving the PaymentInfovoidsetSiteBaseUrlResolutionService(SiteBaseUrlResolutionService siteBaseUrlResolutionService)voidsyncPaymentStatus(java.lang.String orderCode)Synchronizing the PaymentStatus with the 3rd part payment service provider serverprotected java.util.Map<java.lang.String,java.lang.String>unifyRequestParameterValue(java.util.Map<java.lang.String,java.lang.String[]> params)-
Methods inherited from class de.hybris.platform.payment.impl.DefaultPaymentServiceImpl
attachPaymentInfo, authorize, authorize, authorize, authorize, authorize, authorize, authorizeInternal, cancel, capture, createBillingInfo, createBillingInfo, createSubscription, createSubscription, deleteSubscription, getCardPaymentService, getCommonI18NService, getFlexibleSearchService, getNewPaymentTransactionEntryCode, getPaymentInfoCreator, getPaymentTransaction, getPaymentTransactionEntry, getSubscriptionData, getTransactionCodeGenerator, partialCapture, refundFollowOn, refundStandalone, refundStandalone, setCardPaymentService, setCommonI18NService, setFlexibleSearchService, setPaymentInfoCreator, setTransactionCodeGenerator, updateSubscription
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.chinesepaymentservices.payment.ChinesePaymentService
updatePaymentInfoForPlaceOrder
-
Methods inherited from interface de.hybris.platform.payment.PaymentService
attachPaymentInfo, authorize, authorize, authorize, authorize, authorize, authorize, cancel, capture, createSubscription, createSubscription, deleteSubscription, getNewPaymentTransactionEntryCode, getPaymentTransaction, getPaymentTransactionEntry, getSubscriptionData, partialCapture, refundFollowOn, refundStandalone, refundStandalone, updateSubscription
-
-
-
-
Method Detail
-
handleAsyncResponse
public java.lang.String handleAsyncResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Description copied from interface:ChinesePaymentServiceHandling the Asyn-response of the 3rd part payment service provider server- Specified by:
handleAsyncResponsein interfaceChinesePaymentService- Parameters:
request- The HttpServletRequestresponse- The HttpServletResponse- Returns:
- the code of the order
-
handleSyncResponse
public java.lang.String handleSyncResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Description copied from interface:ChinesePaymentServiceHandling the Sync-response of the 3rd part payment service provider server- Specified by:
handleSyncResponsein interfaceChinesePaymentService- Parameters:
request- The HttpServletRequestresponse- The HttpServletResponse- Returns:
- the code of the order
-
cancelPayment
public boolean cancelPayment(java.lang.String orderCode)
Description copied from interface:ChinesePaymentServiceCanceling the payment with the 3rd part payment service provider server- Specified by:
cancelPaymentin interfaceChinesePaymentService- Parameters:
orderCode- The code of the order- Returns:
- true when canceling payment is successful
-
getPaymentRequestUrl
public java.lang.String getPaymentRequestUrl(java.lang.String orderCode)
Description copied from interface:ChinesePaymentServiceGetting the PaymentRequestUrl to be send to the 3rd part payment service provider server- Specified by:
getPaymentRequestUrlin interfaceChinesePaymentService- Parameters:
orderCode- The code of the order- Returns:
- the payment request Url of the 3rd part payment service provider
-
getRefundRequestUrl
public java.util.Optional<java.lang.String> getRefundRequestUrl(java.lang.String orderCode)
Description copied from interface:ChinesePaymentServiceGetting the RefundRequestUrl to be send to the 3rd part payment service provider server- Specified by:
getRefundRequestUrlin interfaceChinesePaymentService- Parameters:
orderCode- The code of the order- Returns:
- the refund request Url of the 3rd part payment service provider if order can be refunded, otherwise return an empty Optional
-
isOrderNonRefundable
protected boolean isOrderNonRefundable(OrderModel order)
-
syncPaymentStatus
public void syncPaymentStatus(java.lang.String orderCode)
Description copied from interface:ChinesePaymentServiceSynchronizing the PaymentStatus with the 3rd part payment service provider server- Specified by:
syncPaymentStatusin interfaceChinesePaymentService- Parameters:
orderCode- The code of the order
-
setPaymentInfo
public boolean setPaymentInfo(CartModel cartModel, ChinesePaymentInfoModel chinesePaymentInfoModel)
Description copied from interface:ChinesePaymentServiceSaving the PaymentInfo- Specified by:
setPaymentInfoin interfaceChinesePaymentService- Parameters:
cartModel- The current cartchinesePaymentInfoModel- The ChinesePaymentInfo of the cart- Returns:
- true when setting PaymentInfo is successful
-
getPspLogoUrl
public java.lang.String getPspLogoUrl()
Description copied from interface:ChinesePaymentServiceGetting the Logo of the 3rd part payment service providers- Specified by:
getPspLogoUrlin interfaceChinesePaymentService- Returns:
- the url of the payment service provider logo
-
getOrderModelByCode
protected OrderModel getOrderModelByCode(java.lang.String orderCode)
retrieve OrderModel by order code- Parameters:
orderCode- order code of OrderModel- Returns:
- OrderModel
-
unifyRequestParameterValue
protected java.util.Map<java.lang.String,java.lang.String> unifyRequestParameterValue(java.util.Map<java.lang.String,java.lang.String[]> params)
-
buildString
protected void buildString(java.lang.StringBuilder builder, java.lang.String s)
-
convertKey2CamelCase
protected java.util.Map<java.lang.String,java.lang.String> convertKey2CamelCase(java.util.Map<java.lang.String,java.lang.String> snakeCaseMap)
-
handleNotification
protected java.lang.String handleNotification(java.util.Map<java.lang.String,java.lang.String> responseMap, javax.servlet.http.HttpServletResponse response) throws java.io.IOException- Throws:
java.io.IOException
-
handleReturnInfo
protected java.lang.String handleReturnInfo(java.util.Map<java.lang.String,java.lang.String> responseMap)
-
handleErrorResponse
protected void handleErrorResponse(java.util.Map<java.lang.String,java.lang.String> responseMap)
-
createAlipayDirectPayRequestDataByOrder
protected AlipayDirectPayRequestData createAlipayDirectPayRequestDataByOrder(OrderModel order)
-
createAlipayCancelPaymentRequestDataByOrder
protected AlipayCancelPaymentRequestData createAlipayCancelPaymentRequestDataByOrder(OrderModel order)
-
createAlipayPaymentStatusRequestDataByOrder
protected AlipayPaymentStatusRequestData createAlipayPaymentStatusRequestDataByOrder(OrderModel order)
-
createAlipayRefundRequestDataByOrder
protected java.util.Optional<AlipayRefundRequestData> createAlipayRefundRequestDataByOrder(OrderModel order)
-
handleRefundNotification
protected void handleRefundNotification(java.util.Map<java.lang.String,java.lang.String> responseMap, javax.servlet.http.HttpServletResponse response) throws java.io.IOException- Throws:
java.io.IOException
-
getUrlEncodePattern
protected java.lang.String getUrlEncodePattern()
-
setAlipayPaymentInfoStrategy
public void setAlipayPaymentInfoStrategy(AlipayPaymentInfoStrategy alipayPaymentInfoStrategy)
-
setCommerceCheckoutService
public void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)
-
setMediaService
public void setMediaService(MediaService mediaService)
-
setAlipayOrderService
public void setAlipayOrderService(AlipayOrderService alipayOrderService)
-
setAlipayCreateRequestStrategy
public void setAlipayCreateRequestStrategy(AlipayCreateRequestStrategy alipayCreateRequestStrategy)
-
setAlipayPaymentTransactionStrategy
public void setAlipayPaymentTransactionStrategy(AlipayPaymentTransactionStrategy alipayPaymentTransactionStrategy)
-
setAlipayResponseValidationStrategy
public void setAlipayResponseValidationStrategy(AlipayResponseValidationStrategy alipayResponseValidationStrategy)
-
setAlipayHandleResponseStrategy
public void setAlipayHandleResponseStrategy(AlipayHandleResponseStrategy alipayHandleResponseStrategy)
-
setChineseOrderService
public void setChineseOrderService(ChineseOrderService chineseOrderService)
-
setAlipayConfiguration
public void setAlipayConfiguration(AlipayConfiguration alipayConfiguration)
-
setModelService
public void setModelService(ModelService modelService)
- Overrides:
setModelServicein classDefaultPaymentServiceImpl
-
setCmsSiteService
public void setCmsSiteService(CMSSiteService cmsSiteService)
-
setCommerceCommonI18NService
public void setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)
-
getAlipayPaymentInfoStrategy
protected AlipayPaymentInfoStrategy getAlipayPaymentInfoStrategy()
-
getCommerceCheckoutService
protected CommerceCheckoutService getCommerceCheckoutService()
-
getAlipayOrderService
protected AlipayOrderService getAlipayOrderService()
-
getAlipayCreateRequestStrategy
protected AlipayCreateRequestStrategy getAlipayCreateRequestStrategy()
-
getAlipayPaymentTransactionStrategy
protected AlipayPaymentTransactionStrategy getAlipayPaymentTransactionStrategy()
-
getAlipayResponseValidationStrategy
protected AlipayResponseValidationStrategy getAlipayResponseValidationStrategy()
-
getAlipayHandleResponseStrategy
protected AlipayHandleResponseStrategy getAlipayHandleResponseStrategy()
-
getMediaService
protected MediaService getMediaService()
-
getChineseOrderService
protected ChineseOrderService getChineseOrderService()
-
getAlipayConfiguration
protected AlipayConfiguration getAlipayConfiguration()
-
getModelService
protected ModelService getModelService()
- Overrides:
getModelServicein classDefaultPaymentServiceImpl
-
getCmsSiteService
protected CMSSiteService getCmsSiteService()
-
getCommerceCommonI18NService
protected CommerceCommonI18NService getCommerceCommonI18NService()
-
getBaseSiteService
protected BaseSiteService getBaseSiteService()
-
setBaseSiteService
public void setBaseSiteService(BaseSiteService baseSiteService)
-
getSiteBaseUrlResolutionService
protected SiteBaseUrlResolutionService getSiteBaseUrlResolutionService()
-
setSiteBaseUrlResolutionService
public void setSiteBaseUrlResolutionService(SiteBaseUrlResolutionService siteBaseUrlResolutionService)
-
-