Commit d8a2b56d by ping.wu

周周惠

parent 7941f5bf
......@@ -147,7 +147,7 @@
<dependency>
<artifactId>assortment-data-manager</artifactId>
<groupId>com.freemud.sdk.api.assortment</groupId>
<version>5.5.31-RELEASE</version>
<version>5.5.40-RELEASE</version>
</dependency>
<dependency>
<groupId>cn.freemud.commons</groupId>
......
......@@ -16,11 +16,13 @@ public class PaymentConfigVo {
@NotEmpty(message = "商户号不能为空")
private String partnerId;
@ApiModelProperty("门店号")
private String storeId;
/**
* 插件类型 1=爱心餐 2= 周周惠
*/
@ApiModelProperty("插件类型 1=爱心餐 2= 周周惠")
@ApiModelProperty("插件类型 1=爱心餐 2= 周周惠")
private Integer plugInType;
}
......@@ -390,11 +390,11 @@ public class OrderAdapterServiceImpl {
}
//周周惠插件要返回参数
if(paymentConfigVo.getPlugInType() != null && paymentConfigVo.getPlugInType() == 2){
return ResponseUtil.success(payService.getPaymentAuth(paymentConfigVo.getPartnerId(),assortmentCustomerInfoVo.getWxAppId()));
return ResponseUtil.success(payService.getPlugInParameter(paymentConfigVo.getPartnerId(),assortmentCustomerInfoVo.getWxAppId(),paymentConfigVo.getStoreId()));
}
//1元插件要返回参数
return ResponseUtil.success(payService.getPaymentAuth(paymentConfigVo.getPartnerId(),assortmentCustomerInfoVo.getWxAppId()));
return ResponseUtil.success(payService.getPlugInParameter(paymentConfigVo.getPartnerId(),assortmentCustomerInfoVo.getWxAppId()));
}
......
......@@ -36,10 +36,7 @@ import cn.freemud.service.thirdparty.ComPayClient;
import cn.freemud.service.thirdparty.PaymentNewClient;
import cn.freemud.service.thirdparty.SvcAppClient;
import cn.freemud.service.thirdparty.SvcComPayClient;
import cn.freemud.utils.AppLogUtil;
import cn.freemud.utils.RedisUtil;
import cn.freemud.utils.ResponseUtil;
import cn.freemud.utils.ValidationCode;
import cn.freemud.utils.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.db.*;
......@@ -1278,12 +1275,12 @@ public class PayServiceImpl {
/**
* 1元捐插件需要参数
*/
public PlugInParameter getPaymentAuth(String partnerId, String appId) {
public PlugInParameter getPlugInParameter(String partnerId, String appId) {
PlugInParameter plugInParameter = new PlugInParameter();
List<AssortmentOpenPlatformPartnerPaymentConfig> openPlatformPartnerPaymentAuths = openPlatformPartnerPaymentConfigManager.queryPartnerPaymentConfigs(partnerId, appId);
if (CollectionUtils.isNotEmpty(openPlatformPartnerPaymentAuths)) {
plugInParameter.setMchCode(openPlatformPartnerPaymentAuths.get(0).getUnitMchId());
plugInParameter.setSubMchCode(openPlatformPartnerPaymentAuths.get(0).getSubMchid());
List<AssortmentOpenPlatformPartnerPaymentConfig> openPlatformPartnerPaymentConfigs = openPlatformPartnerPaymentConfigManager.queryPartnerPaymentConfigs(partnerId, appId);
if (CollectionUtils.isNotEmpty(openPlatformPartnerPaymentConfigs)) {
plugInParameter.setMchCode(openPlatformPartnerPaymentConfigs.get(0).getUnitMchId());
plugInParameter.setSubMchCode(openPlatformPartnerPaymentConfigs.get(0).getSubMchid());
}
return plugInParameter;
}
......@@ -1291,13 +1288,34 @@ public class PayServiceImpl {
/**
* 周周惠插件需要参数
*/
public PlugInParameter getPaymentAuth2(String partnerId, String appId) {
public PlugInParameter getPlugInParameter(String partnerId, String appId,String storeId) {
PlugInParameter plugInParameter = new PlugInParameter();
List<AssortmentOpenPlatformPartnerPaymentConfig> openPlatformPartnerPaymentAuths = openPlatformPartnerPaymentConfigManager.queryPartnerPaymentConfigs(partnerId, appId);
if (CollectionUtils.isNotEmpty(openPlatformPartnerPaymentAuths)) {
plugInParameter.setMchCode(openPlatformPartnerPaymentAuths.get(0).getUnitMchId());
plugInParameter.setSubMchCode(openPlatformPartnerPaymentAuths.get(0).getSubMchid());
List<AssortmentOpenPlatformPartnerPaymentConfig> openPlatformPartnerPaymentConfigs = openPlatformPartnerPaymentConfigManager.queryPartnerPaymentConfigs(partnerId, appId);
if (CollectionUtils.isEmpty(openPlatformPartnerPaymentConfigs)) {
return plugInParameter;
}
AssortmentOpenPlatformPaymentStore assortmentOpenPlatformPaymentStore = openPlatformPartnerPaymentConfigManager.queryPPlatformPaymentStore(openPlatformPartnerPaymentConfigs.get(0).getId().toString(), storeId);
if (assortmentOpenPlatformPaymentStore == null || assortmentOpenPlatformPaymentStore.getStatus() != 1) {
return plugInParameter;
}
AssortmentOpenPlatformPartnerPaymentAuth assortmentOpenPlatformPartnerPaymentAuth = openPlatformPartnerPaymentConfigManager.queryPartnerPaymentAuth(openPlatformPartnerPaymentConfigs.get(0).getAuthId());
if (assortmentOpenPlatformPartnerPaymentAuth == null) {
return plugInParameter;
}
String applyMchid = assortmentOpenPlatformPartnerPaymentAuth.getSp_mchid();
String signMchid = openPlatformPartnerPaymentConfigs.get(0).getSubMchid();
String thirdStoreId = assortmentOpenPlatformPaymentStore.getThirdStoreId();
plugInParameter.setApplyMchid(applyMchid);
plugInParameter.setSignMchid(signMchid);
plugInParameter.setStoreId(thirdStoreId);
String message = "apply_mchid="+applyMchid+"&sign_mchid="+signMchid+"&store_id="+thirdStoreId;
String sign = HMacSHA256.encrypt(message,assortmentOpenPlatformPartnerPaymentAuth.getPrivate_key());
plugInParameter.setSign(sign);
return plugInParameter;
}
......
......@@ -13,7 +13,7 @@ public class HMacSHA256 {
* @param secret 私钥
* @return 加密后字符串
*/
private static String encrypt(String message, String secret) {
public static String encrypt(String message, String secret) {
String hash = "";
try {
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment