Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1812b23
art:证书类配置读取优化调整
Aug 17, 2020
2b27ee9
new:电商收付通二级商户进件
Aug 17, 2020
a3ec261
Merge branch 'develop' into develop
binarywang Aug 18, 2020
cee3753
Merge remote-tracking branch 'wechat/develop' into develop
Aug 24, 2020
10e0ca5
art:微信服务商配置优化
Aug 24, 2020
5db9706
new:jsapi合单支付
Aug 24, 2020
e0d87eb
new:合单支付
Aug 26, 2020
84b9b99
Merge remote-tracking branch 'wechat/develop' into develop
Aug 30, 2020
541899a
Merge remote-tracking branch 'wechat/develop' into develop
Sep 4, 2020
9f60516
Merge remote-tracking branch 'wechat/develop' into develop
Sep 8, 2020
97409a7
new:电商收付通普通支付
Sep 8, 2020
f18c62b
new:电商收付通支付回调处理
Sep 10, 2020
b8d9a15
Merge remote-tracking branch 'wechat/develop' into develop
Sep 10, 2020
c8fc670
new:电商收付通支付回调处理
Sep 10, 2020
4f157b0
Merge remote-tracking branch 'wechat/develop' into develop
Sep 10, 2020
34f0d99
电商收付通支付调整
Sep 11, 2020
c2552de
Merge remote-tracking branch 'wechat/develop' into develop
Sep 11, 2020
3fbeec4
Merge remote-tracking branch 'wechat/develop' into develop
Sep 14, 2020
e56289f
Merge remote-tracking branch 'wechat/develop' into develop
Sep 15, 2020
60c63a5
fix:电商收付通回调通知测试
Sep 17, 2020
5b606fd
Merge remote-tracking branch 'wechat/develop' into develop
Sep 17, 2020
aa2fe98
Merge remote-tracking branch 'wechat/develop' into develop
Sep 20, 2020
9b20c74
new:电商收付通合单支付、普通支付查询
Sep 21, 2020
00bc965
new:电商收付通商户、平台提现
Sep 21, 2020
2037900
fix:命名统一调整
Sep 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new:合单支付
  • Loading branch information
曾浩 committed Aug 26, 2020
commit e0d87ebe49e34a36e0d95a804452d4a223586cd3

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import java.util.List;

/**
* 合单支付 JSAPI支付
* 合单支付 对象
*/
@Data
@NoArgsConstructor
public class CombineTransactionsJsRequest implements Serializable {
public class CombineTransactionsRequest implements Serializable {
/**
* <pre>
* 字段名:合单商户appid
Expand Down Expand Up @@ -85,7 +85,7 @@ public class CombineTransactionsJsRequest implements Serializable {
* <pre>
* 字段名:+支付者
* 变量名:combine_payer_info
* 是否必填:
* 是否必填:否(JSAPI必填)
* 类型:object
* 描述:支付者信息
* </pre>
Expand Down Expand Up @@ -136,25 +136,10 @@ public class CombineTransactionsJsRequest implements Serializable {
@SerializedName(value = "notify_url")
private String notifyUrl;

/**
* <pre>
* 字段名:指定支付方式
* 变量名:limit_pay
* 是否必填:否
* 类型:array
* 描述:
* 指定支付方式
* no_credit:指定不能使用信用卡支付
* 特殊规则:长度最大限制32个字节
* 示例值:no_credit
* </pre>
*/
@SerializedName(value = "limit_pay")
private List<String> limitPay;

@Data
@NoArgsConstructor
public static class SceneInfo implements Serializable{
public static class SceneInfo implements Serializable {
/**
* <pre>
* 字段名:商户端设备号
Expand Down Expand Up @@ -185,11 +170,23 @@ public static class SceneInfo implements Serializable{
@SerializedName(value = "payer_client_ip")
private String payerClientIp;

/**
* <pre>
* 字段名:H5场景信息
* 变量名:h5_info
* 是否必填:否(H5支付必填)
* 类型:object
* 描述:
* H5场景信息
* </pre>
*/
@SerializedName(value = "h5_info")
private H5Info h5Info;
}

@Data
@NoArgsConstructor
public static class SubOrders implements Serializable{
public static class SubOrders implements Serializable {
/**
* <pre>
* 字段名:子单商户号
Expand Down Expand Up @@ -261,34 +258,6 @@ public static class SubOrders implements Serializable{
@SerializedName(value = "sub_mchid")
private String subMchid;

/**
* <pre>
* 字段名:商品详情
* 变量名:detail
* 是否必填:否
* 类型:string(6000)
* 描述:商品详细描述(商品列表)
* </pre>
*/
@SerializedName(value = "detail")
private String detail;

/**
* <pre>
* 字段名:是否指定分账
* 变量名:profit_sharing
* 是否必填:是
* 类型:bool
* 描述:
* 是否指定分账
* true:是
* false:否
* 示例值:true
* </pre>
*/
@SerializedName(value = "profit_sharing")
private Boolean profitSharing;

/**
* <pre>
* 字段名:商品描述
Expand Down Expand Up @@ -319,7 +288,7 @@ public static class SubOrders implements Serializable{

@Data
@NoArgsConstructor
public static class CombinePayerInfo implements Serializable{
public static class CombinePayerInfo implements Serializable {
/**
* <pre>
* 字段名:用户标识
Expand Down Expand Up @@ -404,4 +373,83 @@ public static class SettleInfo implements Serializable{

}

@Data
@NoArgsConstructor
public static class H5Info implements Serializable {

/**
* <pre>
* 字段名:场景类型
* 变量名:type
* 是否必填:是
* 类型:string(32)
* 描述:
* 场景类型,枚举值:
* iOS:IOS移动应用;
* Android:安卓移动应用;
* Wap:WAP网站应用;
* 示例值:iOS
* </pre>
*/
@SerializedName(value = "type")
private String type;

/**
* <pre>
* 字段名:应用名称
* 变量名:app_name
* 是否必填:否
* 类型:string(64)
* 描述:
* 应用名称
* 示例值:王者荣耀
* </pre>
*/
@SerializedName(value = "app_name")
private String appName;

/**
* <pre>
* 字段名:网站URL
* 变量名:app_url
* 是否必填:否
* 类型:string(128)
* 描述:
* 网站URL
* 示例值:https://pay.qq.com
* </pre>
*/
@SerializedName(value = "app_url")
private String appUrl;

/**
* <pre>
* 字段名:iOS平台BundleID
* 变量名:bundle_id
* 是否必填:否
* 类型:string(128)
* 描述:
* iOS平台BundleID
* 示例值:com.tencent.wzryiOS
* </pre>
*/
@SerializedName(value = "bundle_id")
private String bundleId;

/**
* <pre>
* 字段名:Android平台PackageName
* 变量名:package_name
* 是否必填:否
* 类型:string(128)
* 描述:
* Android平台PackageName
* 示例值:com.tencent.tmgp.sgame
* </pre>
*/
@SerializedName(value = "package_name")
private String packageName;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package com.github.binarywang.wxpay.bean.ecommerce;

import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.v3.util.AesUtils;
import com.github.binarywang.wxpay.v3.util.SignUtils;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.security.PrivateKey;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

/**
* 合单支付 JSAPI支付结果响应
*/
@Data
@NoArgsConstructor
public class CombineTransactionsResult implements Serializable {

/**
* <pre>
* 字段名:预支付交易会话标识 (APP支付、JSAPI支付 会返回)
* 变量名:prepay_id
* 是否必填:是
* 类型:string(64)
* 描述:
* 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。
* 示例值:wx201410272009395522657a690389285100
* </pre>
*/
@SerializedName("prepay_id")
private String prepayId;

/**
* <pre>
* 字段名:支付跳转链接 (H5支付 会返回)
* 变量名:h5_url
* 是否必填:是
* 类型:string(512)
* 描述:
* 支付跳转链接
* 示例值:https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx2016121516420242444321ca0631331346&package=1405458241
* </pre>
*/
@SerializedName("h5_url")
private String h5Url;

/**
* <pre>
* 字段名:二维码链接 (NATIVE支付 会返回)
* 变量名:h5_url
* 是否必填:是
* 类型:string(512)
* 描述:
* 二维码链接
* 示例值:weixin://pay.weixin.qq.com/bizpayurl/up?pr=NwY5Mz9&groupid=00
* </pre>
*/
@SerializedName("code_url")
private String codeUrl;

@Data
@Accessors(chain = true)
public static class JsapiResult implements Serializable {
private String appId;
private String timeStamp;
private String nonceStr;
private String packageValue;
private String signType;
private String paySign;

private String getSignStr(){
return String.format("%s\n%s\n%s\n%s\n", appId, timeStamp, nonceStr, packageValue);
}
}

@Data
@Accessors(chain = true)
public static class AppResult implements Serializable {
private String appid;
private String partnerid;
private String prepayid;
private String packageValue;
private String noncestr;
private String timestamp;

}

public <T> T getPayInfo(TradeTypeEnum tradeType, String appId, String mchId, PrivateKey privateKey){
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
String nonceStr = SignUtils.genRandomStr();
switch (tradeType){
case JSAPI:
JsapiResult jsapiResult = new JsapiResult();
jsapiResult.setAppId(appId).setTimeStamp(timestamp)
.setPackageValue("prepay_id=" + this.prepayId).setNonceStr(nonceStr)
//签名类型,默认为RSA,仅支持RSA。
.setSignType("RSA").setPaySign(SignUtils.sign(jsapiResult.getSignStr(), privateKey));
return (T) jsapiResult;
case H5:
return (T) this.h5Url;
case APP:
AppResult appResult = new AppResult();
appResult.setAppid(appId).setPrepayid(this.prepayId).setPartnerid(mchId)
.setNoncestr(nonceStr).setTimestamp(timestamp)
//暂填写固定值Sign=WXPay
.setPackageValue("Sign=WXPay");
return (T) appResult;
case NATIVE:
return (T) this.codeUrl;
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.binarywang.wxpay.bean.ecommerce.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* 支付方式
*/
@Getter
@AllArgsConstructor
public enum TradeTypeEnum {

APP("/v3/combine-transactions/app","/v3/pay/partner/transactions/app"),
JSAPI("/v3/combine-transactions/jsapi","/v3/pay/partner/transactions/jsapi"),
NATIVE("/v3/combine-transactions/native","/v3/pay/partner/transactions/native"),
H5("/v3/combine-transactions/h5","/v3/pay/partner/transactions/h5")
;

/**
* 合单url
*/
private String combineUrl;
/**
* 单独下单url
*/
private String partnerUrl;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.binarywang.wxpay.service;

import com.github.binarywang.wxpay.bean.ecommerce.*;
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.exception.WxPayException;

/**
Expand Down Expand Up @@ -63,5 +64,6 @@ public interface EcommerceService {
* @param request 请求对象
* @return 预支付交易会话标识, 数字和字母。微信生成的预支付会话标识,用于后续接口调用使用。
*/
CombineTransactionsJsResult combineTransactions(CombineTransactionsJsRequest request) throws WxPayException;
<T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;

}
Loading