微信先享卡API

This commit is contained in:
dax
2020-12-17 19:18:36 +08:00
parent 73e2b3078e
commit 84a4716d43
18 changed files with 656 additions and 45 deletions

View File

@@ -95,7 +95,7 @@
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li> <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li>
<li> <li>
<ul class="inheritance"> <ul class="inheritance">
<li>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.CombineAmount</li> <li>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.CombineAmount</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@@ -95,7 +95,7 @@
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li> <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li>
<li> <li>
<ul class="inheritance"> <ul class="inheritance">
<li>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.SubOrderCallback</li> <li>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.SubOrderCallback</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@@ -95,7 +95,7 @@
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li> <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口">java.lang.Object</a></li>
<li> <li>
<ul class="inheritance"> <ul class="inheritance">
<li>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData</li> <li>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@@ -4,7 +4,7 @@
<head> <head>
<!-- Generated by javadoc (1.8.0_252) on Sun Dec 13 22:43:48 CST 2020 --> <!-- Generated by javadoc (1.8.0_252) on Sun Dec 13 22:43:48 CST 2020 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>类 cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.CombineAmount的使用 (payment-spring-boot 1.0.0.RELEASE API)</title> <title>类 cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.CombineAmount的使用 (payment-spring-boot 1.0.0.RELEASE API)</title>
<meta name="date" content="2020-12-13"> <meta name="date" content="2020-12-13">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script> <script type="text/javascript" src="../../../../../../../script.js"></script>
@@ -13,7 +13,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
try { try {
if (location.href.indexOf('is-external=true') == -1) { if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.CombineAmount\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)"; parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.CombineAmount\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)";
} }
} }
catch(err) { catch(err) {
@@ -71,7 +71,7 @@
</a></div> </a></div>
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ========= END OF TOP NAVBAR ========= -->
<div class="header"> <div class="header">
<h2 title="类的使用 cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.CombineAmount" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.CombineAmount</h2> <h2 title="类的使用 cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.CombineAmount" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.CombineAmount</h2>
</div> </div>
<div class="classUseContainer"> <div class="classUseContainer">
<ul class="blockList"> <ul class="blockList">

View File

@@ -4,7 +4,7 @@
<head> <head>
<!-- Generated by javadoc (1.8.0_252) on Sun Dec 13 22:43:48 CST 2020 --> <!-- Generated by javadoc (1.8.0_252) on Sun Dec 13 22:43:48 CST 2020 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>类 cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.SubOrderCallback的使用 (payment-spring-boot 1.0.0.RELEASE API)</title> <title>类 cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.SubOrderCallback的使用 (payment-spring-boot 1.0.0.RELEASE API)</title>
<meta name="date" content="2020-12-13"> <meta name="date" content="2020-12-13">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script> <script type="text/javascript" src="../../../../../../../script.js"></script>
@@ -13,7 +13,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
try { try {
if (location.href.indexOf('is-external=true') == -1) { if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.SubOrderCallback\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)"; parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.SubOrderCallback\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)";
} }
} }
catch(err) { catch(err) {
@@ -71,7 +71,7 @@
</a></div> </a></div>
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ========= END OF TOP NAVBAR ========= -->
<div class="header"> <div class="header">
<h2 title="类的使用 cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.SubOrderCallback" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData.SubOrderCallback</h2> <h2 title="类的使用 cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.SubOrderCallback" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData.SubOrderCallback</h2>
</div> </div>
<div class="classUseContainer"> <div class="classUseContainer">
<ul class="blockList"> <ul class="blockList">

View File

@@ -13,7 +13,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
try { try {
if (location.href.indexOf('is-external=true') == -1) { if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)"; parent.document.title="\u7C7B cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData\u7684\u4F7F\u7528 (payment-spring-boot 1.0.0.RELEASE API)";
} }
} }
catch(err) { catch(err) {
@@ -71,7 +71,7 @@
</a></div> </a></div>
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ========= END OF TOP NAVBAR ========= -->
<div class="header"> <div class="header">
<h2 title="类的使用 cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.CombineTransactionConsumeData</h2> <h2 title="类的使用 cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData" class="title">类的使用<br>cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData</h2>
</div> </div>
<div class="classUseContainer"> <div class="classUseContainer">
<ul class="blockList"> <ul class="blockList">

View File

@@ -0,0 +1,28 @@
package cn.felord.payment.wechat.enumeration;
/**
* 微信先享卡的守约状态
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public enum ContractStatus {
/**
* 约定进行中,表示用户在约定有效期内,尚未完成所有目标时,守约状态为约定进行中。
*/
ONGOING,
/**
* 约定到期核对中,在约定有效期结束后的一段时间,商户可对卡记录进行校对并做必要调整,守约状态为约定到期核对调整中。
*/
SETTLING,
/**
* 已完成约定,表示用户在约定有效期内,已完成所有目标,守约状态为已完成约定。
*/
FINISHED,
/**
* 未完成约定,表示用户在约定有效期到期后,最终未完成所有约定目标,或用户提前退出约定,守约状态为未完成约定。
*/
UNFINISHED
}

View File

@@ -203,6 +203,27 @@ 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.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_PRE_REQUEST(HttpMethod.POST, "%s/v3/discount-card/cards"),
/**
* 微信先享卡增加用户记录API.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_ADD_USER_RECORDS(HttpMethod.POST, "%s/v3/discount-card/cards/{out_card_code}/add-user-records"),
/**
* 微信先享卡查询先享卡订单API.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_INFO(HttpMethod.POST, "%s/v3/discount-card/cards/{out_card_code}"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**

View File

@@ -66,8 +66,19 @@ public class WechatApiProvider {
} }
/** /**
* 回调. * 微信支付先享卡.
* *
* @param tenantId the tenant id
* @return the wechat discount card api
* @since 1.0.2.RELEASE
*/
public WechatDiscountCardApi discountCardApi(String tenantId) {
return new WechatDiscountCardApi(wechatPayClient, tenantId);
}
/**
* 回调.
* <p>
* 需要处理白名单、幂等性问题。 * 需要处理白名单、幂等性问题。
* *
* @param tenantId the tenant id * @param tenantId the tenant id

View File

@@ -0,0 +1,102 @@
package cn.felord.payment.wechat.v3;
import cn.felord.payment.wechat.WechatPayProperties;
import cn.felord.payment.wechat.enumeration.WeChatServer;
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
import cn.felord.payment.wechat.v3.model.discountcard.DiscountCardPreRequestParams;
import cn.felord.payment.wechat.v3.model.discountcard.UserRecordsParams;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
/**
* 微信支付先享卡.
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public class WechatDiscountCardApi extends AbstractApi {
/**
* Instantiates a new Abstract api.
*
* @param wechatPayClient the wechat pay client
* @param tenantId the tenant id
*/
public WechatDiscountCardApi(WechatPayClient wechatPayClient, String tenantId) {
super(wechatPayClient, tenantId);
}
/**
* 预受理领卡请求API
* <p>
* 商户在引导用户跳转先享卡领卡前,需要请求先享卡预受理领卡请求接口,再根据返回数据引导用户跳转领卡。
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> preRequest(DiscountCardPreRequestParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.DISCOUNT_CARD_PRE_REQUEST, params)
.function((wechatPayV3Type, requestParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.toUri();
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
requestParams.setAppid(v3.getAppId());
requestParams.setNotifyUrl(v3.getDomain().concat(requestParams.getNotifyUrl()));
return Post(uri, requestParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 增加用户记录API
* <p>
* 当用户在商户侧消费时,用户完成了微信先享卡的目标或者获取使用优惠时,商户需要把这个信息同步给微信先享卡平台,用于在微信先享卡小程序展示及先享卡到期后的用户结算。
*
* @param params the params
* @return 返回http状态码 204 处理成功,应答无内容
*/
public WechatResponseEntity<ObjectNode> addUserRecords(UserRecordsParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.DISCOUNT_CARD_ADD_USER_RECORDS, params)
.function((wechatPayV3Type, recordsParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.expand(recordsParams.getOutCardCode())
.toUri();
recordsParams.setOutCardCode(null);
return Post(uri, recordsParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询先享卡订单API
* <p>
* 商户可以通过商户领卡号查询指定的先享卡,可用于对账或者界面展示。
*
* @param outCardCode 商户领卡号
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> addUserRecords(String outCardCode) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.DISCOUNT_CARD_INFO, outCardCode)
.function((wechatPayV3Type, cardCode) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.build()
.expand(cardCode)
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
}

View File

@@ -1,7 +1,12 @@
package cn.felord.payment.wechat.v3; 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.CallbackParams;
import cn.felord.payment.wechat.v3.model.CouponConsumeData;
import cn.felord.payment.wechat.v3.model.ResponseSignVerifyParams;
import cn.felord.payment.wechat.v3.model.TransactionConsumeData;
import cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData;
import cn.felord.payment.wechat.v3.model.discountcard.DiscountCardAcceptedConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPermissionConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPermissionConsumeData;
@@ -71,8 +76,8 @@ public class WechatPayCallback {
@SneakyThrows @SneakyThrows
public Map<String, ?> couponCallback(ResponseSignVerifyParams params, Consumer<CouponConsumeData> consumeDataConsumer) { public Map<String, ?> couponCallback(ResponseSignVerifyParams params, Consumer<CouponConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.COUPON); String data = this.callback(params, EventType.COUPON);
CouponConsumeData couponConsumeData = MAPPER.readValue(data, CouponConsumeData.class); CouponConsumeData consumeData = MAPPER.readValue(data, CouponConsumeData.class);
consumeDataConsumer.accept(couponConsumeData); consumeDataConsumer.accept(consumeData);
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");
@@ -93,8 +98,8 @@ public class WechatPayCallback {
@SneakyThrows @SneakyThrows
public Map<String, ?> transactionCallback(ResponseSignVerifyParams params, Consumer<TransactionConsumeData> consumeDataConsumer) { public Map<String, ?> transactionCallback(ResponseSignVerifyParams params, Consumer<TransactionConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.TRANSACTION); String data = this.callback(params, EventType.TRANSACTION);
TransactionConsumeData transactionConsumeData = MAPPER.readValue(data, TransactionConsumeData.class); TransactionConsumeData consumeData = MAPPER.readValue(data, TransactionConsumeData.class);
consumeDataConsumer.accept(transactionConsumeData); consumeDataConsumer.accept(consumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
@@ -112,8 +117,8 @@ public class WechatPayCallback {
@SneakyThrows @SneakyThrows
public Map<String, ?> combineTransactionCallback(ResponseSignVerifyParams params, Consumer<CombineTransactionConsumeData> consumeDataConsumer) { public Map<String, ?> combineTransactionCallback(ResponseSignVerifyParams params, Consumer<CombineTransactionConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.TRANSACTION); String data = this.callback(params, EventType.TRANSACTION);
CombineTransactionConsumeData combineTransactionConsumeData = MAPPER.readValue(data, CombineTransactionConsumeData.class); CombineTransactionConsumeData consumeData = MAPPER.readValue(data, CombineTransactionConsumeData.class);
consumeDataConsumer.accept(combineTransactionConsumeData); consumeDataConsumer.accept(consumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
@@ -132,8 +137,8 @@ public class WechatPayCallback {
@SneakyThrows @SneakyThrows
public Map<String, ?> payscoreUserConfirmCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserConfirmConsumeData> consumeDataConsumer) { public Map<String, ?> payscoreUserConfirmCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserConfirmConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.PAYSCORE_USER_CONFIRM); String data = this.callback(params, EventType.PAYSCORE_USER_CONFIRM);
PayScoreUserConfirmConsumeData payScoreUserConfirmConsumeData = MAPPER.readValue(data, PayScoreUserConfirmConsumeData.class); PayScoreUserConfirmConsumeData consumeData = MAPPER.readValue(data, PayScoreUserConfirmConsumeData.class);
consumeDataConsumer.accept(payScoreUserConfirmConsumeData); consumeDataConsumer.accept(consumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
@@ -150,8 +155,8 @@ public class WechatPayCallback {
@SneakyThrows @SneakyThrows
public Map<String, ?> payscoreUserPaidCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserPaidConsumeData> consumeDataConsumer) { public Map<String, ?> payscoreUserPaidCallback(ResponseSignVerifyParams params, Consumer<PayScoreUserPaidConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.PAYSCORE_USER_PAID); String data = this.callback(params, EventType.PAYSCORE_USER_PAID);
PayScoreUserPaidConsumeData payScoreUserPaidConsumeData = MAPPER.readValue(data, PayScoreUserPaidConsumeData.class); PayScoreUserPaidConsumeData consumeData = MAPPER.readValue(data, PayScoreUserPaidConsumeData.class);
consumeDataConsumer.accept(payScoreUserPaidConsumeData); consumeDataConsumer.accept(consumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
@@ -180,13 +185,26 @@ public class WechatPayCallback {
throw new PayException(" wechat pay event type is not matched"); throw new PayException(" wechat pay event type is not matched");
} }
String data = this.decrypt(callbackParams); String data = this.decrypt(callbackParams);
PayScoreUserPermissionConsumeData payScoreUserPermissionConsumeData = MAPPER.readValue(data, PayScoreUserPermissionConsumeData.class); PayScoreUserPermissionConsumeData consumeData = MAPPER.readValue(data, PayScoreUserPermissionConsumeData.class);
payScoreUserPermissionConsumeData.setClosed(closed); consumeData.setClosed(closed);
consumeDataConsumer.accept(consumeData);
consumeDataConsumer.accept(payScoreUserPermissionConsumeData);
return Collections.singletonMap("code", "SUCCESS"); return Collections.singletonMap("code", "SUCCESS");
} }
/**
* Discount card user accepted callback map.
*
* @param params the params
* @param consumeDataConsumer the consume data consumer
* @return the map
*/
@SneakyThrows
public Map<String, ?> discountCardUserAcceptedCallback(ResponseSignVerifyParams params, Consumer<DiscountCardAcceptedConsumeData> consumeDataConsumer) {
String data = this.callback(params, EventType.DISCOUNT_CARD_USER_ACCEPTED);
DiscountCardAcceptedConsumeData consumeData = MAPPER.readValue(data, DiscountCardAcceptedConsumeData.class);
consumeDataConsumer.accept(consumeData);
return Collections.singletonMap("code", "SUCCESS");
}
/** /**
* Callback. * Callback.
@@ -253,24 +271,49 @@ public class WechatPayCallback {
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAYSCORE_USER_CONFIRM("PAYSCORE.USER_CONFIRM"), PAYSCORE_USER_CONFIRM("PAYSCORE.USER_CONFIRM"),
/** /**
* 微信支付分用户支付成功订单事件. * 微信支付分用户支付成功订单事件.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAYSCORE_USER_PAID("PAYSCORE.USER_PAID"), PAYSCORE_USER_PAID("PAYSCORE.USER_PAID"),
/** /**
* 微信支付分授权事件. * 微信支付分授权事件.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAYSCORE_USER_OPEN("PAYSCORE.USER_OPEN_SERVICE"), PAYSCORE_USER_OPEN("PAYSCORE.USER_OPEN_SERVICE"),
/** /**
* 微信支付分解除授权事件. * 微信支付分解除授权事件.
* *
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
*/ */
PAYSCORE_USER_CLOSE("PAYSCORE.USER_CLOSE_SERVICE"), PAYSCORE_USER_CLOSE("PAYSCORE.USER_CLOSE_SERVICE"),
/**
* 用户领取微信先享卡事件.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_USER_ACCEPTED("DISCOUNT_CARD.USER_ACCEPTED"),
/**
* TODO 微信先享卡守约状态变化事件.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_AGREEMENT_ENDED("DISCOUNT_CARD.AGREEMENT_ENDED"),
/**
* TODO 微信先享卡扣费状态变化事件.
*
* @since 1.0.2.RELEASE
*/
DISCOUNT_CARD_USER_PAID("DISCOUNT_CARD.USER_PAID"),
/** /**
* 优惠券核销事件. * 优惠券核销事件.
* *
@@ -299,5 +342,4 @@ public class WechatPayCallback {
} }
} }
} }

View File

@@ -12,23 +12,84 @@ import lombok.Data;
@Data @Data
public class CouponConsumeData { public class CouponConsumeData {
/**
* The Available begin time.
*/
private String availableBeginTime; private String availableBeginTime;
/**
* The Available end time.
*/
private String availableEndTime; private String availableEndTime;
/**
* The Consume information.
*/
private ConsumeInformation consumeInformation; private ConsumeInformation consumeInformation;
/**
* The Coupon id.
*/
private String couponId; private String couponId;
/**
* The Coupon name.
*/
private String couponName; private String couponName;
private String couponType; /**
* The Coupon type.
*/
private CouponType couponType;
/**
* The Create time.
*/
private String createTime; private String createTime;
/**
* The Description.
*/
private String description; private String description;
/**
* The Discount to.
*/
private DiscountTo discountTo; private DiscountTo discountTo;
private boolean noCash; /**
* The No cash.
*/
private Boolean noCash;
/**
* The Normal coupon information.
*/
private NormalCouponInformation normalCouponInformation; private NormalCouponInformation normalCouponInformation;
private boolean singleitem; /**
* The Singleitem.
*/
private Boolean singleitem;
/**
* The Singleitem discount off.
*/
private SingleitemDiscountOff singleitemDiscountOff; private SingleitemDiscountOff singleitemDiscountOff;
/**
* The Status.
*/
private String status; private String status;
/**
* The Stock creator mchid.
*/
private String stockCreatorMchid; private String stockCreatorMchid;
/**
* The Stock id.
*/
private String stockId; private String stockId;
/**
* 券类型
*
* @since 1.0.2.RELEASE
*/
public enum CouponType{
/**
* 满减券
*/
NORMAL,
/**
* 减至券
*/
CUT_TO
}
} }

View File

@@ -12,9 +12,9 @@ public class SettleInfo {
/** /**
* 是否指定分账 * 是否指定分账
*/ */
private boolean profitSharing; private Boolean profitSharing;
/** /**
* 补差金额 * 补差金额
*/ */
private int subsidyAmount; private Integer subsidyAmount;
} }

View File

@@ -1,6 +1,8 @@
package cn.felord.payment.wechat.v3.model; package cn.felord.payment.wechat.v3.model;
import cn.felord.payment.wechat.enumeration.TradeState;
import cn.felord.payment.wechat.enumeration.TradeType;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -54,17 +56,19 @@ public class TransactionConsumeData {
*/ */
private String successTime; private String successTime;
/** /**
* The Trade state. * 在 1.0.0.RELEASE 直接返回了枚举字符串1.0.2.RELEASE 中变更为枚举
* @since 1.0.0.RELEASE
*/ */
private String tradeState; private TradeState tradeState;
/** /**
* The Trade state desc. * The Trade state desc.
*/ */
private String tradeStateDesc; private String tradeStateDesc;
/** /**
* The Trade type. * 在 1.0.0.RELEASE 直接返回了枚举字符串1.0.2.RELEASE 中变更为枚举
* @since 1.0.0.RELEASE
*/ */
private String tradeType; private TradeType tradeType;
/** /**
* The Transaction id. * The Transaction id.
*/ */
@@ -110,11 +114,11 @@ public class TransactionConsumeData {
/** /**
* The Total. * The Total.
*/ */
private int total; private Integer total;
/** /**
* The Payer total. * The Payer total.
*/ */
private int payerTotal; private Integer payerTotal;
/** /**
* The Currency. * The Currency.
*/ */

View File

@@ -1,7 +1,9 @@
package cn.felord.payment.wechat.v3.model; package cn.felord.payment.wechat.v3.model.combine;
import cn.felord.payment.wechat.v3.model.combine.CombinePayerInfo; import cn.felord.payment.wechat.enumeration.TradeState;
import cn.felord.payment.wechat.enumeration.TradeType;
import cn.felord.payment.wechat.v3.model.SceneInfo;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -94,12 +96,12 @@ public class CombineTransactionConsumeData {
/** /**
* The Trade state. * The Trade state.
*/ */
private String tradeState; private TradeState tradeState;
/** /**
* The Trade type. * The Trade type.
*/ */
private String tradeType; private TradeType tradeType;
/** /**
* The Transaction id. * The Transaction id.

View File

@@ -0,0 +1,173 @@
package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus;
import lombok.Data;
import java.util.List;
/**
* 用户领取微信先享卡通知解密
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class DiscountCardAcceptedConsumeData {
/**
* The Appid.
*/
private String appid;
/**
* The Card id.
*/
private String cardId;
/**
* The Card template id.
*/
private String cardTemplateId;
/**
* The Create time.
*/
private String createTime;
/**
* The Mchid.
*/
private String mchid;
/**
* The Objectives.
*/
private List<Objective> objectives;
/**
* The Openid.
*/
private String openid;
/**
* The Out card code.
*/
private String outCardCode;
/**
* The Rewards.
*/
private List<Reward> rewards;
/**
* The Sharer openid.
*/
private String sharerOpenid;
/**
* The State.
*/
private ContractStatus state;
/**
* The Time range.
*/
private TimeRange timeRange;
/**
* 用户先享卡目标列表
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class Objective {
/**
* The Count.
*/
private Long count;
/**
* The Description.
*/
private String description;
/**
* The Name.
*/
private String name;
/**
* The Objective id.
*/
private String objectiveId;
/**
* The Unit.
*/
private String unit;
}
/**
* 用户先享卡优惠列表
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class Reward {
/**
* The Amount.
*/
private Long amount;
/**
* The Count.
*/
private Long count;
/**
* The Count type.
*/
private CountType countType;
/**
* The Description.
*/
private String description;
/**
* The Name.
*/
private String name;
/**
* The Reward id.
*/
private String rewardId;
/**
* The Unit.
*/
private String unit;
}
/**
* The type Time range.
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class TimeRange {
/**
* The Betin time.
*/
private String betinTime;
/**
* The End time.
*/
private String endTime;
}
/**
* 优惠数量的类型标识
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public enum CountType{
/**
* 不限数量
*/
COUNT_UNLIMITED,
/**
* 有限数量
*/
COUNT_LIMIT
}
}

View File

@@ -0,0 +1,33 @@
package cn.felord.payment.wechat.v3.model.discountcard;
import lombok.Data;
/**
* 预受理领卡请求参数
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class DiscountCardPreRequestParams {
/**
* 商户领卡号,必传
*/
private String outCardCode;
/**
* 先享卡模板ID必传
*/
private String cardTemplateId;
/**
* APPID必传自动从配置中注入
*/
private String appid;
/**
* 通知商户URL必传
*/
private String notifyUrl;
}

View File

@@ -0,0 +1,134 @@
package cn.felord.payment.wechat.v3.model.discountcard;
import lombok.Data;
import java.util.List;
/**
* 增加用户记录请求参数
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public class UserRecordsParams {
/**
* The Out card code.
*/
private String outCardCode;
/**
* The Card template id.
*/
private String cardTemplateId;
/**
* The Objective completion records.
*/
private List<ObjectiveCompletionRecord> objectiveCompletionRecords;
/**
* The Reward usage records.
*/
private List<RewardUsageRecord> rewardUsageRecords;
/**
* The type Objective completion record.
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class ObjectiveCompletionRecord {
/**
* The Completion count.
*/
private Long completionCount;
/**
* The Completion time.
*/
private String completionTime;
/**
* The Completion type.
*/
private StrategyType completionType;
/**
* The Description.
*/
private String description;
/**
* The Objective completion serial no.
*/
private String objectiveCompletionSerialNo;
/**
* The Objective id.
*/
private String objectiveId;
/**
* The Remark.
*/
private String remark;
}
/**
* The type Reward usage record.
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
@Data
public static class RewardUsageRecord {
/**
* The Amount.
*/
private Long amount;
/**
* The Description.
*/
private String description;
/**
* The Remark.
*/
private String remark;
/**
* The Reward id.
*/
private String rewardId;
/**
* The Reward usage serial no.
*/
private String rewardUsageSerialNo;
/**
* The Usage count.
*/
private Long usageCount;
/**
* The Usage time.
*/
private String usageTime;
/**
* The Usage type.
*/
private StrategyType usageType;
}
/**
* 目标完成类型、优惠使用类型
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public enum StrategyType {
/**
* 增加数量,表示用户发生了履约行为
*/
INCREASE,
/**
* 减少数量,表示取消用户的履约行为(例如用户取消购买、退货退款等)
*/
DECREASE
}
}