From 84475b1ca1e096dd17887ad082d1ae8139767579 Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Fri, 23 Apr 2021 17:52:36 +0800 Subject: [PATCH] fix cashout --- .../resources/db/migration/V202104130001__for_cash_out.sql | 5 +++++ .../src/main/java/com/iformall/domain/po/WxPayAccount.java | 2 ++ .../pay/service/cashout/wx/WxCashOutAdapterService.java | 4 +++- .../src/main/resources/mapper/WxPayAccountMapper.xml | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mallinkAdmin/src/main/resources/db/migration/V202104130001__for_cash_out.sql b/mallinkAdmin/src/main/resources/db/migration/V202104130001__for_cash_out.sql index f9ce83aa7..73a883eb8 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202104130001__for_cash_out.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202104130001__for_cash_out.sql @@ -41,5 +41,10 @@ ALTER TABLE wx_merchant ADD COLUMN `cash_out_count` INT(3) DEFAULT 0 COMMENT ' ALTER TABLE wx_cash_out ADD COLUMN `phone` VARCHAR(20) NOT NULL COMMENT '提现的手机号' ; ALTER TABLE wx_cash_out ADD COLUMN `wx_b_open_head_img` VARCHAR(1000) COMMENT 'b端微信用户头像' ; +ALTER TABLE `wx_pay_account` +ADD COLUMN `merchant_cert_path` VARCHAR(100) COMMENT '商户自己的证书' AFTER `cert_path`; + +UPDATE wx_pay_account SET merchant_cert_path = CONCAT('/opt/iformall/service/merchant_wx_cert/',tenant_id,"/apiclient_cert.p12"); + diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java index 4bc5e2dac..64b531dca 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPayAccount.java @@ -24,6 +24,8 @@ public class WxPayAccount extends TenantEntity { private String notifyUrl; @io.swagger.annotations.ApiModelProperty(value="证书本地存放位置",name="certPath") private String certPath; + @io.swagger.annotations.ApiModelProperty(value="商户自己的证书",name="merchantCertPath") + private String merchantCertPath; @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") private Integer type; @io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type") diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java index 5e97ebdaa..7d2e45891 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/cashout/wx/WxCashOutAdapterService.java @@ -189,6 +189,8 @@ public class WxCashOutAdapterService implements CashOutAdapterService{ /** * https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2 + * + * 在wx_pay_account里面要设置merchant_cert_path,登陆特约商户的商户后台,账号中心-API安全。 */ @Override public CashOutAdapterResult cashOut(WxAppinfo appInfo, WxPayAccount payAccount, WxCashOut cashOut) { @@ -205,7 +207,7 @@ public class WxCashOutAdapterService implements CashOutAdapterService{ signMap.put("sign", signAgent); String response = null; try { - response = WxPay.transfers(signMap, payAccount.getCertPath(), payAccount.getMchId()); + response = WxPay.transfers(signMap, payAccount.getMerchantCertPath(), payAccount.getSubMchId()); } catch (Exception e) { log.error("零钱支付异常: " + e.getMessage(),e); return new CashOutAdapterResult(false, EnumCashOutStatus.FAIL.getCode(), "微信零钱支付接口调用异常", null); diff --git a/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml b/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml index f60de8d9b..2f13e5f3b 100644 --- a/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxPayAccountMapper.xml @@ -11,6 +11,7 @@ + @@ -25,7 +26,7 @@ - `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`notify_url`,`cert_path`, + `id`,`tenant_id`,`parent_tenant_id`,`mch_id`,`sub_mch_id`,`sub_app_id`,`api_key`,`notify_url`,`cert_path`,`merchant_cert_path`, `type`,`share`,`rate`,`real_rate`, `service_id`,`pay_score_notify_url`,`api_v3_key`,`cert_serial_no`,`private_key_path`,`private_cert_path`