@Test public void testParseOrderNotifyResult() throws Exception { String xmlString = "<xml>\n" + " <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" + " <attach><![CDATA[支付测试]]></attach>\n" + " <bank_type><![CDATA[CFT]]></bank_type>\n" + " <fee_type><![CDATA[CNY]]></fee_type>\n" + " <is_subscribe><![CDATA[Y]]></is_subscribe>\n" + " <mch_id><![CDATA[10000100]]></mch_id>\n" + " <nonce_str><![CDATA[5d2b6c2a8db53831f7eda20af46e531c]]></nonce_str>\n" + " <openid><![CDATA[oUpF8uMEb4qRXf22hE3X68TekukE]]></openid>\n" + " <out_trade_no><![CDATA[1409811653]]></out_trade_no>\n" + " <result_code><![CDATA[SUCCESS]]></result_code>\n" + " <return_code><![CDATA[SUCCESS]]></return_code>\n" + " <sign><![CDATA[B552ED6B279343CB493C5DD0D78AB241]]></sign>\n" + " <sub_mch_id><![CDATA[10000100]]></sub_mch_id>\n" + " <time_end><![CDATA[20140903131540]]></time_end>\n" + " <total_fee>1</total_fee>\n" + " <trade_type><![CDATA[JSAPI]]></trade_type>\n" + " <transaction_id><![CDATA[1004400740201409030005092168]]></transaction_id>\n" + " <coupon_count>2</coupon_count>\n" + " <coupon_type_0><![CDATA[CASH]]></coupon_type_0>\n" + " <coupon_id_0>10000</coupon_id_0>\n" + " <coupon_fee_0>100</coupon_fee_0>\n" + " <coupon_type_1><![CDATA[NO_CASH]]></coupon_type_1>\n" + " <coupon_id_1>10001</coupon_id_1>\n" + " <coupon_fee_1>200</coupon_fee_1>\n" + "</xml>"; WxPayOrderNotifyResult result = this.payService.parseOrderNotifyResult(xmlString); System.out.println(result); }
@Override public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付异步通知请求参数：{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付异步通知请求解析后的对象：{}", result); result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { log.error(e.getMessage(), e); throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new WxPayException("发生异常，" + e.getMessage(), e); } }
BaseWxPayServiceImpl implements WxPayService { @Override public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付异步通知请求参数：{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付异步通知请求解析后的对象：{}", result); result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { log.error(e.getMessage(), e); throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new WxPayException("发生异常，" + e.getMessage(), e); } } }
BaseWxPayServiceImpl implements WxPayService { @Override public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付异步通知请求参数：{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付异步通知请求解析后的对象：{}", result); result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { log.error(e.getMessage(), e); throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new WxPayException("发生异常，" + e.getMessage(), e); } }  }
BaseWxPayServiceImpl implements WxPayService { @Override public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付异步通知请求参数：{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付异步通知请求解析后的对象：{}", result); result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { log.error(e.getMessage(), e); throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new WxPayException("发生异常，" + e.getMessage(), e); } }  @Override EntPayService getEntPayService(); @Override void setEntPayService(EntPayService entPayService); @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override String getPayBaseUrl(); @Override WxPayRefundResult refund(WxPayRefundRequest request); @Override WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, String outRefundNo, String refundId); @Override WxPayRefundQueryResult refundQuery(WxPayRefundQueryRequest request); @Override WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData); @Override WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData); @Override WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData); @Override WxPaySendRedpackResult sendRedpack(WxPaySendRedpackRequest request); @Override WxPayRedpackQueryResult queryRedpack(String mchBillNo); @Override WxPayOrderQueryResult queryOrder(String transactionId, String outTradeNo); @Override WxPayOrderQueryResult queryOrder(WxPayOrderQueryRequest request); @Override WxPayOrderCloseResult closeOrder(String outTradeNo); @Override WxPayOrderCloseResult closeOrder(WxPayOrderCloseRequest request); @Override T createOrder(WxPayUnifiedOrderRequest request); @Override WxPayUnifiedOrderResult unifiedOrder(WxPayUnifiedOrderRequest request); @Override @Deprecated Map<String, String> getPayInfo(WxPayUnifiedOrderRequest request); @Override byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength); @Override String createScanPayQrcodeMode1(String productId); @Override byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength); @Override void report(WxPayReportRequest request); @Override WxPayBillResult downloadBill(String billDate, String billType, String tarType, String deviceInfo); @Override WxPayBillResult downloadBill(WxPayDownloadBillRequest request); @Override WxPayMicropayResult micropay(WxPayMicropayRequest request); @Override WxPayOrderReverseResult reverseOrder(WxPayOrderReverseRequest request); @Override String shorturl(WxPayShorturlRequest request); @Override String shorturl(String longUrl); @Override String authcode2Openid(WxPayAuthcode2OpenidRequest request); @Override String authcode2Openid(String authCode); @Override String getSandboxSignKey(); @Override WxPayCouponSendResult sendCoupon(WxPayCouponSendRequest request); @Override WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request); @Override WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request); @Override WxPayApiData getWxApiData(); @Override String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit); }
BaseWxPayServiceImpl implements WxPayService { @Override public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付异步通知请求参数：{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付异步通知请求解析后的对象：{}", result); result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { log.error(e.getMessage(), e); throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new WxPayException("发生异常，" + e.getMessage(), e); } }  @Override EntPayService getEntPayService(); @Override void setEntPayService(EntPayService entPayService); @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override String getPayBaseUrl(); @Override WxPayRefundResult refund(WxPayRefundRequest request); @Override WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, String outRefundNo, String refundId); @Override WxPayRefundQueryResult refundQuery(WxPayRefundQueryRequest request); @Override WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData); @Override WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData); @Override WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData); @Override WxPaySendRedpackResult sendRedpack(WxPaySendRedpackRequest request); @Override WxPayRedpackQueryResult queryRedpack(String mchBillNo); @Override WxPayOrderQueryResult queryOrder(String transactionId, String outTradeNo); @Override WxPayOrderQueryResult queryOrder(WxPayOrderQueryRequest request); @Override WxPayOrderCloseResult closeOrder(String outTradeNo); @Override WxPayOrderCloseResult closeOrder(WxPayOrderCloseRequest request); @Override T createOrder(WxPayUnifiedOrderRequest request); @Override WxPayUnifiedOrderResult unifiedOrder(WxPayUnifiedOrderRequest request); @Override @Deprecated Map<String, String> getPayInfo(WxPayUnifiedOrderRequest request); @Override byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength); @Override String createScanPayQrcodeMode1(String productId); @Override byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength); @Override void report(WxPayReportRequest request); @Override WxPayBillResult downloadBill(String billDate, String billType, String tarType, String deviceInfo); @Override WxPayBillResult downloadBill(WxPayDownloadBillRequest request); @Override WxPayMicropayResult micropay(WxPayMicropayRequest request); @Override WxPayOrderReverseResult reverseOrder(WxPayOrderReverseRequest request); @Override String shorturl(WxPayShorturlRequest request); @Override String shorturl(String longUrl); @Override String authcode2Openid(WxPayAuthcode2OpenidRequest request); @Override String authcode2Openid(String authCode); @Override String getSandboxSignKey(); @Override WxPayCouponSendResult sendCoupon(WxPayCouponSendRequest request); @Override WxPayCouponStockQueryResult queryCouponStock(WxPayCouponStockQueryRequest request); @Override WxPayCouponInfoQueryResult queryCouponInfo(WxPayCouponInfoQueryRequest request); @Override WxPayApiData getWxApiData(); @Override String queryComment(Date beginDate, Date endDate, Integer offset, Integer limit);  }