🎨 #3974 【小程序】新增虚拟支付iOS退款查询通知事件的支持
This commit is contained in:
@@ -499,6 +499,11 @@ public class WxConsts {
|
||||
* 订单完成发货时、订单结算时
|
||||
*/
|
||||
public static final String TRADE_MANAGE_ORDER_SETTLEMENT = "trade_manage_order_settlement";
|
||||
/**
|
||||
* 虚拟支付 iOS 退款查询通知
|
||||
* 文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/virtual-payment/ios.html
|
||||
*/
|
||||
public static final String XPAY_SUBSCRIBE_IOS_REFUND_QUERY_NOTIFY = "xpay_subscribe_ios_refund_query_notify";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -464,6 +464,80 @@ public class WxMaMessage implements Serializable {
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String requestId;
|
||||
|
||||
// xpay_subscribe_ios_refund_query_notify iOS退款查询通知字段
|
||||
|
||||
/**
|
||||
* 问询时间,Unix时间戳.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("refund_time")
|
||||
@XStreamAlias("refund_time")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String refundTime;
|
||||
|
||||
/**
|
||||
* 该笔退款的订单时间(退款订单对应的交易时间),Unix时间戳.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("order_time")
|
||||
@XStreamAlias("order_time")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String orderTime;
|
||||
|
||||
/**
|
||||
* Apple 支付票据号.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("channel_bill")
|
||||
@XStreamAlias("channel_bill")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String channelBill;
|
||||
|
||||
/**
|
||||
* 应用的 Apple bundleid.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("bundleid")
|
||||
@XStreamAlias("bundleid")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String bundleid;
|
||||
|
||||
/**
|
||||
* 道具 id.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("product_id")
|
||||
@XStreamAlias("product_id")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String xpayProductId;
|
||||
|
||||
/**
|
||||
* 道具/代币数量.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("p_count")
|
||||
@XStreamAlias("p_count")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String pCount;
|
||||
|
||||
/**
|
||||
* 用户请求退款的原因.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("refund_request_reason")
|
||||
@XStreamAlias("refund_request_reason")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String refundRequestReason;
|
||||
|
||||
/**
|
||||
* 发货状态,0:未发货 1:已发货 2:发货中.
|
||||
* xpay_subscribe_ios_refund_query_notify
|
||||
*/
|
||||
@SerializedName("provide_status")
|
||||
@XStreamAlias("provide_status")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String provideStatus;
|
||||
|
||||
/**
|
||||
* 不要直接使用这个字段,
|
||||
* 这个字段只是为了适配 SubscribeMsgPopupEvent SubscribeMsgChangeEvent SubscribeMsgSentEvent
|
||||
|
||||
@@ -265,6 +265,11 @@ public class WxMaConstants {
|
||||
public static final String GOODS_DELIVER = "xpay_goods_deliver_notify";
|
||||
public static final String REFUND = "xpay_refund_notify";
|
||||
public static final String COMPLAINT = "xpay_complaint_notify";
|
||||
/**
|
||||
* 虚拟支付 iOS 退款查询通知.
|
||||
* 文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/virtual-payment/ios.html
|
||||
*/
|
||||
public static final String IOS_REFUND_QUERY = "xpay_subscribe_ios_refund_query_notify";
|
||||
|
||||
}
|
||||
@UtilityClass
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.bean;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.xpay.WxMaXPayTeamInfo;
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -457,4 +458,70 @@ public class WxMaMessageTest {
|
||||
assertEquals(msg.getRetryTimes(), new Integer(0));
|
||||
assertEquals(msg.getRequestId(), "req_005");
|
||||
}
|
||||
|
||||
/**
|
||||
* 虚拟支付 iOS 退款查询通知事件 xpay_subscribe_ios_refund_query_notify 测试用例(XML格式)
|
||||
*/
|
||||
@Test
|
||||
public void testXPaySubscribeIosRefundQueryNotifyFromXml() {
|
||||
String xml = "<xml>\n" +
|
||||
" <ToUserName><![CDATA[gh_abcdefg]]></ToUserName>\n" +
|
||||
" <FromUserName><![CDATA[oABCDEFG]]></FromUserName>\n" +
|
||||
" <CreateTime>1700001000</CreateTime>\n" +
|
||||
" <MsgType><![CDATA[event]]></MsgType>\n" +
|
||||
" <Event><![CDATA[xpay_subscribe_ios_refund_query_notify]]></Event>\n" +
|
||||
" <refund_time><![CDATA[1700000900]]></refund_time>\n" +
|
||||
" <order_time><![CDATA[1699990000]]></order_time>\n" +
|
||||
" <channel_bill><![CDATA[apple_bill_001]]></channel_bill>\n" +
|
||||
" <bundleid><![CDATA[com.example.app]]></bundleid>\n" +
|
||||
" <product_id><![CDATA[product_xyz]]></product_id>\n" +
|
||||
" <p_count><![CDATA[1]]></p_count>\n" +
|
||||
" <refund_request_reason><![CDATA[不喜欢]]></refund_request_reason>\n" +
|
||||
" <provide_status><![CDATA[1]]></provide_status>\n" +
|
||||
"</xml>";
|
||||
|
||||
WxMaMessage msg = WxMaMessage.fromXml(xml);
|
||||
checkXPaySubscribeIosRefundQueryNotifyMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 虚拟支付 iOS 退款查询通知事件 xpay_subscribe_ios_refund_query_notify 测试用例(JSON格式)
|
||||
*/
|
||||
@Test
|
||||
public void testXPaySubscribeIosRefundQueryNotifyFromJson() {
|
||||
String json = "{\n" +
|
||||
" \"ToUserName\": \"gh_abcdefg\",\n" +
|
||||
" \"FromUserName\": \"oABCDEFG\",\n" +
|
||||
" \"CreateTime\": 1700001000,\n" +
|
||||
" \"MsgType\": \"event\",\n" +
|
||||
" \"Event\": \"xpay_subscribe_ios_refund_query_notify\",\n" +
|
||||
" \"refund_time\": \"1700000900\",\n" +
|
||||
" \"order_time\": \"1699990000\",\n" +
|
||||
" \"channel_bill\": \"apple_bill_001\",\n" +
|
||||
" \"bundleid\": \"com.example.app\",\n" +
|
||||
" \"product_id\": \"product_xyz\",\n" +
|
||||
" \"p_count\": \"1\",\n" +
|
||||
" \"refund_request_reason\": \"不喜欢\",\n" +
|
||||
" \"provide_status\": \"1\"\n" +
|
||||
"}";
|
||||
|
||||
WxMaMessage msg = WxMaMessage.fromJson(json);
|
||||
checkXPaySubscribeIosRefundQueryNotifyMessage(msg);
|
||||
}
|
||||
|
||||
private void checkXPaySubscribeIosRefundQueryNotifyMessage(WxMaMessage msg) {
|
||||
assertEquals(msg.getToUser(), "gh_abcdefg");
|
||||
assertEquals(msg.getFromUser(), "oABCDEFG");
|
||||
assertEquals(msg.getCreateTime(), new Integer(1700001000));
|
||||
assertEquals(msg.getMsgType(), WxConsts.XmlMsgType.EVENT);
|
||||
assertEquals(msg.getEvent(), WxMaConstants.XPayNotifyEvent.IOS_REFUND_QUERY);
|
||||
assertEquals(msg.getRefundTime(), "1700000900");
|
||||
assertEquals(msg.getOrderTime(), "1699990000");
|
||||
assertEquals(msg.getChannelBill(), "apple_bill_001");
|
||||
assertEquals(msg.getBundleid(), "com.example.app");
|
||||
assertEquals(msg.getXpayProductId(), "product_xyz");
|
||||
assertEquals(msg.getPCount(), "1");
|
||||
assertEquals(msg.getRefundRequestReason(), "不喜欢");
|
||||
assertEquals(msg.getProvideStatus(), "1");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user