|
1 | 1 | package cn.binarywang.wx.miniapp.bean; |
2 | 2 |
|
3 | 3 | import cn.binarywang.wx.miniapp.bean.xpay.WxMaXPayTeamInfo; |
| 4 | +import cn.binarywang.wx.miniapp.constant.WxMaConstants; |
4 | 5 | import me.chanjar.weixin.common.api.WxConsts; |
5 | 6 | import org.testng.annotations.Test; |
6 | 7 |
|
@@ -457,4 +458,70 @@ private void checkXPayComplaintNotifyMessage(WxMaMessage msg) { |
457 | 458 | assertEquals(msg.getRetryTimes(), new Integer(0)); |
458 | 459 | assertEquals(msg.getRequestId(), "req_005"); |
459 | 460 | } |
| 461 | + |
| 462 | + /** |
| 463 | + * 虚拟支付 iOS 退款查询通知事件 xpay_subscribe_ios_refund_query_notify 测试用例(XML格式) |
| 464 | + */ |
| 465 | + @Test |
| 466 | + public void testXPaySubscribeIosRefundQueryNotifyFromXml() { |
| 467 | + String xml = "<xml>\n" + |
| 468 | + " <ToUserName><![CDATA[gh_abcdefg]]></ToUserName>\n" + |
| 469 | + " <FromUserName><![CDATA[oABCDEFG]]></FromUserName>\n" + |
| 470 | + " <CreateTime>1700001000</CreateTime>\n" + |
| 471 | + " <MsgType><![CDATA[event]]></MsgType>\n" + |
| 472 | + " <Event><![CDATA[xpay_subscribe_ios_refund_query_notify]]></Event>\n" + |
| 473 | + " <refund_time><![CDATA[1700000900]]></refund_time>\n" + |
| 474 | + " <order_time><![CDATA[1699990000]]></order_time>\n" + |
| 475 | + " <channel_bill><![CDATA[apple_bill_001]]></channel_bill>\n" + |
| 476 | + " <bundleid><![CDATA[com.example.app]]></bundleid>\n" + |
| 477 | + " <product_id><![CDATA[product_xyz]]></product_id>\n" + |
| 478 | + " <p_count><![CDATA[1]]></p_count>\n" + |
| 479 | + " <refund_request_reason><![CDATA[不喜欢]]></refund_request_reason>\n" + |
| 480 | + " <provide_status><![CDATA[1]]></provide_status>\n" + |
| 481 | + "</xml>"; |
| 482 | + |
| 483 | + WxMaMessage msg = WxMaMessage.fromXml(xml); |
| 484 | + checkXPaySubscribeIosRefundQueryNotifyMessage(msg); |
| 485 | + } |
| 486 | + |
| 487 | + /** |
| 488 | + * 虚拟支付 iOS 退款查询通知事件 xpay_subscribe_ios_refund_query_notify 测试用例(JSON格式) |
| 489 | + */ |
| 490 | + @Test |
| 491 | + public void testXPaySubscribeIosRefundQueryNotifyFromJson() { |
| 492 | + String json = "{\n" + |
| 493 | + " \"ToUserName\": \"gh_abcdefg\",\n" + |
| 494 | + " \"FromUserName\": \"oABCDEFG\",\n" + |
| 495 | + " \"CreateTime\": 1700001000,\n" + |
| 496 | + " \"MsgType\": \"event\",\n" + |
| 497 | + " \"Event\": \"xpay_subscribe_ios_refund_query_notify\",\n" + |
| 498 | + " \"refund_time\": \"1700000900\",\n" + |
| 499 | + " \"order_time\": \"1699990000\",\n" + |
| 500 | + " \"channel_bill\": \"apple_bill_001\",\n" + |
| 501 | + " \"bundleid\": \"com.example.app\",\n" + |
| 502 | + " \"product_id\": \"product_xyz\",\n" + |
| 503 | + " \"p_count\": \"1\",\n" + |
| 504 | + " \"refund_request_reason\": \"不喜欢\",\n" + |
| 505 | + " \"provide_status\": \"1\"\n" + |
| 506 | + "}"; |
| 507 | + |
| 508 | + WxMaMessage msg = WxMaMessage.fromJson(json); |
| 509 | + checkXPaySubscribeIosRefundQueryNotifyMessage(msg); |
| 510 | + } |
| 511 | + |
| 512 | + private void checkXPaySubscribeIosRefundQueryNotifyMessage(WxMaMessage msg) { |
| 513 | + assertEquals(msg.getToUser(), "gh_abcdefg"); |
| 514 | + assertEquals(msg.getFromUser(), "oABCDEFG"); |
| 515 | + assertEquals(msg.getCreateTime(), new Integer(1700001000)); |
| 516 | + assertEquals(msg.getMsgType(), WxConsts.XmlMsgType.EVENT); |
| 517 | + assertEquals(msg.getEvent(), WxMaConstants.XPayNotifyEvent.IOS_REFUND_QUERY); |
| 518 | + assertEquals(msg.getRefundTime(), "1700000900"); |
| 519 | + assertEquals(msg.getOrderTime(), "1699990000"); |
| 520 | + assertEquals(msg.getChannelBill(), "apple_bill_001"); |
| 521 | + assertEquals(msg.getBundleid(), "com.example.app"); |
| 522 | + assertEquals(msg.getXpayProductId(), "product_xyz"); |
| 523 | + assertEquals(msg.getPCount(), "1"); |
| 524 | + assertEquals(msg.getRefundRequestReason(), "不喜欢"); |
| 525 | + assertEquals(msg.getProvideStatus(), "1"); |
| 526 | + } |
460 | 527 | } |
0 commit comments