|
|
@@ -1,6 +1,5 @@ |
|
|
|
package cn.com.taiji.ats.manager.ali; |
|
|
|
|
|
|
|
import cn.com.taiji.ats.config.AliConfig; |
|
|
|
import cn.com.taiji.ats.manager.AbstractCommManager; |
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.ali.AtsAliOrderApplyRequest; |
|
|
@@ -20,7 +19,6 @@ import com.alipay.api.response.AlipayTradeCreateResponse; |
|
|
|
import com.alipay.api.response.AlipayTradePagePayResponse; |
|
|
|
import com.alipay.api.response.AlipayTradePrecreateResponse; |
|
|
|
import com.alipay.api.response.AlipayTradeWapPayResponse; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
@@ -35,10 +33,6 @@ import org.springframework.util.StringUtils; |
|
|
|
@Service |
|
|
|
public class AliCreatePayOrderManager extends AbstractCommManager { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AliConfig aliConfig; |
|
|
|
|
|
|
|
|
|
|
|
public AtsAliOrderApplyResponse serviceHandle(AtsAliOrderApplyRequest request) throws ServiceHandleException { |
|
|
|
switch (request.getTradeType()) { |
|
|
|
case NATIVE: |
|
|
@@ -57,9 +51,21 @@ public class AliCreatePayOrderManager extends AbstractCommManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private AlipayConfig alipayConfig(String privateKey, String publicKey, String appId) { |
|
|
|
AlipayConfig alipayConfig = new AlipayConfig(); |
|
|
|
alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do"); |
|
|
|
alipayConfig.setAppId(appId); |
|
|
|
alipayConfig.setPrivateKey(privateKey);//请填写您的应用私钥,例如:MIIEvQIBADANB... |
|
|
|
alipayConfig.setFormat("json"); |
|
|
|
alipayConfig.setAlipayPublicKey(publicKey);//请填写您的支付宝公钥,例如:MIIBIjANBg... |
|
|
|
alipayConfig.setCharset("UTF-8"); |
|
|
|
alipayConfig.setSignType("RSA2"); |
|
|
|
return alipayConfig; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AtsAliOrderApplyResponse nativeOrderApply(AtsAliOrderApplyRequest request) throws ServiceHandleException { |
|
|
|
AlipayConfig alipayConfig = aliConfig.alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
AlipayConfig alipayConfig = alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
// 初始化SDK |
|
|
|
AlipayClient alipayClient = null; |
|
|
|
try { |
|
|
@@ -97,7 +103,7 @@ public class AliCreatePayOrderManager extends AbstractCommManager { |
|
|
|
|
|
|
|
|
|
|
|
private AtsAliOrderApplyResponse pwebOrderApply(AtsAliOrderApplyRequest request) throws ServiceHandleException { |
|
|
|
AlipayConfig alipayConfig = aliConfig.alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
AlipayConfig alipayConfig = alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
// 初始化SDK |
|
|
|
AlipayClient alipayClient = null; |
|
|
|
try { |
|
|
@@ -136,7 +142,7 @@ public class AliCreatePayOrderManager extends AbstractCommManager { |
|
|
|
|
|
|
|
|
|
|
|
private AtsAliOrderApplyResponse jsapiOrderApply(AtsAliOrderApplyRequest request) throws ServiceHandleException { |
|
|
|
AlipayConfig alipayConfig = aliConfig.alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
AlipayConfig alipayConfig = alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
// 初始化SDK |
|
|
|
AlipayClient alipayClient = null; |
|
|
|
try { |
|
|
@@ -183,7 +189,7 @@ public class AliCreatePayOrderManager extends AbstractCommManager { |
|
|
|
} |
|
|
|
|
|
|
|
private AtsAliOrderApplyResponse mwebOrderApply(AtsAliOrderApplyRequest request) throws ServiceHandleException { |
|
|
|
AlipayConfig alipayConfig = aliConfig.alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
AlipayConfig alipayConfig = alipayConfig(request.getPrivateKey(), request.getPublicKey(), request.getAppid()); |
|
|
|
// 初始化SDK |
|
|
|
AlipayClient alipayClient = null; |
|
|
|
try { |