@@ -397,6 +397,77 @@ private void checkXPayRefundNotifyMessage(WxMaMessage msg) {
397397 assertEquals (teamInfo .getTeamAction (), new Integer (0 ));
398398 }
399399
400+ /**
401+ * 个人主体虚拟支付发货通知事件 xpay_goods_deliver_notify 测试用例(XML格式)。
402+ */
403+ @ Test
404+ public void testXPayGoodsDeliverNotifyFromXml () {
405+ String xml = "<xml>\n " +
406+ " <ToUserName><![CDATA[gh_abcdefg]]></ToUserName>\n " +
407+ " <FromUserName><![CDATA[oABCDEFG]]></FromUserName>\n " +
408+ " <CreateTime>1700000000</CreateTime>\n " +
409+ " <MsgType><![CDATA[event]]></MsgType>\n " +
410+ " <Event><![CDATA[xpay_goods_deliver_notify]]></Event>\n " +
411+ " <OpenId><![CDATA[oABCDEFG]]></OpenId>\n " +
412+ " <OutTradeNo><![CDATA[order12345]]></OutTradeNo>\n " +
413+ " <WeChatPayInfo>\n " +
414+ " <MchOrderNo><![CDATA[wx_order_123]]></MchOrderNo>\n " +
415+ " </WeChatPayInfo>\n " +
416+ " <GoodsInfo>\n " +
417+ " <ProductId><![CDATA[product_001]]></ProductId>\n " +
418+ " <Quantity>2</Quantity>\n " +
419+ " </GoodsInfo>\n " +
420+ " <RetryTimes>0</RetryTimes>\n " +
421+ "</xml>" ;
422+
423+ WxMaMessage msg = WxMaMessage .fromXml (xml );
424+
425+ checkXPayGoodsDeliverNotifyMessage (msg );
426+ }
427+
428+ /**
429+ * 个人主体虚拟支付发货通知事件 xpay_goods_deliver_notify 测试用例(JSON格式)。
430+ */
431+ @ Test
432+ public void testXPayGoodsDeliverNotifyFromJson () {
433+ String json = "{\n " +
434+ " \" ToUserName\" : \" gh_abcdefg\" ,\n " +
435+ " \" FromUserName\" : \" oABCDEFG\" ,\n " +
436+ " \" CreateTime\" : 1700000000,\n " +
437+ " \" MsgType\" : \" event\" ,\n " +
438+ " \" Event\" : \" xpay_goods_deliver_notify\" ,\n " +
439+ " \" OpenId\" : \" oABCDEFG\" ,\n " +
440+ " \" OutTradeNo\" : \" order12345\" ,\n " +
441+ " \" WeChatPayInfo\" : {\n " +
442+ " \" MchOrderNo\" : \" wx_order_123\" \n " +
443+ " },\n " +
444+ " \" GoodsInfo\" : {\n " +
445+ " \" ProductId\" : \" product_001\" ,\n " +
446+ " \" Quantity\" : 2\n " +
447+ " },\n " +
448+ " \" RetryTimes\" : 0\n " +
449+ "}" ;
450+
451+ WxMaMessage msg = WxMaMessage .fromJson (json );
452+ checkXPayGoodsDeliverNotifyMessage (msg );
453+ }
454+
455+ private void checkXPayGoodsDeliverNotifyMessage (WxMaMessage msg ) {
456+ assertEquals (msg .getToUser (), "gh_abcdefg" );
457+ assertEquals (msg .getFromUser (), "oABCDEFG" );
458+ assertEquals (msg .getCreateTime (), new Integer (1700000000 ));
459+ assertEquals (msg .getMsgType (), WxConsts .XmlMsgType .EVENT );
460+ assertEquals (msg .getEvent (), WxMaConstants .XPayNotifyEvent .GOODS_DELIVER );
461+ assertEquals (msg .getOpenId (), "oABCDEFG" );
462+ assertEquals (msg .getOutTradeNo (), "order12345" );
463+ assertNotNull (msg .getWeChatPayInfo ());
464+ assertEquals (msg .getWeChatPayInfo ().getMchOrderNo (), "wx_order_123" );
465+ assertNotNull (msg .getGoodsInfo ());
466+ assertEquals (msg .getGoodsInfo ().getProductId (), "product_001" );
467+ assertEquals (msg .getGoodsInfo ().getQuantity (), new Integer (2 ));
468+ assertEquals (msg .getRetryTimes (), new Integer (0 ));
469+ }
470+
400471 /**
401472 * 虚拟支付投诉推送事件 xpay_complaint_notify 测试用例(XML格式)
402473 */
0 commit comments