小程序支持支付宝支付

This commit is contained in:
谭凯凯
2024-09-27 17:26:29 +08:00
committed by Tankaikai
parent b4e5fd6aa3
commit 00e6bb43db
3 changed files with 32 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ public class TbMerchantThirdApply implements Serializable {
private String type;
private String appId;
private String alipayAppId;
private Byte status;
@@ -20,6 +21,7 @@ public class TbMerchantThirdApply implements Serializable {
private Long updatedAt;
private String appToken;
private String alipayAppToken;
private String smallAppid;
@@ -127,4 +129,20 @@ public class TbMerchantThirdApply implements Serializable {
public void setAlipaySmallAppid(String alipaySmallAppid) {
this.alipaySmallAppid = alipaySmallAppid;
}
public String getAlipayAppId() {
return alipayAppId;
}
public void setAlipayAppId(String alipayAppId) {
this.alipayAppId = alipayAppId;
}
public String getAlipayAppToken() {
return alipayAppToken;
}
public void setAlipayAppToken(String alipayAppToken) {
this.alipayAppToken = alipayAppToken;
}
}

View File

@@ -316,12 +316,16 @@ public class PayService {
}
String smallAppid = thirdApply.getSmallAppid();
String appId = thirdApply.getAppId();
String appToken = thirdApply.getAppToken();
if ("aliPay".equals(payType)){
smallAppid = thirdApply.getAlipaySmallAppid();
appId = thirdApply.getAlipayAppId();
appToken = thirdApply.getAlipayAppToken();
}
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl,
thirdApply.getAppId(),
appId,
reqbody,
reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
@@ -333,7 +337,7 @@ public class PayService {
thirdApply.getStoreId(),
callFSTBack,
null,
thirdApply.getAppToken());
appToken);
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();
@@ -660,13 +664,17 @@ public class PayService {
reqbody = body.toString();
}
String smallAppid = thirdApply.getSmallAppid();
String appId = thirdApply.getAppId();
String appToken = thirdApply.getAppToken();
if ("aliPay".equals(payType)){
smallAppid = thirdApply.getAlipaySmallAppid();
appId = thirdApply.getAlipayAppId();
appToken = thirdApply.getAlipayAppToken();
}
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(
thirdUrl,
thirdApply.getAppId(),
appId,
reqbody,
reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
@@ -679,7 +687,7 @@ public class PayService {
thirdApply.getStoreId(),
callBackGroupurl,
null,
thirdApply.getAppToken());
appToken);
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();

View File

@@ -18,10 +18,10 @@
<result column="app_token" jdbcType="LONGVARCHAR" property="appToken" />
</resultMap>
<sql id="Base_Column_List">
id, type, app_id, status, pay_password, applyment_state, created_at, updated_at,small_appid,alipay_small_appid,store_id
id, type, app_id, alipay_app_id, status, pay_password, applyment_state, created_at, updated_at,small_appid,alipay_small_appid,store_id
</sql>
<sql id="Blob_Column_List">
app_token
app_token, alipay_app_token
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
select