feat(tenpayv2): 新增部分接口

This commit is contained in:
RHQYZ
2022-01-25 13:24:49 +08:00
committed by GitHub
parent 122cd5186c
commit 6458d08381
234 changed files with 11734 additions and 891 deletions

View File

@@ -0,0 +1,24 @@
{
"appid": "wx2421b1c4370ec43b",
"sub_appid": "wx2421b1c4370ec13b",
"attach": "支付测试",
"bank_type": "CFT",
"fee_type": "CNY",
"is_subscribe": "Y",
"mch_id": "10000100",
"nonce_str": "5d2b6c2a8db53831f7eda20af46e531c",
"openid": "oUpF8uMEb4qRXf22hE3X68TekukE",
"out_trade_no": "1409811653",
"result_code": "SUCCESS",
"return_code": "SUCCESS",
"sign": "B552ED6B279343CB493C5DD0D78AB241",
"sub_mch_id": "10000100",
"time_end": "20140903131540",
"total_fee": "1",
"coupon_fee_0": "10",
"coupon_count": "1",
"coupon_type_0": "CASH",
"coupon_id_0": "10000",
"trade_type": "JSAPI",
"transaction_id": "1004400740201409030005092168"
}

View File

@@ -0,0 +1,13 @@
{
"return_code": "SUCCESS",
"result_code": "SUCCESS",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"mch_id": "10010404",
"sub_mch_id": "10010405",
"contract_code": "100001256",
"openid": "onqOjjmM1tad-3ROpncN-yUfa6ua",
"plan_id": "123",
"change_type": "ADD",
"operate_time": "2015-07-01 10:00:00",
"contract_id": "Wx15463511252015071056489715"
}

View File

@@ -0,0 +1,21 @@
{
"appid": "wx2421b1c4370ec43b",
"attach": "支付测试",
"bank_type": "CFT",
"fee_type": "CNY",
"is_subscribe": "Y",
"mch_id": "10000100",
"sub_mch_id": "10000100",
"nonce_str": "5d2b6c2a8db53831f7eda20af46e531c",
"openid": "oUpF8uMEb4qRXf22hE3X68TekukE",
"out_trade_no": "1409811653",
"cash_fee": "1000",
"trade_state": "SUCCESS",
"result_code": "SUCCESS",
"return_code": "SUCCESS",
"sign": "B552ED6B279343CB493C5DD0D78AB241",
"time_end": "20140903131540",
"total_fee": "1",
"transaction_id": "1004400740201409030005092168",
"contract_id": "Wx15463511252015071056489715"
}

View File

@@ -0,0 +1,15 @@
{
"out_refund_no": "131811191610442717309",
"out_trade_no": "71106718111915575302817",
"refund_account": "REFUND_SOURCE_RECHARGE_FUNDS",
"refund_fee": "3960",
"refund_id": "50000408942018111907145868882",
"refund_recv_accout": "支付用户零钱",
"refund_request_source": "API",
"refund_status": "SUCCESS",
"settlement_refund_fee": "3960",
"settlement_total_fee": "3960",
"success_time": "2018-11-19 16:24:13",
"total_fee": "3960",
"transaction_id": "4200000215201811190261405420"
}

View File

@@ -0,0 +1,11 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "GOp3TRyMXzbMlkun",
"sign": "D6C76CB785F07992CDE05494BB7DF7FD",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"total_fee": "1",
"consume_fee": "0",
"fee_type": "CNY"
}

View File

@@ -0,0 +1,14 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "GOp3TRyMXzbMlkun",
"sign": "D6C76CB785F07992CDE05494BB7DF7FD",
"result_code": "SUCCESS",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"total_fee": "1",
"consume_fee": "0",
"fee_type": "CNY"
}

View File

@@ -0,0 +1,17 @@
{
"deposit": "Y",
"appid": "wx2421b1c4370ec43b",
"attach": "订单额外描述",
"face_code": " b713b5d2-666c-48b6-8c37-f15acf5a7069",
"openid": " oHkLxtxS5pkpxVbVeVuqpPQviw5o ",
"body": "押金人脸支付测试",
"device_info": "1000",
"mch_id": "10000100",
"sub_mch_id": "10000101",
"nonce_str": "8aaee146b1dee7cec9100add9b96cbe2",
"out_trade_no": "1415757673",
"spbill_create_ip": "14.17.22.52",
"total_fee": "1",
"sign_type": " HMAC-SHA256",
"sign": "C29DB7DB1FD4136B84AE35604756362C"
}

View File

@@ -0,0 +1,21 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"device_info": "1000",
"nonce_str": "GOp3TRyMXzbMlkun",
"sign": "D6C76CB785F07992CDE05494BB7DF7FD",
"result_code": "SUCCESS",
"openid": "oUpF8uN95-Ptaags6E_roPHg7AG0",
"is_subscribe": "Y",
"trade_type": "MICROPAY",
"bank_type": "CCB_DEBIT",
"total_fee": "1",
"coupon_fee": "0",
"fee_type": "CNY",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"attach": "订单额外描述",
"time_end": "20141111170043"
}

View File

@@ -0,0 +1,16 @@
{
"deposit": "Y",
"appid": "wx2421b1c4370ec43b",
"attach": "订单额外描述",
"auth_code": "120269300684844649",
"body": "支付测试",
"device_info": "1000",
"mch_id": "10000100",
"sub_mch_id": "10000101",
"nonce_str": "8aaee146b1dee7cec9100add9b96cbe2",
"out_trade_no": "1415757673",
"spbill_create_ip": "14.17.22.52",
"total_fee": "1",
"sign_type": " HMAC-SHA256",
"sign": "C29DB7DB1FD4136B84AE35604756362C"
}

View File

@@ -0,0 +1,21 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"device_info": "1000",
"nonce_str": "GOp3TRyMXzbMlkun",
"sign": "D6C76CB785F07992CDE05494BB7DF7FD",
"result_code": "SUCCESS",
"openid": "oUpF8uN95-Ptaags6E_roPHg7AG0",
"is_subscribe": "Y",
"trade_type": "MICROPAY",
"bank_type": "CCB_DEBIT",
"total_fee": "1",
"coupon_fee": "0",
"fee_type": "CNY",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"attach": "订单额外描述",
"time_end": "20141111170043"
}

View File

@@ -0,0 +1,13 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "6cefdb308e1e2e8aabd48cf79e546a02",
"sub_mch_id": "1415701182",
"out_refund_no": "1415701182",
"out_trade_no": "1415757673",
"refund_fee": "1",
"total_fee": "1",
"transaction_id": "4006252001201705123297353072",
"sign": "FE56DD4AA85C0EECA82C35595A69E153",
"sign_type": " HMAC-SHA256"
}

View File

@@ -0,0 +1,14 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "NfsMFbUFpdbEhPXP",
"sign": "B7274EB9F8925EB93100DD2085FA56C0",
"result_code": "SUCCESS",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"refund_id": "2008450740201411110000174436",
"refund_fee": "1",
"coupon_refund_fee": "0"
}

View File

@@ -0,0 +1,16 @@
{
"appid": "wx2421b1c4370ec43b",
"attach": "支付测试",
"body": "JSAPI支付测试",
"mch_id": "10000100",
"detail": "{ \"goods_detail\":[ { \"goods_id\":\"iphone6s_16G\", \"wxpay_goods_id\":\"1001\", \"goods_name\":\"iPhone6s 16G\", \"quantity\":1, \"price\":528800, \"goods_category\":\"123456\", \"body\":\"苹果手机\" }, { \"goods_id\":\"iphone6s_32G\", \"wxpay_goods_id\":\"1002\", \"goods_name\":\"iPhone6s 32G\", \"quantity\":1, \"price\":608800, \"goods_category\":\"123789\", \"body\":\"苹果手机\" } ] }",
"nonce_str": "1add1a30ac87aa2db72f57a2375d8fec",
"notify_url": "http://wxpay.wxutil.com/pub_v2/pay/notify.v2.php",
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"out_trade_no": "1415659990",
"fee_type": "CNY",
"spbill_create_ip": "14.23.150.211",
"total_fee": "1",
"trade_type": "JSAPI",
"sign": "0CB01533B8C1EF103065174F50BCA001"
}

View File

@@ -0,0 +1,11 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "7921E432F65EB8ED0CE9755F0E86D72F",
"result_code": "SUCCESS",
"prepay_id": "wx201411101639507cbf6ffd8b0779950874",
"trade_type": "JSAPI"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "ec2316275641faa3aacf3cc599e8730f",
"transaction_id": "1008450740201411110005820873",
"sign_type": " HMAC-SHA256",
"sign": "FDD167FAA73459FD921B144BAF4F4CA2"
}

View File

@@ -0,0 +1,21 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"device_info": "1000",
"nonce_str": "TN55wO9Pba5yENl8",
"sign": "BDF0099C15FF7BC6B1585FBB110AB635",
"result_code": "SUCCESS",
"openid": "oUpF8uN95-Ptaags6E_roPHg7AG0",
"is_subscribe": "Y",
"trade_type": "MICROPAY",
"bank_type": "CCB_DEBIT",
"total_fee": "1",
"fee_type": "CNY",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"attach": "订单额外描述",
"time_end": "20141111170043",
"trade_state": "SUCCESS"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "0b9f35f484df17a732e537c37708d1d0",
"sub_mch_id": "1900000109",
"sign": "66FFB727015F450D167EF38CCC549521",
"sign_type": " HMAC-SHA256"
}

View File

@@ -0,0 +1,15 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "TeqClE3i0mvn3DrK",
"out_refund_no_0": "1415701182",
"out_trade_no": "1415757673",
"refund_count": "1",
"refund_fee_0": "1",
"refund_status_0": "PROCESSING",
"result_code": "SUCCESS",
"return_code": "SUCCESS",
"return_msg": "OK",
"sign": "1F2841558E233C33ABA71A961D27561C",
"transaction_id": "1008450740201411110005820873"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "b7ffb16a7150cf08639db472c5f5bdae",
"out_trade_no": "1415717424",
"sign_type": " HMAC-SHA256",
"sign": "9B2EA16C05A5CEF8E53B14D53932D012"
}

View File

@@ -0,0 +1,9 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "o5bAKF3o2ypC8hwa",
"sign": "6F5080EDDD196FFCDE53F786BBB93899",
"result_code": "SUCCESS"
}

View File

@@ -0,0 +1,6 @@
{
"mch_id": "123456",
"nonce_str": "5087e0xessefellkg",
"sign": "xxxxxx",
"sign_type": "MD5"
}

View File

@@ -0,0 +1,7 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"result_code": "SUCCESS",
"mch_id": "123456",
"pub_key": "-----BEGIN RSA PUBLIC KEY-----\nBASE64 ENCODED DATA\n-----END RSA PUBLIC KEY-----\n"
}

View File

@@ -0,0 +1,12 @@
{
"mch_id": "10000098",
"appid": "wxcbda96de0b165486",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"body": "水电代扣",
"out_trade_no": "217752501201407033233368018",
"total_fee": "888",
"spbill_create_ip": "8.8.8.8",
"notify_url": "http://yoursite.com/wxpay.html",
"contract_id": "Wx15463511252015071056489715"
}

View File

@@ -0,0 +1,9 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wxcbda96de0b165486",
"mch_id": "10000098",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"result_code": "SUCCESS"
}

View File

@@ -0,0 +1,9 @@
{
"mch_id": "10000098",
"appid": "wxcbda96de0b165486",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"plan_id": "12251",
"contract_code": "1234",
"contract_termination_remark": "原因",
"version": "1.0"
}

View File

@@ -0,0 +1,8 @@
{
"return_code": "SUCCESS",
"result_code": "SUCCESS",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"mch_id": "10010404",
"appid": "wxcbda96de0b165486",
"contract_id": "100005698"
}

View File

@@ -0,0 +1,7 @@
{
"sign": "019C869758CC7F258C42F05CDB9EE361",
"mch_id": "10000097",
"appid": "wxf5b5e87a6a0fde94",
"contract_id": "201509160000028648",
"version": "1.0"
}

View File

@@ -0,0 +1,21 @@
{
"return_code": " SUCCESS ",
"result_code": " SUCCESS ",
"mch_id": " 80000000 ",
"appid": " wx426b3015555b46be ",
"contract_id": "203",
"plan_id": "66",
"openid": " oHZx6uMbIG46UXQ3SKxVYEgw1LZs ",
"request_serial": "123",
"contract_code": " 1005 ",
"contract_display_account": " test ",
"contract_state": "1",
"contract_signed_time": "2015-07-01 10:00:00",
"contract_expired_time": "2015-07-01 10:00:00",
"contract_terminated_time": "2015-07-01 10:00:00",
"contract_termination_mode": "3",
"contract_termination_remark": " delete .... ",
"err_code": "0",
"err_code_des": " SUCCESS ",
"sign": " 8FC9DACB7DDF9B48333DCCC2224E0CAC "
}

View File

@@ -0,0 +1,21 @@
{
"appid": "wxcbda96de0b165486",
"mch_id": "1200009811",
"contract_mchid": "1200009811",
"contract_appid": "wxcbda96de0b165486",
"out_trade_no": "123456",
"device_info": "013467007045764",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"body": "Ipad mini 16G 白色",
"detail": "Ipad mini 16G 白色",
"notify_url": "https://weixin.qq.com",
"total_fee": "888",
"spbill_create_ip": "123.12.12.123",
"trade_type": "JSAPI",
"plan_id": "123",
"contract_code": "100001256",
"request_serial": "1000",
"contract_display_account": "微信代扣",
"contract_notify_url": "https://yoursite.com",
"sign": "C380BEC2BFD727A4B6845133519F3AD6"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"result_code": "SUCCESS",
"appid": "wxcbda96de0b165486",
"mch_id": "1200009811",
"prepay_id": "wx201410272009395522657a690389285100",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"trade_type": "JSAPI",
"code_url": "weixin//wxpay/s/An4baqw",
"plan_id": "123",
"out_trade_no": "123456"
}

View File

@@ -0,0 +1,13 @@
{
"appid": "wxcbda96de0b165486",
"mch_id": "1200009811",
"plan_id": "12535",
"contract_code": "100000",
"request_serial": "1000",
"contract_display_account": "微信代扣",
"notify_url": "https://weixin.qq.com",
"version": "1.0",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"timestamp": "1414488825",
"return_app": "Y"
}

View File

@@ -0,0 +1,10 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"result_code": "SUCCESS",
"appid": "wxcbda96de0b165486",
"mch_id": "10000098",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"pre_entrustweb_id": "5778aadY9nltAsZzXixCkFIGYnV2V"
}

View File

@@ -0,0 +1,14 @@
{
"mch_id": "10000098",
"appid": "wxcbda96de0b165486",
"sub_mch_id": "10010405",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"body": "水电代扣",
"out_trade_no": "217752501201407033233368018",
"total_fee": "888",
"trade_type": "PAP",
"spbill_create_ip": "8.8.8.8",
"notify_url": "http://yoursite.com/wxpay.html",
"contract_id": "Wx15463511252015071056489715"
}

View File

@@ -0,0 +1,10 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wxcbda96de0b165486",
"mch_id": "10000098",
"sub_mch_id": "10010405",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"result_code": "SUCCESS"
}

View File

@@ -0,0 +1,8 @@
{
"sign": "019C869758CC7F258C42F05CDB9EE361",
"mch_id": "10000097",
"sub_mch_id": "1900000109",
"appid": "wxf5b5e87a6a0fde94",
"contract_id": "201509160000028648",
"version": "1.0"
}

View File

@@ -0,0 +1,22 @@
{
"return_code": " SUCCESS ",
"result_code": " SUCCESS ",
"mch_id": " 80000000 ",
"appid": " wx426b3015555b46be ",
"sub_mch_id": " 10010405 ",
"contract_id": "203",
"plan_id": "66",
"openid": " oHZx6uMbIG46UXQ3SKxVYEgw1LZs ",
"request_serial": "123",
"contract_code": " 1005 ",
"contract_display_account": " test ",
"contract_state": "1",
"contract_signed_time": "2015-07-01 10:00:00",
"contract_expired_time": "2015-07-01 10:00:00",
"contract_terminated_time": "2015-07-01 10:00:00",
"contract_termination_mode": "3",
"contract_termination_remark": " delete .... ",
"err_code": "0",
"err_code_des": " SUCCESS ",
"sign": " 8FC9DACB7DDF9B48333DCCC2224E0CAC "
}

View File

@@ -0,0 +1,15 @@
{
"appid": "wxcbda96de0b165486",
"mch_id": "1200009811",
"sub_appid": "wxcbda96de0b165489",
"sub_mch_id": "1900000109",
"plan_id": "12535",
"contract_code": "100000",
"request_serial": "1000",
"contract_display_account": "微信代扣",
"notify_url": "https://weixin.qq.com",
"version": "1.0",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"timestamp": "1414488825",
"return_app": "Y"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"result_code": "SUCCESS",
"appid": "wxcbda96de0b165486",
"mch_id": "10000098",
"sub_appid": "wxcbda96de0b165489",
"sub_mch_id": "1900000109",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"pre_entrustweb_id": "5778aadY9nltAsZzXixCkFIGYnV2V"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "4ca93f17ddf3443ceabf72f26d64fe0e",
"out_trade_no": "1415983244",
"sign": "59FF1DF214B2D279A0EA7077C54DD95D"
}

View File

@@ -0,0 +1,11 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "BFK89FC6rxKCOjLX",
"sign": "72B321D92A7BFA0B2509F3D13C7B1631",
"result_code": "SUCCESS",
"result_msg": "OK"
}

View File

@@ -0,0 +1,12 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "10000109",
"nonce_str": "6cefdb308e1e2e8aabd48cf79e546a02",
"out_refund_no": "1415701182",
"out_trade_no": "1415757673",
"refund_fee": "1",
"total_fee": "1",
"transaction_id": "4006252001201705123297353072",
"sign": "FE56DD4AA85C0EECA82C35595A69E153"
}

View File

@@ -0,0 +1,15 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "10000101",
"nonce_str": "NfsMFbUFpdbEhPXP",
"sign": "B7274EB9F8925EB93100DD2085FA56C0",
"result_code": "SUCCESS",
"transaction_id": "4008450740201411110005820873",
"out_trade_no": "1415757673",
"out_refund_no": "1415701182",
"refund_id": "2008450740201411110000174436",
"refund_fee": "1"
}

View File

@@ -0,0 +1,16 @@
{
"appid": "wx2421b1c4370ec43b",
"attach": "支付测试",
"body": "JSAPI支付测试",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"detail": "{ \"goods_detail\":[ { \"goods_id\":\"iphone6s_16G\", \"wxpay_goods_id\":\"1001\", \"goods_name\":\"iPhone6s 16G\", \"quantity\":1, \"price\":528800, \"goods_category\":\"123456\", \"body\":\"苹果手机\" }, { \"goods_id\":\"iphone6s_32G\", \"wxpay_goods_id\":\"1002\", \"goods_name\":\"iPhone6s 32G\", \"quantity\":1, \"price\":608800, \"goods_category\":\"123789\", \"body\":\"苹果手机\" } ] }",
"nonce_str": "1add1a30ac87aa2db72f57a2375d8fec",
"notify_url": "https://wxpay.wxutil.com/pub_v2/pay/notify.v2.php",
"openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"out_trade_no": "1415659990",
"spbill_create_ip": "14.23.150.211",
"total_fee": "1",
"trade_type": "JSAPI",
"sign": "0CB01533B8C1EF103065174F50BCA001"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "7921E432F65EB8ED0CE9755F0E86D72F",
"result_code": "SUCCESS",
"prepay_id": "wx201411101639507cbf6ffd8b0779950874",
"trade_type": "JSAPI"
}

View File

@@ -0,0 +1,9 @@
{
"appid": "wx2421b1c4370ec43b",
"sub_appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "ec2316275641faa3aacf3cc599e8730f",
"transaction_id": "1008450740201411110005820873",
"sign": "FDD167FAA73459FD921B144BAF4F4CA2"
}

View File

@@ -0,0 +1,26 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"device_info": "1000",
"nonce_str": "TN55wO9Pba5yENl8",
"sign": "BDF0099C15FF7BC6B1585FBB110AB635",
"result_code": "SUCCESS",
"openid": "oUpF8uN95-Ptaags6E_roPHg7AG0",
"is_subscribe": "Y",
"trade_type": "MICROPAY",
"bank_type": "CCB_DEBIT",
"total_fee": "1",
"fee_type": "CNY",
"transaction_id": "1008450740201411110005820873",
"out_trade_no": "1415757673",
"attach": "订单额外描述",
"time_end": "20141111170043",
"trade_state": "SUCCESS",
"coupon_id_0": "10000",
"coupon_type_0": "CASH",
"coupon_fee_0": 100,
"detail": "{\"discount_detail\":[{\"goods_id\":\"iphone6s_16G\",\"goods_name\":\"iPhone6s 16G\",\"coupon_batch_id\":888,\"coupon_id\":666888,\"coupon_fee\":1000},{\"goods_id\":\"iphone6s_32G\",\"goods_name\":\"iPhone6s 32G\",\"coupon_batch_id\":999,\"coupon_id\":666999,\"coupon_fee\":1500}]}"
}

View File

@@ -0,0 +1,7 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "0b9f35f484df17a732e537c37708d1d0",
"out_trade_no": "1415757673",
"sign": "66FFB727015F450D167EF38CCC549521"
}

View File

@@ -0,0 +1,15 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"nonce_str": "TeqClE3i0mvn3DrK",
"out_refund_no_0": "1415701182",
"out_trade_no": "1415757673",
"refund_fee_0": "1",
"refund_id_0": "2008450740201411110000174436",
"refund_status_0": "PROCESSING",
"result_code": "SUCCESS",
"return_code": "SUCCESS",
"return_msg": "OK",
"sign": "1F2841558E233C33ABA71A961D27561C",
"transaction_id": "1008450740201411110005820873"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "4ca93f17ddf3443ceabf72f26d64fe0e",
"out_trade_no": "1415983244",
"sign": "59FF1DF214B2D279A0EA7077C54DD95D"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "1900000109",
"nonce_str": "BFK89FC6rxKCOjLX",
"sign": "72B321D92A7BFA0B2509F3D13C7B1631",
"result_code": "SUCCESS",
"result_msg": "OK",
"recall": "Y"
}

View File

@@ -0,0 +1,8 @@
{
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"mch_billno": "0010010404201411170000046545",
"mch_id": "10000097",
"appid": "wxe062425f740c30d8",
"bill_type": "MCHT",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e"
}

View File

@@ -0,0 +1,30 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"result_code": "SUCCESS",
"err_code": "SUCCESS",
"err_code_des": "OK",
"mch_billno": "9010080799701411170000046603",
"mch_id": "11475856",
"detail_id": "10000417012016080830956240040",
"status": "RECEIVED",
"send_type": "ACTIVITY",
"hb_type": "NORMAL",
"total_num": "1",
"total_amount": "100",
"send_time": "2016-08-08 21:49:22",
"hblist": {
"hbinfo": [
{
"openid": "oHkLxtzmyHXX6FW_cAWo_orTSRXs",
"amount": "100",
"rcv_time": "2016-08-08 21:49:46"
},
{
"openid": "oHkLxtzmyHXX6FW_cAWo_orTSRXs",
"amount": "100",
"rcv_time": "2016-08-08 21:49:46"
}
]
}
}

View File

@@ -0,0 +1,18 @@
{
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"mch_billno": "0010010404201411170000046545",
"mch_id": "1000888888",
"sub_mch_id": "1000888888",
"wxappid": "wxcbda96de0b165486",
"send_name": "send_name",
"re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI",
"total_amount": "600",
"amt_type": "ALL_RAND",
"total_num": "3",
"wishing": "恭喜发财",
"act_name": "新年红包",
"remark": "新年红包",
"scene_id": "PRODUCT_2",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e",
"risk_info": "posttime%3d123123412%26clientversion%3d234134%26mobile%3d122344545%26deviceid%3dIOS"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"return_msg": "发放成功.",
"result_code": "SUCCESS",
"err_code": "0",
"err_code_des": "发放成功.",
"mch_billno": "0010010404201411170000046545",
"mch_id": "10010404",
"wxappid": "wx6fa7e3bab7e15415",
"re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI",
"total_amount": "3"
}

View File

@@ -0,0 +1,15 @@
{
"act_name": "act_name",
"mch_billno": "2334580734271081478888000026",
"mch_id": "11475856",
"nonce_str": "1233213123123",
"notify_way": "MINI_PROGRAM_JSAPI",
"re_openid": "oeDV3t7xy1IkfYFzgOsCZvdRjb45",
"remark": "remark",
"send_name": "miniprogramtest",
"total_amount": "100",
"total_num": "1",
"wishing": "wishing",
"wxappid": "wxd27ebc41b85ce36d",
"sign": "b9dca63fe3f06bba49b6c4d6d2035b72"
}

View File

@@ -0,0 +1,14 @@
{
"return_code": "SUCCESS",
"return_msg": "发放成功",
"result_code": "SUCCESS",
"err_code": "SUCCESS",
"err_code_des": "发放成功",
"mch_billno": "2334580734271081478888000026",
"mch_id": "11475856",
"wxappid": "wxd27ebc41b85ce36d",
"re_openid": "oeDV3t7xy1IkfYFzgOsCZvdRzx3U",
"total_amount": "10",
"send_listid": "1000041701201609263000000204000",
"package": "sendid=242e8abd163d300019b2cae74ba8e8c06e3f0e51ab84d16b3c80decd22a5b672&ver=8&sign=4110d649a5aef52dd6b95654ddf91ca7d5411ac159ace4e1a766b7d3967a1c3dfe1d256811445a4abda2d9cfa4a9b377a829258bd00d90313c6c346f2349fe5d&mchid=11475856&appid=wxd27ebc41b85ce36d"
}

View File

@@ -0,0 +1,17 @@
{
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"mch_billno": "0010010404201411170000046545",
"mch_id": "888",
"wxappid": "wxcbda96de0b165486",
"send_name": "send_name",
"re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI",
"total_amount": "200",
"total_num": "1",
"wishing": "恭喜发财",
"client_ip": "127.0.0.1",
"act_name": "新年红包",
"remark": "新年红包",
"scene_id": "PRODUCT_2",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e",
"risk_info": "posttime%3d123123412%26clientversion%3d234134%26mobile%3d122344545%26deviceid%3dIOS"
}

View File

@@ -0,0 +1,12 @@
{
"return_code": "SUCCESS",
"return_msg": "发放成功.",
"result_code": "SUCCESS",
"err_code": "0",
"err_code_des": "发放成功.",
"mch_billno": "0010010404201411170000046545",
"mch_id": "10010404",
"wxappid": "wx6fa7e3bab7e15415",
"re_openid": "onqOjjmM1tad-3ROpncN-yUfa6uI",
"total_amount": "1"
}

View File

@@ -0,0 +1,13 @@
{
"mch_appid": "wxe062425f740c30d8",
"mchid": "10000098",
"nonce_str": "3PG2J4ILTKCH16CQ2502SI8ZNMTM67VS",
"partner_trade_no": "100000982014120919616",
"openid": "ohO4Gt7wVPxIT1A9GjFaMYMiZY1s",
"check_name": "FORCE_CHECK",
"re_user_name": "张三",
"amount": "100",
"desc": "节日快乐!",
"spbill_create_ip": "10.2.3.10",
"sign": "C97BDBACF37622775366F38B629F45E3"
}

View File

@@ -0,0 +1,10 @@
{
"return_code": "SUCCESS",
"mch_appid": "wxec38b8ff840bd989",
"mchid": "10013274",
"nonce_str": "lxuDzMnRjpcXzxLx0q",
"result_code": "SUCCESS",
"partner_trade_no": "10013574201505191526582441",
"payment_no": "1000018301201505190181489473",
"payment_time": "2015-05-19 15:26:59"
}

View File

@@ -0,0 +1,7 @@
{
"sign": "E1EE61A91C8E90F299DE6AE075D60A2D",
"partner_trade_no": "0010010404201411170000046545",
"mch_id": "10000097",
"appid": "wxe062425f740c30d8",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e"
}

View File

@@ -0,0 +1,15 @@
{
"return_code": "SUCCESS",
"return_msg": "获取成功",
"result_code": "SUCCESS",
"mch_id": "10000098",
"appid": "wxe062425f740c30d8",
"detail_id": "1000000000201503283103439304",
"partner_trade_no": "1000005901201407261446939628",
"status": "SUCCESS",
"payment_amount": "650",
"openid": "oxTWIuGaIt6gTKsQRLau2M0yL16E",
"transfer_time": "2015-04-21 20:00:00",
"transfer_name": "测试",
"desc": "福利测试"
}

View File

@@ -0,0 +1,11 @@
{
"amount": "500",
"bank_code": "1002",
"desc": "test",
"enc_bank_no": "so40iz98I8P5DRdMpOqYK/SOWdDhW8fQhlCQEuxV//LLvRZs51B4z8yeIe3X7aYyRdJGdYy18RLpJAZEYrZ9y981pB55aU9ZqT1So7Ypc1URahkLAOggUk/nKur750Lei6D0QQ1Q/B1aiYHA+IPwZH1YEjsIra9tvY7LjYgBjUsEnWx51piaL/Bv4gLvK5lo+lT7iTT2eiLD95y7PcV9U5p5zAxRMPiy6dtJt1UYfwNnbHMZbP+hdTmUhBup2JpJbk+9xchWzrwrFUQPYpB4caTOx98xubwrKrOO/xM2lt9GbRsv1GA5vF04jIiWx/dtkjQvWuPlBOTmkSDl6J0ErQ==",
"enc_true_name": "WrmNNBewyx8KJGMtrsYUf3RAmMsaHByOIu/wSjFKy/ouMeg1msRxbwzksPDRjI7OA6pvb3Ty7RQKQTGAjFdaxa10c9Dn0BqLPapP1svj000TWRd1VRJriUqy0macXZu6Pxx9bZd9ngiUcXbrVpGA10BMMwOFJ5VEt7aFJjUJSw2CCZNgj1HOVskm3abNl1eMWyzDCHVjH6uXnT8of17g5GTELTNn2ccNMTmfkUrVJopHeXTA5Yd+uKx5Tgst4IonNiHb+dFWsiGG8aOY29nqHWHw3e+vVRk/0DwEAJzaJlWjb110/TtjYjkquZwFh9XL8GncrNfoBjUz2rtvmhb5Rg==",
"mch_id": "2302758702",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e",
"partner_trade_no": "1212121221278",
"sign": "1b3375482ac61d952aab56b534608971"
}

View File

@@ -0,0 +1,13 @@
{
"return_code": "SUCCESS",
"return_msg": "支付成功",
"result_code": "SUCCESS",
"err_code": "SUCCESS",
"err_code_des": "微信侧受理成功",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e",
"mch_id": "2302758702",
"partner_trade_no": "1212121221278",
"amount": "500",
"payment_no": "10000600500852017030900000020006012",
"cmms_amt": "0"
}

View File

@@ -0,0 +1,6 @@
{
"mch_id": "2302758702",
"nonce_str": "50780e0cca98c8c8e814883e5caa672e",
"partner_trade_no": "1212121221278",
"sign": "34bf02fe5b20f117365ef6f5d0436be1"
}

View File

@@ -0,0 +1,16 @@
{
"return_code": "SUCCESS",
"return_msg": "ok",
"result_code": "SUCCESS",
"err_code": "SUCCESS",
"err_code_des": "ok",
"mch_id": "2302758702",
"partner_trade_no": "1212121221278",
"payment_no": "10000600500852017030900000020006012",
"bank_no_md5": "2260AB5EF3D290E28EFD3F74FF7A29A0",
"true_name_md5": "7F25B325D37790764ABA55DAD8D09B76",
"amount": "500",
"status": "处理中",
"cmms_amt": "0",
"create_time": "2017-03-09 15:04:04"
}

View File

@@ -0,0 +1,8 @@
{
"mch_id": "123456",
"nonce_str": "5087e0xessefellkg",
"sign": "xxxxxx",
"sign_type": "HMAC-SHA256",
"begin_time": "2017-07-02 0:0:0",
"end_time": "2017-07-29 23:59:59"
}

View File

@@ -0,0 +1,5 @@
{
"return_code": "FAIL",
"return_msg": "INVALID_REQUEST",
"violation_records": "{\"total_size\":1,\"violation_records\":[{\"company_name\":\"ABC公司\",\"handle_method\":\"刷单欺诈,整改 限期 2天\",\"handle_state\":\"超时未处理\",\"illegal_type\":\"其他\",\"punish_time\":\"2018-07-24 20:12:25\",\"sub_mch_id\":\"1900012891\"}]}"
}

View File

@@ -0,0 +1,8 @@
{
"appid": "wx931386123456789e",
"mch_id": "1451234567",
"sub_mch_id": "10000101",
"sub_appid": "wx931386123456789e",
"jsapi_path": "http://www.qq.com/wechat/",
"sign": "C380BEC2BFD727A4B6845133519F3AD6"
}

View File

@@ -0,0 +1,8 @@
{
"return_code": "SUCCESS",
"return_msg": "签名失败",
"result_code": "FAIL",
"sign": "C380BEC2BFD727A4B6845133519F3AD6",
"err_code": "INVALID_REQUEST",
"err_code_des": "子商户号信息有误,请检查修改后重试"
}

View File

@@ -0,0 +1,6 @@
{
"appid": "wx931386123456789e",
"mch_id": "1451234567",
"sub_mch_id": "10000101",
"sign": "C380BEC2BFD727A4B6845133519F3AD6"
}

View File

@@ -0,0 +1,6 @@
{
"return_code": "SUCCESS",
"return_msg": "签名失败",
"jsapi_path_list": "{\"jsapi_path_list\":[\"http://www.qq.com/abcd/\",\"http://www.qq.com/abcdedfg/\"]}",
"appid_config_list": "{\"appid_config_list\":[{\"subscribe_appid\":\"wxa9d9651ae82ec4b9\",\"sub_appid\":null},{\"subscribe_appid\":\"wxa9d9651ae82ec4b9\",\"sub_appid\":\"wxa9d9651ae82ec4b9\"}]}"
}

View File

@@ -0,0 +1,16 @@
{
"mch_id": "10000098",
"sub_mch_id": "10000100",
"appid": "wxcbda96de0b165486",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"sign_type": "HMAC-SHA256",
"sign": " EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5",
"body": "公交代扣",
"out_trade_no": "217752501201407033233368018",
"total_fee": "888",
"spbill_create_ip": "8.8.8.8",
"notify_url": "http://yoursite.com/wxpay.html",
"version": "3.0",
"trade_scene": " PARKING",
"scene_info": "{\"scene_info\":{\"start_time\":\"20170926114339\",\"end_time\":\"20170826114339\",\"charging_time\":\"3600\",\"free_time\":\"1200\",\"plate_number\":\"CB1000sdfasd\",\"car_type\":\"大型车\",\"parking_name\":\"欢乐海岸停车场\"}}"
}

View File

@@ -0,0 +1,10 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wxcbda96de0b165486",
"mch_id": "10000098",
"sub_mch_id": "10000100",
"nonce_str": "IITRi8Iabbblz1Jc",
"sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5",
"result_code": "SUCCESS"
}

View File

@@ -0,0 +1,11 @@
{
"mch_id": "100000981",
"sub_mch_id": "10000100",
"appid": "wxcbda96de0b165486",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"sign_type": "HMAC-SHA256",
"trade_scene": "PARKING",
"sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5",
"openid": " oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"plate_number": "粤A00000"
}

View File

@@ -0,0 +1,11 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "10000100",
"nonce_str": "ec2316275641faa3aacf3cc599e8730f",
"user_state": "NORMAL",
"result_code": "SUCCESS",
"sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5"
}

View File

@@ -0,0 +1,10 @@
{
"mch_id": "100000981",
"sub_mch_id": "10000100",
"appid": "wxcbda96de0b165486",
"nonce_str": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"sign_type": "HMAC-SHA256",
"trade_scene": "PARKING",
"sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5",
"scene_info": "{\"scene_info\":{\"start_time\":\"20170926114339\",\"plate_number\":\"CB1000sdfasd\",\"car_type\":\"大型车\",\"parking_name\":\"欢乐海岸停车场\",\"free_time\":\"1200\"}}"
}

View File

@@ -0,0 +1,11 @@
{
"return_code": "SUCCESS",
"return_msg": "OK",
"appid": "wx2421b1c4370ec43b",
"mch_id": "10000100",
"sub_mch_id": "10000100",
"nonce_str": "ec2316275641faa3aacf3cc599e8730f",
"user_state": "NORMAL",
"result_code": "SUCCESS",
"sign": "EE088059BBC9141264F8D14293AD6C4BB94CEA8C08AA98FBF93E262D445F8FF5"
}

View File

@@ -18,7 +18,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="ModelSamples/**/*.json" />
<Content Include="ModelSamples/**/*.json" />
<Content Include="EventSamples/**/*.json" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,21 @@
using System;
using System.Text;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
{
public class TestCase_AESUtilityTests
{
[Fact(DisplayName = "测试用例AES-ECB 解密")]
public void TestAESGCMDecrypt()
{
string key = "01234567890abcdefedcba9876543210";
string cipherText = "l/aL5GyVfl/tw3Lww6GvCQ==";
string actualPlain = Utilities.AESUtility.DecryptWithECB(encodingKey: Convert.ToBase64String(Encoding.UTF8.GetBytes(key)), encodingCipherText: cipherText);
string expectedPlain = "SKIT is great!";
Assert.Equal(expectedPlain, actualPlain);
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Threading.Tasks;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
{
public class TestCase_ApiExecuteExecutePayTransactionsTests
{
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")]
public async Task TestCase_ApiExecuteExecutePayTests()
{
var request = new Models.CreatePayMicroPayRequest()
{
OutTradeNumber = "TEST_OTN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
Body = "TEST_BODY",
TotalFee = 1,
ClientIp = "127.0.0.7",
AuthCode = "TEST_AUTH_CODE"
};
var response = await TestClients.Instance.ExecuteCreatePayMicroPayAsync(request);
Assert.NotNull(response.ReturnCode);
Assert.NotNull(response.ReturnMessage);
Assert.NotNull(response.TransactionId);
}
}
}

View File

@@ -31,6 +31,18 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
Assert.Null(ex);
}
[Fact(DisplayName = "代码评审:分析 API 事件定义")]
public void ApiEventsDefinitionTest()
{
string workdir = Path.Combine(TestConfigs.ProjectTestDirectory, "EventSamples");
CodeStyleUtil.VerifyApiEventsDefinition(SourceAssembly, workdir, out var ex);
if (ex != null)
throw ex;
Assert.Null(ex);
}
[Fact(DisplayName = "代码评审:分析 API 接口命名")]
public void TestApiExtensionsNaming()
{

View File

@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
{
public class TestCase_EventVerificationTests
{
[Fact(DisplayName = "测试用例:验证回调通知签名")]
public void TestVerifyEventSignature()
{
string callbackXml = "<xml><appid>wxd930ea5d5a258f4f</appid><mch_id>10000100</mch_id><device_info>1000</device_info><body>test</body><nonce_str>ibuaiVcKdpRxkhJA</nonce_str><sign>9A0A8659F005D6984697E2CA0A9CF3B7</sign></xml>";
string merchantId = "10000100";
string merchantSecret = "192006250b4c09247ec02edce69f6a2d";
var client = new WechatTenpayClient(merchantId, merchantSecret);
Assert.True(client.VerifyEventSignature(callbackXml));
}
}
}

View File

@@ -34,8 +34,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
Assert.Equal("ERR_CODE_DESC", parsedObjBySystemTextJson.ErrorCodeDescription);
Assert.Equal("TRANSACTION_ID", parsedObjByNewtonsoftJson.TransactionId);
Assert.Equal("TRANSACTION_ID", parsedObjBySystemTextJson.TransactionId);
Assert.Equal(2, parsedObjByNewtonsoftJson.RecordCount);
Assert.Equal(2, parsedObjBySystemTextJson.RecordCount);
Assert.Equal(2, parsedObjByNewtonsoftJson.TotalRecordCount);
Assert.Equal(2, parsedObjBySystemTextJson.TotalRecordCount);
Assert.Equal("SUB_ORDER_NO_0", parsedObjByNewtonsoftJson.RecordList[0].SubOrderNumber);
Assert.Equal("SUB_ORDER_NO_0", parsedObjBySystemTextJson.RecordList[0].SubOrderNumber);
Assert.Equal("SUB_ORDER_ID_0", parsedObjByNewtonsoftJson.RecordList[0].SubOrderId);
@@ -68,14 +68,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
string unparsedJsonByNewtonsoftJson = newtonsoftJsonSerializer.Serialize(parsedObjByNewtonsoftJson);
string unparsedJsonBySystemTextJson = systemTextJsonSerializer.Serialize(parsedObjByNewtonsoftJson);
Assert.Null(Record.Exception(() => Newtonsoft.Json.JsonConvert.DeserializeObject(unparsedJsonByNewtonsoftJson)));
Assert.Null(Record.Exception(() => System.Text.Json.JsonDocument.Parse(unparsedJsonBySystemTextJson)));
Assert.Contains("return_code", unparsedJsonByNewtonsoftJson);
Assert.Contains("return_code", unparsedJsonBySystemTextJson);
Assert.Contains("RETURN_CODE", unparsedJsonByNewtonsoftJson);
Assert.Contains("RETURN_CODE", unparsedJsonBySystemTextJson);
Assert.Contains("return_msg", unparsedJsonByNewtonsoftJson);
Assert.Contains("return_msg", unparsedJsonBySystemTextJson);
Assert.Contains("RETURN_MSG", unparsedJsonByNewtonsoftJson);
Assert.Contains("RETURN_MSG", unparsedJsonBySystemTextJson);
Assert.Contains("sub_order_no_0", unparsedJsonByNewtonsoftJson);
Assert.Contains("sub_order_no_0", unparsedJsonBySystemTextJson);
Assert.Contains("SUB_ORDER_NO_0", unparsedJsonByNewtonsoftJson);
Assert.Contains("SUB_ORDER_NO_0", unparsedJsonBySystemTextJson);
Assert.Contains("sub_order_id_0", unparsedJsonByNewtonsoftJson);
Assert.Contains("sub_order_id_0", unparsedJsonBySystemTextJson);
Assert.Contains("SUB_ORDER_ID_0", unparsedJsonByNewtonsoftJson);
Assert.Contains("SUB_ORDER_ID_0", unparsedJsonBySystemTextJson);
Assert.DoesNotContain("#n", unparsedJsonByNewtonsoftJson);
Assert.DoesNotContain("#n", unparsedJsonBySystemTextJson);
Assert.DoesNotContain("$n", unparsedJsonByNewtonsoftJson);

View File

@@ -0,0 +1,49 @@
using System.Net.Http;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
{
public class TestCase_RequestSignTests
{
internal class InnerFakeRequest : WechatTenpaySignableRequest
{
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public override string? AppId { get; set; }
[Newtonsoft.Json.JsonProperty("mch_id")]
[System.Text.Json.Serialization.JsonPropertyName("mch_id")]
public override string? MerchantId { get; set; }
[Newtonsoft.Json.JsonProperty("device_info")]
[System.Text.Json.Serialization.JsonPropertyName("device_info")]
public string? DeviceInfo { get; set; }
[Newtonsoft.Json.JsonProperty("body")]
[System.Text.Json.Serialization.JsonPropertyName("body")]
public string? Body { get; set; }
}
[Fact(DisplayName = "测试用例:生成请求签名")]
public void TestRequestSign()
{
const string MCHID = "10000100";
const string MCHKEY = "192006250b4c09247ec02edce69f6a2d";
var request = new InnerFakeRequest()
{
AppId = "wxd930ea5d5a258f4f",
MerchantId = MCHID,
DeviceInfo = "1000",
Body = "test",
NonceString = "ibuaiVcKdpRxkhJA"
};
var client = new WechatTenpayClient(MCHID, MCHKEY);
client.CreateRequest(request, HttpMethod.Post);
string actualSign = "9A0A8659F005D6984697E2CA0A9CF3B7";
string expectedSign = request.Signature!;
Assert.Equal(actualSign, expectedSign);
}
}
}

View File

@@ -7,7 +7,8 @@
Instance = new WechatTenpayClient(new WechatTenpayClientOptions()
{
MerchantId = TestConfigs.WechatMerchantId,
MerchantSecret = TestConfigs.WechatMerchantSecret
MerchantSecret = TestConfigs.WechatMerchantSecret,
AppId = TestConfigs.WechatAppId
});
}

View File

@@ -1,8 +1,8 @@
{
"TestConfig": {
"AppId": "wxd861802f8e303335",
"MerchantId": "1601103314",
"MerchantSecret": "f09b03a7a1902b5b4913856f1fd07ab1",
"AppId": "wxd861802f8e303335",
"OpenId": "owNIE0msADfoPjhpy2cz1qL4vImw"
},
"ProjectSourceDirectory": "D:\\Projects\\_SKIT\\stack-dotnet\\DotNetCore.SKIT.FlurlHttpClient.Wechat\\src\\SKIT.FlurlHttpClient.Wechat.TenpayV2",

View File

@@ -0,0 +1,8 @@
{
"mchid": "1230000109",
"appid": "wxd678efh567hg6787",
"estimated_amount": {
"amount": 1,
"currency": "CNY"
}
}

View File

@@ -0,0 +1,10 @@
{
"sp_appid": "wxd678efh567hg6787",
"sp_mchid": "1230000109",
"estimated_amount": {
"amount": 1,
"currency": "CNY"
},
"sub_mchid": "12345512",
"sub_appid": "wxd678efh567hg6787"
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
@@ -154,14 +155,13 @@ namespace SKIT.FlurlHttpClient.Wechat
var lstModelType = TestReflectionUtil.GetAllApiModelsTypes(assembly);
var lstError = new List<Exception>();
foreach (Type modelType in lstModelType)
Parallel.ForEach(lstModelType, (modelType) =>
{
string name = modelType.Name.Split('`')[0];
if (!name.EndsWith("Request") && !name.EndsWith("Response"))
{
lstError.Add(new Exception($"[模型] `{name}` 类名结尾应为 \"Request\" 或 \"Response\"。"));
continue;
}
if (name.EndsWith("Request"))
@@ -169,13 +169,11 @@ namespace SKIT.FlurlHttpClient.Wechat
if (!typeof(ICommonRequest).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"[模型] `{name}` 是请求模型,需实现自 `{nameof(ICommonRequest)}`。"));
continue;
}
if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Request".Length)}Response"))
{
lstError.Add(new Exception($"[模型] `{name}` 是请求模型,但不存在对应的响应模型。"));
continue;
}
}
@@ -184,16 +182,14 @@ namespace SKIT.FlurlHttpClient.Wechat
if (!typeof(ICommonResponse).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"[模型] `{name}` 是响应模型,需实现自 `{nameof(ICommonResponse)}`。"));
continue;
}
if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Response".Length)}Request"))
{
lstError.Add(new Exception($"[模型] `{name}` 是响应模型,但不存在对应的请求模型。"));
continue;
}
}
}
});
if (lstError.Any())
{
@@ -221,7 +217,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。"));
}
foreach (string filePath in lstFilePath)
Parallel.ForEach(lstFilePath, (filePath) =>
{
string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0];
@@ -229,7 +225,7 @@ namespace SKIT.FlurlHttpClient.Wechat
if (type == null)
{
lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。"));
continue;
return;
}
if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase))
@@ -240,7 +236,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(ex);
}
}
}
});
if (lstError.Any())
{
@@ -271,7 +267,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。"));
}
foreach (string filePath in lstFilePath)
Parallel.ForEach(lstFilePath, (filePath) =>
{
string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0];
@@ -279,7 +275,7 @@ namespace SKIT.FlurlHttpClient.Wechat
if (type == null)
{
lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。"));
continue;
return;
}
if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase))
@@ -300,7 +296,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(ex);
}
}
}
});
if (lstError.Any())
{
@@ -319,7 +315,7 @@ namespace SKIT.FlurlHttpClient.Wechat
var lstExtType = TestReflectionUtil.GetAllApiExtensionsTypes(assembly);
var lstError = new List<Exception>();
foreach (Type extensionsType in lstExtType)
Parallel.ForEach(lstExtType, (extensionsType) =>
{
MethodInfo[] lstMethod = extensionsType.GetMethods()
.Where(e =>
@@ -372,7 +368,7 @@ namespace SKIT.FlurlHttpClient.Wechat
continue;
}
}
}
});
if (lstError.Any())
{
@@ -406,7 +402,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[风格] \"{workdir}\" 下不存在源代码文件,请检查配置的扫描路径是否正确。"));
}
foreach (string extCodeFilePath in lstExtensionsCodeFile)
Parallel.ForEach(lstExtensionsCodeFile, (extCodeFilePath) =>
{
string extCodeFileName = Path.GetFileName(extCodeFilePath);
@@ -676,7 +672,7 @@ namespace SKIT.FlurlHttpClient.Wechat
}
}
}
}
});
if (lstError.Any())
{