mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
parent
fd58b3f212
commit
04fadf6f71
@ -1,10 +1,12 @@
|
|||||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||||
|
|
||||||
|
import com.github.binarywang.wxpay.v3.SpecEncrypt;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求分账 对象
|
* 请求分账 对象
|
||||||
@ -86,7 +88,8 @@ public class ProfitSharingRequest implements Serializable {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@SerializedName(value = "receivers")
|
@SerializedName(value = "receivers")
|
||||||
private Receiver[] receivers;
|
@SpecEncrypt
|
||||||
|
private List<Receiver> receivers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -186,6 +189,7 @@ public class ProfitSharingRequest implements Serializable {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@SerializedName(value = "receiver_name")
|
@SerializedName(value = "receiver_name")
|
||||||
|
@SpecEncrypt
|
||||||
private String receiverName;
|
private String receiverName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,8 @@ public class EcommerceServiceImpl implements EcommerceService {
|
|||||||
@Override
|
@Override
|
||||||
public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException {
|
public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException {
|
||||||
String url = String.format("%s/v3/ecommerce/profitsharing/orders", this.payService.getPayBaseUrl());
|
String url = String.format("%s/v3/ecommerce/profitsharing/orders", this.payService.getPayBaseUrl());
|
||||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
RsaCryptoUtil.encryptFields(request, this.payService.getConfig().getVerifier().getValidCertificate());
|
||||||
|
String response = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request));
|
||||||
return GSON.fromJson(response, ProfitSharingResult.class);
|
return GSON.fromJson(response, ProfitSharingResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付敏感信息加密
|
* 微信支付敏感信息加密
|
||||||
@ -53,8 +54,18 @@ public class RsaCryptoUtil {
|
|||||||
} else {
|
} else {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Object obj = field.get(encryptObject);
|
Object obj = field.get(encryptObject);
|
||||||
if (obj != null) {
|
if (obj == null) {
|
||||||
encryptField(field.get(encryptObject), certificate);
|
continue;
|
||||||
|
}
|
||||||
|
if (obj instanceof Collection) {
|
||||||
|
Collection collection = (Collection) obj;
|
||||||
|
for (Object o : collection) {
|
||||||
|
if (o != null) {
|
||||||
|
encryptField(o, certificate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
encryptField(obj, certificate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user