wechat pay score callback

This commit is contained in:
dax
2020-12-16 19:26:34 +08:00
parent a3b595a8dd
commit c35df5a65a
12 changed files with 827 additions and 35 deletions

View File

@@ -44,4 +44,4 @@
## **免责声明** ## **免责声明**
**<span style="color:red;">本项目涉及到资金交易,开发者需要经严格测试后方能用于生产环境,本项目不对使用者的行为负责。</span>** **<span style="color:red;">本项目涉及到资金交易开发,开发者需要经严格测试后方能用于生产环境,本项目不对使用者的行为负责。</span>**

View File

@@ -10,6 +10,9 @@ import org.springframework.http.HttpMethod;
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
public enum WechatPayV3Type { public enum WechatPayV3Type {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 获取证书. * 获取证书.
* *
@@ -24,6 +27,8 @@ public enum WechatPayV3Type {
*/ */
FILE_DOWNLOAD(HttpMethod.GET, "%s/v3/billdownload/file"), FILE_DOWNLOAD(HttpMethod.GET, "%s/v3/billdownload/file"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 微信公众号支付或者小程序支付. * 微信公众号支付或者小程序支付.
* *
@@ -70,6 +75,8 @@ public enum WechatPayV3Type {
*/ */
TRANSACTION_OUT_TRADE_NO(HttpMethod.GET, "%s/v3/pay/transactions/out-trade-no/{out_trade_no}"), TRANSACTION_OUT_TRADE_NO(HttpMethod.GET, "%s/v3/pay/transactions/out-trade-no/{out_trade_no}"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 合单下单-APP支付API. * 合单下单-APP支付API.
* *
@@ -109,24 +116,32 @@ public enum WechatPayV3Type {
*/ */
COMBINE_CLOSE(HttpMethod.POST, "%s/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"), COMBINE_CLOSE(HttpMethod.POST, "%s/v3/combine-transactions/out-trade-no/{combine_out_trade_no}/close"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 商户预授权API. * 商户预授权API.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAY_SCORE_PERMISSIONS(HttpMethod.POST, "%s/v3/payscore/permissions"), PAY_SCORE_PERMISSIONS(HttpMethod.POST, "%s/v3/payscore/permissions"),
/**
* 创单结单合并API.
*
* @since 1.0.2.RELEASE
*/
PAY_SCORE_DIRECT_COMPLETE(HttpMethod.POST, "%s/payscore/serviceorder/direct-complete"),
/** /**
* 查询与用户授权记录授权协议号API. * 查询与用户授权记录授权协议号API.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAY_SCORE_QUEERY_PERMISSIONS_AUTHORIZATION_CODE(HttpMethod.GET, "%s/v3/payscore/permissions/authorization-code/{authorization_code}"), PAY_SCORE_PERMISSIONS_AUTH_CODE(HttpMethod.GET, "%s/v3/payscore/permissions/authorization-code/{authorization_code}"),
/** /**
* 解除用户授权关系授权协议号API. * 解除用户授权关系授权协议号API.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAY_SCORE_TERMINATE_PERMISSIONS_AUTHORIZATION_CODE(HttpMethod.POST, "%s/v3/payscore/permissions/authorization-code/{authorization_code}/terminate"), PAY_SCORE_TERMINATE_PERMISSIONS_AUTH_CODE(HttpMethod.POST, "%s/v3/payscore/permissions/authorization-code/{authorization_code}/terminate"),
/** /**
* 查询与用户授权记录openidAPI. * 查询与用户授权记录openidAPI.
* *
@@ -145,8 +160,6 @@ public enum WechatPayV3Type {
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAY_SCORE_USER_SERVICE_STATE(HttpMethod.GET, "%s/v3/payscore/user-service-state?service_id={service_id}&appid={appid}&openid={openid}"), PAY_SCORE_USER_SERVICE_STATE(HttpMethod.GET, "%s/v3/payscore/user-service-state?service_id={service_id}&appid={appid}&openid={openid}"),
/** /**
* 创建支付分订单API * 创建支付分订单API
* *
@@ -190,6 +203,7 @@ public enum WechatPayV3Type {
*/ */
PAY_SCORE_SYNC_USER_SERVICE_ORDER(HttpMethod.POST, "%s/v3/payscore/serviceorder/{out_order_no}/sync"), PAY_SCORE_SYNC_USER_SERVICE_ORDER(HttpMethod.POST, "%s/v3/payscore/serviceorder/{out_order_no}/sync"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 创建代金券批次API. * 创建代金券批次API.

View File

@@ -2,7 +2,10 @@ package cn.felord.payment.wechat.v3;
import cn.felord.payment.PayException; import cn.felord.payment.PayException;
import cn.felord.payment.wechat.v3.model.*; import cn.felord.payment.wechat.v3.model.*;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@@ -19,7 +22,7 @@ import java.util.function.Consumer;
* 微信支付回调工具. * 微信支付回调工具.
* <p> * <p>
* 支付通知http应答码为200或204才会当作正常接收当回调处理异常时应答的HTTP状态码应为500或者4xx。 * 支付通知http应答码为200或204才会当作正常接收当回调处理异常时应答的HTTP状态码应为500或者4xx。
* TODO 微信支付分有三个回调通知 *
* @author felord.cn * @author felord.cn
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
@@ -60,14 +63,15 @@ public class WechatPayCallback {
* 微信支付代金券核销回调. * 微信支付代金券核销回调.
* *
* @param params the params * @param params the params
* @param couponConsumeDataConsumer the coupon consume data consumer * @param consumeDataConsumer the consume data consumer
* @return the map * @return the map
* @since 1.0.0.RELEASE
*/ */
@SneakyThrows @SneakyThrows
public Map<String, ?> couponCallback(ResponseSignVerifyParams params, Consumer<CouponConsumeData> couponConsumeDataConsumer) { public Map<String, ?> couponCallback(ResponseSignVerifyParams params, Consumer<CouponConsumeData> consumeDataConsumer) {
String data = callback(params, EventType.COUPON); String data = this.callback(params, EventType.COUPON);
CouponConsumeData couponConsumeData = MAPPER.readValue(data, CouponConsumeData.class); CouponConsumeData couponConsumeData = MAPPER.readValue(data, CouponConsumeData.class);
couponConsumeDataConsumer.accept(couponConsumeData); consumeDataConsumer.accept(couponConsumeData);
Map<String, Object> responseBody = new HashMap<>(); Map<String, Object> responseBody = new HashMap<>();
responseBody.put("code", 200); responseBody.put("code", 200);
responseBody.put("message", "SUCCESS"); responseBody.put("message", "SUCCESS");
@@ -81,14 +85,15 @@ public class WechatPayCallback {
* 无需开发者判断,只有扣款成功微信才会回调此接口 * 无需开发者判断,只有扣款成功微信才会回调此接口
* *
* @param params the params * @param params the params
* @param transactionConsumeDataConsumer the transaction consume data consumer * @param consumeDataConsumer the consume data consumer
* @return the map * @return the map
* @since 1.0.0.RELEASE
*/ */
@SneakyThrows @SneakyThrows
public Map<String, ?> transactionCallback(ResponseSignVerifyParams params, Consumer<TransactionConsumeData> transactionConsumeDataConsumer) { public Map<String, ?> transactionCallback(ResponseSignVerifyParams params, Consumer<TransactionConsumeData> consumeDataConsumer) {
String data = callback(params, EventType.TRANSACTION); String data = this.callback(params, EventType.TRANSACTION);
TransactionConsumeData transactionConsumeData = MAPPER.readValue(data, TransactionConsumeData.class); TransactionConsumeData transactionConsumeData = MAPPER.readValue(data, TransactionConsumeData.class);
transactionConsumeDataConsumer.accept(transactionConsumeData); consumeDataConsumer.accept(transactionConsumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
@@ -99,20 +104,73 @@ public class WechatPayCallback {
* 无需开发者判断,只有扣款成功微信才会回调此接口 * 无需开发者判断,只有扣款成功微信才会回调此接口
* *
* @param params the params * @param params the params
* @param combineTransactionConsumeDataConsumer the combine transaction consume data consumer * @param consumeDataConsumer the consume data consumer
* @return the map * @return the map
* @since 1.0.0.RELEASE
*/ */
@SneakyThrows @SneakyThrows
public Map<String, ?> combineTransactionCallback(ResponseSignVerifyParams params, Consumer<CombineTransactionConsumeData> combineTransactionConsumeDataConsumer) { public Map<String, ?> combineTransactionCallback(ResponseSignVerifyParams params, Consumer<CombineTransactionConsumeData> consumeDataConsumer) {
String data = callback(params, EventType.TRANSACTION); String data = this.callback(params, EventType.TRANSACTION);
CombineTransactionConsumeData combineTransactionConsumeData = MAPPER.readValue(data, CombineTransactionConsumeData.class); CombineTransactionConsumeData combineTransactionConsumeData = MAPPER.readValue(data, CombineTransactionConsumeData.class);
combineTransactionConsumeDataConsumer.accept(combineTransactionConsumeData); consumeDataConsumer.accept(combineTransactionConsumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
/** /**
* Callback string. * 微信支付分确认订单回调通知.
* <p>
* 该链接是通过商户[创建支付分订单]提交notify_url参数必须为https协议。如果链接无法访问商户将无法接收到微信通知。 通知url必须为直接可访问的url不能携带参数。示例 “https://pay.weixin.qq.com/wxpay/pay.action”
*
* @param params the params
* @param consumeDataConsumer the consume data consumer
* @return the map
* @since 1.0.2.RELEASE
*/
@SneakyThrows
public Map<String, ?> payscoreUserConfirmCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserConfirmConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.PAYSCORE_USER_CONFIRM);
PayScoreUserConfirmConsumeData payScoreUserConfirmConsumeData = MAPPER.readValue(data, PayScoreUserConfirmConsumeData.class);
consumeDataConsumer.accept(payScoreUserConfirmConsumeData);
return Collections.singletonMap("code", "SUCCESS");
}
/**
* 微信支付分支付成功回调通知API.
* <p>
* 请求URL该链接是通过商户[创建支付分订单]提交notify_url参数必须为https协议。如果链接无法访问商户将无法接收到微信通知。 通知url必须为直接可访问的url不能携带参数。示例 “https://pay.weixin.qq.com/wxpay/pay.action”
*
* @param params the params
* @param consumeDataConsumer the consume data consumer
* @return the map
* @since 1.0.2.RELEASE
*/
@SneakyThrows
public Map<String, ?> payscoreUserPaidCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserPaidConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.PAYSCORE_USER_PAID);
PayScoreUserPaidConsumeData payScoreUserPaidConsumeData = MAPPER.readValue(data, PayScoreUserPaidConsumeData.class);
consumeDataConsumer.accept(payScoreUserPaidConsumeData);
return Collections.singletonMap("code", "SUCCESS");
}
/**
* Permission callback map.
*
* @param params the params
* @param consumeDataConsumer the consume data consumer
* @return the map
*/
@SneakyThrows
public Map<String, ?> permissionCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserPaidConsumeData> consumeDataConsumer) {
return Collections.singletonMap("code", "SUCCESS");
}
/**
* Callback.
* *
* @param params the params * @param params the params
* @param eventType the event type * @param eventType the event type
@@ -120,13 +178,38 @@ public class WechatPayCallback {
*/ */
@SneakyThrows @SneakyThrows
private String callback(ResponseSignVerifyParams params, EventType eventType) { private String callback(ResponseSignVerifyParams params, EventType eventType) {
if (signatureProvider.responseSignVerify(params)) { CallbackParams callbackParams = resolve(params);
CallbackParams callbackParams = MAPPER.readValue(params.getBody(), CallbackParams.class);
if (!Objects.equals(callbackParams.getEventType(), eventType.event)) { if (!Objects.equals(callbackParams.getEventType(), eventType.event)) {
log.error("wechat pay event type is not matched, callbackParams {}", callbackParams); log.error("wechat pay event type is not matched, callbackParams {}", callbackParams);
throw new PayException(" wechat pay event type is not matched"); throw new PayException(" wechat pay event type is not matched");
} }
return decrypt(callbackParams);
}
/**
* Resolve callback params.
*
* @param params the params
* @return the callback params
* @throws JsonProcessingException the json processing exception
* @since 1.0.2.RELEASE
*/
private CallbackParams resolve(ResponseSignVerifyParams params) throws JsonProcessingException {
if (signatureProvider.responseSignVerify(params)) {
return MAPPER.readValue(params.getBody(), CallbackParams.class);
}
throw new PayException("invalid wechat pay callback");
}
/**
* Decrypt.
*
* @param callbackParams the callback params
* @return the string
* @since 1.0.2.RELEASE
*/
private String decrypt(CallbackParams callbackParams) {
CallbackParams.Resource resource = callbackParams.getResource(); CallbackParams.Resource resource = callbackParams.getResource();
String associatedData = resource.getAssociatedData(); String associatedData = resource.getAssociatedData();
String nonce = resource.getNonce(); String nonce = resource.getNonce();
@@ -135,8 +218,7 @@ public class WechatPayCallback {
Assert.hasText(data, "decryptData is required"); Assert.hasText(data, "decryptData is required");
return data; return data;
} }
throw new PayException("invalid wechat pay callback");
}
/** /**
* 事件类型用于处理回调. * 事件类型用于处理回调.
@@ -145,12 +227,41 @@ public class WechatPayCallback {
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
enum EventType { enum EventType {
/**
* 微信支付分确认订单事件.
*
* @since 1.0.2.RELEASE
*/
PAYSCORE_USER_CONFIRM("PAYSCORE.USER_CONFIRM"),
/**
* 微信支付分用户支付成功订单事件.
*
* @since 1.0.2.RELEASE
*/
PAYSCORE_USER_PAID("PAYSCORE.USER_PAID"),
/**
* 微信支付分授权事件.
*
* @since 1.0.2.RELEASE
*/
PAYSCORE_USER_OPEN("PAYSCORE.USER_CLOSE_SERVICE"),
/**
* 微信支付分解除授权事件.
*
* @since 1.0.2.RELEASE
*/
PAYSCORE_USER_CLOSE("PAYSCORE.USER_CLOSE_SERVICE"),
/** /**
* 优惠券核销事件. * 优惠券核销事件.
*
* @since 1.0.0.RELEASE
*/ */
COUPON("COUPON.USE"), COUPON("COUPON.USE"),
/** /**
* 支付成功事件. * 支付成功事件.
*
* @since 1.0.0.RELEASE
*/ */
TRANSACTION("TRANSACTION.SUCCESS"); TRANSACTION("TRANSACTION.SUCCESS");

View File

@@ -284,4 +284,168 @@ public class WechatPayScoreApi extends AbstractApi {
.request(); .request();
return wechatResponseEntity; return wechatResponseEntity;
} }
/**
* 创单结单合并API
* <p>
* 相对需确认模式免确认模式减少了用户确认授权这步操作因此在免确认模式下商户无法获取用户的授权状态为了解决商户的困扰我们为免确认模式特别提供了查询授权状态和调起授权页面的api接口这些接口仅在免确认模式下需要调用且必须调用。
* <p>
* <p>
* 该接口适用于无需微信支付分做订单风控判断的业务场景,在服务完成后,通过该接口对用户进行免密代扣。
* <p>
* 注意:
* • 限制条件:【免确认订单模式】,用户已授权状态下,可调用该接口。
* <p>
* <p>
* 特别提醒:创单结单合并接口暂未对外开放,如有需要请咨询对接的微信支付运营人员,申请开通调用权限。
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> directCompleteServiceOrder(DirectCompleteServiceOrderParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_DIRECT_COMPLETE, params)
.function((wechatPayV3Type, orderParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.toUri();
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
orderParams.setAppid(v3.getAppId());
String notifyUrl = orderParams.getNotifyUrl();
if (StringUtils.hasText(notifyUrl)) {
orderParams.setNotifyUrl(v3.getDomain().concat(notifyUrl));
}
return Post(uri, orderParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 商户预授权API
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> permissions(ServiceOrderPermissionParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_PERMISSIONS, params)
.function((wechatPayV3Type, orderParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.toUri();
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
String notifyUrl = orderParams.getNotifyUrl();
orderParams.setAppid(v3.getAppId());
if (StringUtils.hasText(notifyUrl)) {
orderParams.setNotifyUrl(v3.getDomain().concat(notifyUrl));
}
return Post(uri, orderParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询与用户授权记录授权协议号API
* <p>
* 通过authorization_code商户查询与用户授权关系
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> queryPermissionsByAuthCode(PermissionsAuthCodeParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_PERMISSIONS_AUTH_CODE, params)
.function((wechatPayV3Type, orderParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.queryParam("service_id", orderParams.getServiceId())
.build()
.expand(orderParams.getAuthorizationCode())
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 解除用户授权关系授权协议号API
* <p>
* 通过authorization_code商户解除用户授权关系
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> terminatePermissionsByAuthCode(PermissionsAuthCodeParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_TERMINATE_PERMISSIONS_AUTH_CODE, params)
.function((wechatPayV3Type, orderParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.expand(orderParams.getAuthorizationCode())
.toUri();
orderParams.setAuthorizationCode(null);
return Post(uri, orderParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询与用户授权记录openidAPI
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> queryPermissionsByOpenId(PermissionsOpenIdParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_PERMISSIONS_OPENID, params)
.function((wechatPayV3Type, orderParams) -> {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.queryParam("appid", v3.getAppId())
.queryParam("service_id", orderParams.getServiceId())
.build()
.expand(orderParams.getOpenid())
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 解除用户授权关系openidAPI
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> terminatePermissionsByOpenId(PermissionsOpenIdParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.PAY_SCORE_PERMISSIONS_OPENID, params)
.function((wechatPayV3Type, orderParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.expand(orderParams.getOpenid())
.toUri();
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
orderParams.setAppid(v3.getAppId());
orderParams.setOpenid(null);
return Post(uri, orderParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
} }

View File

@@ -0,0 +1,71 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
import java.util.List;
/**
* 创单结单合并API请求参数
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class DirectCompleteServiceOrderParams {
/**
* The Appid.
*/
private String appid;
/**
* The Attach.
*/
private String attach;
/**
* The Goods tag.
*/
private String goodsTag;
/**
* The Location.
*/
private Location location;
/**
* The Notify url.
*/
private String notifyUrl;
/**
* The Openid.
*/
private String openid;
/**
* The Out order no.
*/
private String outOrderNo;
/**
* The Post discounts.
*/
private List<PostDiscount> postDiscounts;
/**
* The Post payments.
*/
private List<PostPayment> postPayments;
/**
* The Profit sharing.
*/
private Boolean profitSharing;
/**
* The Service id.
*/
private String serviceId;
/**
* The Service introduction.
*/
private String serviceIntroduction;
/**
* The Time range.
*/
private TimeRange timeRange;
/**
* The Total amount.
*/
private Long totalAmount;
}

View File

@@ -0,0 +1,80 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
import java.util.List;
/**
* 微信支付分用户确认订单回调解密.
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PayScoreUserConfirmConsumeData {
/**
* The Appid.
*/
private String appid;
/**
* The Attach.
*/
private String attach;
/**
* The Location.
*/
private Location location;
/**
* The Mchid.
*/
private String mchid;
/**
* The Openid.
*/
private String openid;
/**
* The Order id.
*/
private String orderId;
/**
* The Out order no.
*/
private String outOrderNo;
/**
* The Post discounts.
*/
private List<PostDiscount> postDiscounts;
/**
* The Post payments.
*/
private List<PostPayment> postPayments;
/**
* The Risk fund.
*/
private RiskFund riskFund;
/**
* The Service id.
*/
private String serviceId;
/**
* The Service introduction.
*/
private String serviceIntroduction;
/**
* The State.
*/
private String state;
/**
* The State description.
*/
private String stateDescription;
/**
* The Time range.
*/
private TimeRange timeRange;
/**
* The Total amount.
*/
private String totalAmount;
}

View File

@@ -0,0 +1,87 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
import java.util.List;
/**
* 微信支付分支付成功回调解密
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PayScoreUserPaidConsumeData {
/**
* The Appid.
*/
private String appid;
/**
* The Attach.
*/
private String attach;
/**
* The Collection.
*/
private PaymentCollection collection;
/**
* The Location.
*/
private Location location;
/**
* The Mchid.
*/
private String mchid;
/**
* The Need collection.
*/
private Boolean needCollection;
/**
* The Notify url.
*/
private String notifyUrl;
/**
* The Openid.
*/
private String openid;
/**
* The Order id.
*/
private String orderId;
/**
* The Out order no.
*/
private String outOrderNo;
/**
* The Post discounts.
*/
private List<PostDiscount> postDiscounts;
/**
* The Post payments.
*/
private List<PostPayment> postPayments;
/**
* The Risk fund.
*/
private RiskFund riskFund;
/**
* The Service id.
*/
private String serviceId;
/**
* The Service introduction.
*/
private String serviceIntroduction;
/**
* The State.
*/
private String state;
/**
* The Time range.
*/
private TimeRange timeRange;
/**
* The Total amount.
*/
private String totalAmount;
}

View File

@@ -0,0 +1,74 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
import java.util.List;
/**
* 微信支付分支付成功回调收款信息非0元完结后返回
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PaymentCollection {
/**
* The Details.
*/
private List<Detail> details;
/**
* The Paid amount.
*/
private Long paidAmount;
/**
* The Paying amount.
*/
private Long payingAmount;
/**
* The State.
*/
private String state;
/**
* The Total amount.
*/
private Long totalAmount;
/**
* 收款明细列表
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class Detail {
/**
* The Amount.
*/
private Long amount;
/**
* The Paid time.
*/
private String paidTime;
/**
* The Paid type.
*/
private String paidType;
/**
* The Promotion detail.
*/
private List<PromotionDetail> promotionDetail;
/**
* The Seq.
*/
private Long seq;
/**
* The Transaction id.
*/
private String transactionId;
}
}

View File

@@ -0,0 +1,29 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
/**
* 适用于以下API:
* <p>
* 查询与用户授权记录授权协议号API
* <p>
* 解除用户授权关系授权协议号API
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PermissionsAuthCodeParams {
/**
* 服务ID必填
*/
private String serviceId;
/**
* 授权协议号,必填
*/
private String authorizationCode;
/**
* 仅仅适用于解除用户授权关系授权协议号API
*/
private String reason;
}

View File

@@ -0,0 +1,35 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
/**
* 适用于以下API:
* <p>
* 查询与用户授权记录openidAPI
* <p>
* 解除用户授权关系openidAPI
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PermissionsOpenIdParams {
/**
* openid必填
*/
private String openid;
/**
* 仅仅适用于解除用户授权关系openidAPI
*/
private String appid;
/**
* 服务ID必填
* <p>
* 该服务ID有本接口对应产品的权限。
*/
private String serviceId;
/**
* 仅仅适用于解除用户授权关系openidAPI
*/
private String reason;
}

View File

@@ -0,0 +1,93 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
import java.util.List;
/**
* 微信支付分支付成功回调,优惠功能
*
* 注针对2020年5月27日10:00:00以后完结的订单生效
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class PromotionDetail {
/**
* The Amount.
*/
private Long amount;
/**
* The Coupon id.
*/
private String couponId;
/**
* The Currency.
*/
private String currency;
/**
* The Goods detail.
*/
private List<GoodsDetail> goodsDetail;
/**
* The Merchant contribute.
*/
private Long merchantContribute;
/**
* The Name.
*/
private String name;
/**
* The Other contribute.
*/
private Long otherContribute;
/**
* The Scope.
*/
private String scope;
/**
* The Stock id.
*/
private String stockId;
/**
* The Type.
*/
private String type;
/**
* The Wechatpay contribute.
*/
private Long wechatpayContribute;
/**
* The type Goods detail.
*/
@Data
public static class GoodsDetail {
/**
* The Discount amount.
*/
private Long discountAmount;
/**
* The Goods id.
*/
private String goodsId;
/**
* The Goods remark.
*/
private String goodsRemark;
/**
* The Quantity.
*/
private Long quantity;
/**
* The Unit price.
*/
private Long unitPrice;
}
}

View File

@@ -0,0 +1,34 @@
package cn.felord.payment.wechat.v3.model.payscore;
import lombok.Data;
/**
* 商户预授权API请求参数
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class ServiceOrderPermissionParams {
/**
* 服务id必填
*/
private String serviceId;
/**
* 服务商申请的公众号或移动应用APPID必填
*/
private String appid;
/**
* 授权协议号,必填
* <p>
* 预授权成功时的授权协议号要求此参数只能由数字、大小写字母_-*组成,且在同一个商户号下唯一。详见[商户订单号]。
*/
private String authorizationCode;
/**
* 商户接收授权回调通知的地址,选填
*/
private String notifyUrl;
}