mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-21 00:16:13 +08:00
附加参数的使用
This commit is contained in:
@@ -44,20 +44,22 @@ public enum PayType implements BasePayType {
|
||||
*/
|
||||
@Override
|
||||
public PayService getPayService(ApyAccount apyAccount) {
|
||||
AliPayConfigStorage aliPayConfigStorage = new AliPayConfigStorage();
|
||||
aliPayConfigStorage.setPid(apyAccount.getPartner());
|
||||
aliPayConfigStorage.setAppId(apyAccount.getAppid());
|
||||
aliPayConfigStorage.setKeyPublic(apyAccount.getPublicKey());
|
||||
aliPayConfigStorage.setKeyPrivate(apyAccount.getPrivateKey());
|
||||
aliPayConfigStorage.setNotifyUrl(apyAccount.getNotifyUrl());
|
||||
aliPayConfigStorage.setReturnUrl(apyAccount.getReturnUrl());
|
||||
aliPayConfigStorage.setSignType(apyAccount.getSignType());
|
||||
aliPayConfigStorage.setSeller(apyAccount.getSeller());
|
||||
aliPayConfigStorage.setPayType(apyAccount.getPayType().toString());
|
||||
aliPayConfigStorage.setMsgType(apyAccount.getMsgType());
|
||||
aliPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
aliPayConfigStorage.setTest(apyAccount.isTest());
|
||||
return new AliPayService(aliPayConfigStorage);
|
||||
AliPayConfigStorage configStorage = new AliPayConfigStorage();
|
||||
//配置的附加参数的使用
|
||||
configStorage.setAttach(apyAccount.getPayId());
|
||||
configStorage.setPid(apyAccount.getPartner());
|
||||
configStorage.setAppId(apyAccount.getAppid());
|
||||
configStorage.setKeyPublic(apyAccount.getPublicKey());
|
||||
configStorage.setKeyPrivate(apyAccount.getPrivateKey());
|
||||
configStorage.setNotifyUrl(apyAccount.getNotifyUrl());
|
||||
configStorage.setReturnUrl(apyAccount.getReturnUrl());
|
||||
configStorage.setSignType(apyAccount.getSignType());
|
||||
configStorage.setSeller(apyAccount.getSeller());
|
||||
configStorage.setPayType(apyAccount.getPayType().toString());
|
||||
configStorage.setMsgType(apyAccount.getMsgType());
|
||||
configStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
configStorage.setTest(apyAccount.isTest());
|
||||
return new AliPayService(configStorage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PayResponse {
|
||||
//拦截器
|
||||
.interceptor(new AliPayMessageInterceptor())
|
||||
//处理器
|
||||
.handler(autowire(new AliPayMessageHandler(payId)))
|
||||
.handler(spring.getBean(AliPayMessageHandler.class))
|
||||
.end()
|
||||
.rule()
|
||||
.msgType(MsgType.xml.name())
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.egzosn.pay.demo.service.handler;
|
||||
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.api.PayService;
|
||||
import com.egzosn.pay.common.bean.PayMessage;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.bean.outbuilder.TextBuilder;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
@@ -14,16 +16,17 @@ import java.util.Map;
|
||||
* Created by ZaoSheng on 2016/6/1.
|
||||
*
|
||||
*/
|
||||
public class AliPayMessageHandler extends BasePayMessageHandler {
|
||||
@Component
|
||||
public class AliPayMessageHandler implements PayMessageHandler {
|
||||
|
||||
|
||||
|
||||
public AliPayMessageHandler(Integer payId) {
|
||||
super(payId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PayOutMessage handle(PayMessage payMessage, Map<String, Object> context, PayService payService) throws PayErrorException {
|
||||
//com.egzosn.pay.demo.entity.PayType.getPayService()#48
|
||||
Object payId = payService.getPayConfigStorage().getAttach();
|
||||
|
||||
Map<String, Object> message = payMessage.getPayMessage();
|
||||
//交易状态
|
||||
|
||||
Reference in New Issue
Block a user