UmfApiTest.php 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408
  1. <?php
  2. namespace LdzfPay\UmfPayService;
  3. class UmfApiTest {
  4. //------------------------------------------------------------
  5. // Web收银台
  6. //------------------------------------------------------------
  7. /**
  8. * Web收银台—生成get后的请求参数,商户只需要拼接URL进行get请求即可
  9. */
  10. public function test_WebFrontPagePayMap(){
  11. $params = array(
  12. "mer_id"=>"60016102",
  13. "ret_url"=>"http://www.xxx.com/xxxx.php",
  14. "notify_url"=>"http://www.xxx.com/xxxx.php",
  15. "goods_inf"=>"商品描述",
  16. "order_id"=>rand(0,999999999),
  17. "mer_date"=>date ( "Ymd" ),
  18. "amount"=>"1",
  19. "interface_type"=>"01",
  20. );
  21. $service = new UmfService("60016102","D:/60016102_.key.pem");
  22. $web_pay_get_url = $service->WebFrontPagePayMap($params);
  23. var_dump($web_pay_get_url);
  24. }
  25. //------------------------------------------------------------
  26. // H5收银台
  27. //------------------------------------------------------------
  28. /**
  29. * H5收银台—生成get后的请求参数,商户只需要拼接URL进行get请求即可
  30. */
  31. public function test_H5FrontPageMap(){
  32. $params = array(
  33. "mer_id"=>"60000100",
  34. "ret_url"=>"recharge://return",
  35. "notify_url"=>"http://www.xxx.com/xxxx.php",
  36. "goods_inf"=>"商品描述",
  37. "order_id"=>rand(0,999999999),
  38. "mer_date"=>date ( "Ymd" ),
  39. "amount"=>"1",
  40. );
  41. $service = new UmfService("60000100","D:/60000100_.key.pem");
  42. $h5_pay_get_url = $service->H5FrontPageMap($params);
  43. var_dump($h5_pay_get_url);
  44. }
  45. //------------------------------------------------------------
  46. // 公众号支付
  47. //------------------------------------------------------------
  48. /**
  49. * 公众号支付–生成get后的请求参数,商户只需要拼接URL进行get请求即可
  50. */
  51. public function test_PublicPaymentMap(){
  52. $params = array(
  53. "mer_id"=>"60000100",
  54. "notify_url"=>"http://www.xxx.com/xxxx.php",
  55. "goods_inf"=>"商品描述",
  56. "order_id"=>rand(0,999999999),
  57. "mer_date"=>date ( "Ymd" ),
  58. "amount"=>"1",
  59. "is_public_number"=>"Y",
  60. );
  61. $service = new UmfService("60000100","D:/60000100_.key.pem");
  62. $wechat_pay_get_url = $service->PublicPaymentMap($params);
  63. var_dump($wechat_pay_get_url);
  64. }
  65. //------------------------------------------------------------
  66. // 收款 : 网银直连
  67. //------------------------------------------------------------
  68. public function test_pBankDirectMap(){
  69. $params = array(
  70. "mer_id"=>"60000100",
  71. "mer_date"=>date ( "Ymd" ),
  72. "order_id"=>rand(0,999999999),
  73. "amount"=>"1",
  74. "pay_type"=>"B2BBANK",
  75. "gate_id"=>"CCB",
  76. "interface_type"=>"02"
  77. );
  78. $service = new UmfService("60000100","D:/60000100_.key.pem");
  79. $pbank_direct_get_url = $service->pBankDirectMap($params);
  80. var_dump($pbank_direct_get_url);
  81. }
  82. //------------------------------------------------------------
  83. // 收款 : 借记卡直连
  84. //------------------------------------------------------------
  85. public function test_debitDirectMap(){
  86. $params = array(
  87. "mer_id"=>"60000100",
  88. "mer_date"=>date ( "Ymd" ),
  89. "order_id"=>rand(0,999999999),
  90. "amount"=>"1",
  91. "card_id"=>"xxxxxxxxxxx",
  92. "identity_type"=>"1",
  93. "identity_code"=>"xxxxxxxxxxx",
  94. "card_holder"=>"张三",
  95. );
  96. $service = new UmfService("60000100","D:/60000100_.key.pem");
  97. $res = $service->debitDirectMap($params);
  98. var_dump($res);
  99. }
  100. //------------------------------------------------------------
  101. // 收款 : 信用卡直连
  102. //------------------------------------------------------------
  103. public function test_creditDirectMap(){
  104. $params = array(
  105. "mer_id"=>"60000100",
  106. "mer_date"=>date ( "Ymd" ),
  107. "order_id"=>rand(0,999999999),
  108. "amount"=>"1",
  109. "valid_date"=>"2504",
  110. "card_id"=>"6253360104124044",
  111. "cvv2"=>"188",
  112. );
  113. $service = new UmfService("60000100","D:/60000100_.key.pem");
  114. $res = $service->creditDirectMap($params);
  115. var_dump($res);
  116. }
  117. //------------------------------------------------------------
  118. // 收款 : 扫码支付
  119. //------------------------------------------------------------
  120. /**
  121. * 主扫支付
  122. */
  123. public function test_activeScanPaymentMap(){
  124. $params = array(
  125. "mer_id"=>"60038402",
  126. "ret_url"=>"http://www.xxx.com/xxxx.php",
  127. "notify_url"=>"http://www.xxx.com/xxxx.php",
  128. "goods_id"=>"",
  129. "goods_inf"=>"商品描述",
  130. "order_id"=>rand(0,999999999),
  131. "mer_date"=>date ( "Ymd" ),
  132. "amount"=>"1",
  133. "scancode_type"=>"WECHAT",
  134. "mer_priv"=>"",
  135. "expand"=>"",
  136. "user_ip"=>"",
  137. "expire_time"=>"",
  138. );
  139. $service = new UmfService("60038402","D:/60038402_.key.pem");
  140. // $service = new UmfService("60000100","D:/60000100_.key.pem");
  141. $res = $service->activeScanPaymentMap($params);
  142. var_dump($res);
  143. }
  144. /**
  145. * 主扫支付(新)
  146. */
  147. public function test_activeNewScanPaymentMap(){
  148. $params = array(
  149. "mer_id"=>"60038402",
  150. "ret_url"=>"http://www.xxx.com/xxxx.php",
  151. "notify_url"=>"http://www.xxx.com/xxxx.php",
  152. "goods_id"=>"",
  153. "goods_inf"=>"商品描述",
  154. "order_id"=>rand(0,999999999),
  155. "mer_date"=>date ( "Ymd" ),
  156. "amount"=>"1",
  157. "scancode_type"=>"WECHAT",
  158. "mer_priv"=>"",
  159. "expand"=>"",
  160. "user_ip"=>"",
  161. "expire_time"=>"",
  162. );
  163. //$service = new UmfService("60016102","D:/60016102_.key.pem");
  164. $service = new UmfService("60000100","D:/60000100_.key.pem");
  165. $res = $service->activeNewScanPaymentMap($params);
  166. var_dump($res);
  167. }
  168. /**
  169. * H5直连-范围URL地址
  170. */
  171. public function test_H5AutoConnectMap(){
  172. $params = array(
  173. "mer_id"=>"60000100",
  174. "ret_url"=>"http://www.xxx.com/xxxx.php",
  175. "notify_url"=>"http://www.xxx.com/xxxx.php",
  176. "goods_inf"=>"商品描述",
  177. "order_id"=>"123456789",
  178. "mer_date"=>date ("Ymd"),
  179. "amount"=>"1",
  180. "scancode_type"=>"ALIPAY",
  181. );
  182. $service = new UmfService("60000100","D:/60000100_.key.pem");
  183. $h5_auto_connect_url = $service->H5AutoConnectMap($params);
  184. var_dump($h5_auto_connect_url);
  185. }
  186. /**
  187. * H5直连-返回请求参数
  188. */
  189. public function test_H5ConnectMap(){
  190. $params = array(
  191. "mer_id"=>"60000100",
  192. "ret_url"=>"http://www.xxx.com/xxxx.php",
  193. "notify_url"=>"http://www.xxx.com/xxxx.php",
  194. "goods_inf"=>"商品描述",
  195. "order_id"=>"123456789",
  196. "mer_date"=>date ("Ymd"),
  197. "amount"=>"1",
  198. "scancode_type"=>"ALIPAY",
  199. );
  200. $service = new UmfService("60000100","D:/60000100_.key.pem");
  201. $res = $service->H5ConnectMap($params);
  202. var_dump($res);
  203. }
  204. /**
  205. * 被扫支付
  206. */
  207. public function test_passiveScanPaymentMap(){
  208. $params = array(
  209. "mer_id"=>"60000100",
  210. "ret_url"=>"http://www.xxx.com/xxxx.php",
  211. "notify_url"=>"http://www.xxx.com/xxxx.php",
  212. "goods_id"=>"",
  213. "goods_inf"=>"商品描述",
  214. "order_id"=>rand(0,999999999),
  215. "mer_date"=>date ( "Ymd" ),
  216. "amount"=>"1",
  217. "scancode_type"=>"WECHAT",
  218. "auth_code"=>'135036529140563496',//微信付款二维码
  219. //"scancode_type"=>"ALIPAY",
  220. //"auth_code"=>'288747129231022246',//支付宝付款二维码,目前(20170913)支付宝支持银行卡支付,花呗的付款二维码不能付款
  221. "use_desc"=>"测试",
  222. "mer_priv"=>"",
  223. "expand"=>"",
  224. "user_ip"=>"",
  225. "expire_time"=>"",
  226. );
  227. $service = new UmfService("60000100","D:/60000100_.key.pem");
  228. $res = $service->passiveScanPaymentMap($params);
  229. var_dump($res);
  230. }
  231. //------------------------------------------------------------
  232. // 收款 : 快捷支付
  233. //------------------------------------------------------------
  234. /**
  235. * 收款---快捷支付下单方法
  236. */
  237. public function test_quickPayOrderMap(){
  238. $params = array(
  239. "mer_id"=>"60000100",
  240. "ret_url"=>"http://www.xxx.com/xxxx.php",
  241. "notify_url"=>"http://www.xxx.com/xxxx.php",
  242. "order_id"=>rand(0,999999999), // 707794189
  243. "mer_date"=>date ( "Ymd" ),
  244. "amount"=>"1",
  245. "mer_cust_id"=> "",//"200000000020",
  246. "pay_type"=>"CREDITCARD", //信用卡 //"DEBITCARD",//借记卡
  247. "gate_id"=>"ABC", //"CITIC",//中信银行
  248. "goods_id"=>"",
  249. "goods_inf"=>"",
  250. "media_id"=>"",
  251. "media_type"=>"",
  252. "user_ip"=>"",
  253. "expand"=>"",
  254. "expire_time"=>"",
  255. "risk_expand"=>"",
  256. "media_type"=>"",//"MOBILE",
  257. );
  258. $service = new UmfService("60000100","D:/60000100_.key.pem");
  259. $res = $service->quickPayOrderMap($params);
  260. var_dump($res);
  261. }
  262. /**
  263. * 收款---快捷支付向平台获取短信验证码方法
  264. */
  265. public function test_quickGetMessageMap(){
  266. $params = array(
  267. "mer_id"=>"60000100",
  268. "trade_no"=>"3709141629214534",
  269. "media_id"=>"xxxxxxx",
  270. "media_type"=>"MOBILE",
  271. "card_id"=>"xxxxxxxx",
  272. "identity_type"=>"IDENTITY_CARD",
  273. "identity_code"=>"xxxxxxxx",
  274. "card_holder"=>"张三",
  275. "valid_date"=>"xxxxx",
  276. "cvv2"=>"xxxx",
  277. );
  278. $service = new UmfService("60000100","D:/60000100_.key.pem");
  279. $res = $service->quickGetMessageMap($params);
  280. var_dump($res);
  281. }
  282. /**
  283. * 收款---快捷支付确认支付
  284. */
  285. public function test_quickPayConfirmMap(){
  286. $params = array(
  287. "verify_code"=>"660412",
  288. "mer_id"=>"60000100",
  289. "trade_no"=>"3709141629214534",
  290. "media_id"=>"xxxxxxxxxx",
  291. "media_type"=>"MOBILE",
  292. "card_id"=>"xxxxxxxxxxxxx",
  293. "identity_type"=>"IDENTITY_CARD",
  294. "identity_code"=>"xxxxxxxxxx",
  295. "card_holder"=>"张三",
  296. "valid_date"=>"xxx",
  297. "cvv2"=>"xxx",
  298. );
  299. $service = new UmfService("60000100","D:/60000100_.key.pem");
  300. $res = $service->quickPayConfirmMap($params);
  301. var_dump($res);
  302. }
  303. /**
  304. * 收款---快捷支付获取银行卡列表
  305. */
  306. public function test_quickQuerybankSupportMap(){
  307. $params = array(
  308. "mer_id"=>"60000100",
  309. "pay_type"=>"CREDITCARD"
  310. );
  311. $service = new UmfService("60000100","D:/60000100_.key.pem");
  312. $res = $service->quickQuerybankSupportMap($params);
  313. var_dump($res);
  314. }
  315. /**
  316. * 收款---快捷支付解约
  317. */
  318. public function test_quickCancelSurrenderMap(){
  319. $params = array(
  320. "mer_id"=>"60000100",
  321. "mer_cust_id"=>"7836578",
  322. "usr_busi_agreement_id"=>"",
  323. "usr_pay_agreement_id"=>"",
  324. );
  325. $service = new UmfService("60000100","D:/60000100_.key.pem");
  326. $res = $service->quickCancelSurrenderMap($params);
  327. var_dump($res);
  328. }
  329. //------------------------------------------------------------
  330. // 订单查询
  331. //------------------------------------------------------------
  332. /**
  333. * 订单查询---查询历史订单方法
  334. */
  335. public function test_queryhistoryOrderMap(){
  336. $params = array(
  337. "mer_id"=>"60000100",
  338. "mer_date"=>date ( "Ymd" ),
  339. "order_id"=>"707794189",
  340. "order_type"=>"",
  341. "trade_no"=>"3709141130507194",
  342. );
  343. $service = new UmfService("60000100","D:/60000100_.key.pem");
  344. $res = $service->queryhistoryOrderMap($params);
  345. var_dump($res);
  346. }
  347. /**
  348. * 订单查询---查询当天订单状态
  349. */
  350. public function test_querytodayOrderMap(){
  351. $params = array(
  352. "mer_id"=>"60000100",
  353. "mer_date"=>date ( "Ymd" ),
  354. "order_id"=>"707794189",
  355. "amount"=>"1",
  356. "order_type"=>"",
  357. "trade_no"=>"3709141130507194",
  358. "goods_id"=>"",
  359. "goods_inf"=>"",
  360. "media_id"=>"17600537566",
  361. "media_type"=>"MOBILE",
  362. );
  363. $service = new UmfService("60000100","D:/60000100_.key.pem");
  364. $res = $service->querytodayOrderMap($params);
  365. var_dump($res);
  366. }
  367. //------------------------------------------------------------
  368. // 撤销
  369. //------------------------------------------------------------
  370. /**
  371. * 撤销---撤销方法
  372. */
  373. public function test_cancelTradeMap(){
  374. $params = array(
  375. "mer_id"=>"60000100",
  376. "mer_date"=>date ( "Ymd" ),
  377. "order_id"=>"707794189",
  378. "amount"=>"1"
  379. );
  380. $service = new UmfService("60000100","D:/60000100_.key.pem");
  381. $res = $service->cancelTradeMap($params);
  382. var_dump($res);
  383. }
  384. //------------------------------------------------------------
  385. // 退款
  386. //------------------------------------------------------------
  387. /**
  388. * 退款---普通退款方法
  389. */
  390. public function test_generalRefundMap(){
  391. $params = array(
  392. "mer_id"=>"60000100",
  393. "refund_no"=>"1709151040280000",
  394. "order_id"=>"546813964",
  395. "mer_date"=>"20170914",//date ( "Ymd" ),
  396. "org_amount"=>"1",
  397. "refund_amount"=>"1",
  398. "notify_url"=>"http://www.xxx.com/xxxx.php",
  399. );
  400. $service = new UmfService("60000100","D:/60000100_.key.pem");
  401. $res = $service->generalRefundMap($params);
  402. var_dump($res);
  403. }
  404. /**
  405. * 退款---退款状态查询方法
  406. */
  407. public function test_queryRefundStateMap(){
  408. $params = array(
  409. "mer_id"=>"60000100",
  410. "refund_no"=>"1709151040280000",
  411. );
  412. $service = new UmfService("60000100","D:/60000100_.key.pem");
  413. $res = $service->queryRefundStateMap($params);
  414. var_dump($res);
  415. }
  416. /**
  417. * 退款---退费信息补录方法
  418. */
  419. public function test_remedyRefundInformationMap(){
  420. $params = array(
  421. "mer_id"=>"60000100",
  422. "refund_no"=>"1709121725281236",
  423. "card_holder"=>"张三",
  424. "card_id"=>"xxxxxxxxxxxx",
  425. "gate_id"=>"CITIC",
  426. "card_branch_name"=>"中信银行",
  427. );
  428. $service = new UmfService("60000100","D:/60000100_.key.pem");
  429. $res = $service->remedyRefundInformationMap($params);
  430. var_dump($res);
  431. }
  432. //------------------------------------------------------------
  433. // 付款
  434. //------------------------------------------------------------
  435. /**
  436. * 付款---下单
  437. */
  438. public function test_paymentOrderMap(){
  439. $params = array(
  440. "mer_id"=>"60000100",
  441. "notify_url"=>"http://www.xxx.com/xxxx.php",
  442. "order_id"=>rand(0,999999999), // 430480957
  443. "mer_date"=>date ( "Ymd" ),
  444. "amount"=>"1",
  445. "recv_account_type"=>"00",
  446. "recv_bank_acc_pro"=>"0",
  447. "recv_account"=>"xxxxxxxxxx",
  448. "recv_user_name"=>"张三",
  449. "purpose"=>"测试",
  450. // "bank_brhname"=>"中信银行",
  451. );
  452. $service = new UmfService("60000100","D:/60000100_.key.pem");
  453. $res = $service->paymentOrderMap($params);
  454. var_dump($res);
  455. }
  456. /**
  457. * 付款---付款状态查询
  458. */
  459. public function test_queryPaymentStatusMap(){
  460. $params = array(
  461. "mer_id"=>"60000100",
  462. "order_id"=>"409545898",
  463. "mer_date"=>date ( "Ymd" ),
  464. );
  465. $service = new UmfService("60000100","D:/60000100_.key.pem");
  466. $res = $service->queryPaymentStatusMap($params);
  467. var_dump($res);
  468. }
  469. /**
  470. * 付款---余额查询
  471. */
  472. public function test_queryAccountBalanceMap(){
  473. $params = array(
  474. "mer_id"=>"60000100",
  475. "acc_type"=>"2",
  476. );
  477. $service = new UmfService("60000100","D:/60000100_.key.pem");
  478. $res = $service->queryAccountBalanceMap($params);
  479. var_dump($res);
  480. }
  481. //------------------------------------------------------------
  482. // 鉴权
  483. //------------------------------------------------------------
  484. /**
  485. * 鉴权---借记卡实名认证
  486. */
  487. public function test_debitCardAuthenticationMap(){
  488. $params = array(
  489. "mer_id"=>"60000100",
  490. "auth_type"=>"1",
  491. "auth_mode"=>"0",
  492. "order_id"=>rand(0,999999999),
  493. "bank_account"=>"xxxxxxxxx",
  494. "account_name"=>"张三",
  495. "identity_type"=>"1",
  496. "identity_code"=>"xxxxxxxxxx",
  497. "mobile_id"=>"xxxxxxxxxx",
  498. );
  499. $service = new UmfService("60000100","D:/60000100_.key.pem");
  500. $res = $service->debitCardAuthenticationMap($params);
  501. var_dump($res);
  502. }
  503. /**
  504. * 鉴权---借记卡实名认证
  505. */
  506. public function test_creditCardAuthenticationMap(){
  507. $params = array(
  508. "mer_id"=>"60000100",
  509. "auth_type"=>"1",
  510. "auth_mode"=>"0",
  511. "order_id"=>rand(0,999999999),
  512. "bank_account"=>"xxxxxxxxxxx",
  513. "account_name"=>"张三",
  514. "identity_type"=>"1",
  515. "identity_code"=>"xxxxxxxxxxxxx",
  516. "mobile_id"=>"xxxxxxxxxxxx",
  517. "cvv2"=>"188",
  518. "endDate"=>"2504"
  519. );
  520. $service = new UmfService("60000100","D:/60000100_.key.pem");
  521. $res = $service->creditCardAuthenticationMap($params);
  522. var_dump($res);
  523. }
  524. /**
  525. * 鉴权---身份认证
  526. */
  527. public function test_identityAuthenticationMap(){
  528. $params = array(
  529. "mer_id"=>"60000100",
  530. "auth_type"=>"1",
  531. "auth_mode"=>"3",
  532. "order_id"=>rand(0,999999999),
  533. "account_name"=>"张三",
  534. "identity_code"=>"xxxxxxxxxxxx",
  535. );
  536. $service = new UmfService("60000100","D:/60000100_.key.pem");
  537. $res = $service->identityAuthenticationMap($params);
  538. var_dump($res);
  539. }
  540. //------------------------------------------------------------
  541. // 对账
  542. //------------------------------------------------------------
  543. /**
  544. * 对账
  545. */
  546. public function test_reconciliationDownloadMap(){
  547. $params = array(
  548. "mer_id"=>"60000100",
  549. "settle_date"=>"20180803",//date ( "Ymd" ),
  550. "settle_path"=>"D:/umf_settle"
  551. );
  552. $service = new UmfService("60000100","D:/60000100_.key.pem");
  553. $res = $service->reconciliationDownloadMap($params);
  554. var_dump($res);
  555. }
  556. //------------------------------------------------------------
  557. // 异步通知
  558. //------------------------------------------------------------
  559. public function test_doGet(){
  560. //联动通知商户GET请求URL所带的参数
  561. $notifyParamsStr = "amount=1&amt_type=RMB&charset=UTF-8&error_code=0000&gate_id=BOC&goods_id=123&last_four_cardid=9112&media_id=18519105446&media_type=MOBILE&mer_date=20170321&mer_id=60000100&order_id=20170321333781&pay_date=20170321&pay_seq=D170321044815412782&pay_type=DEBITCARD&service=pay_result_notify&settle_date=20170321&trade_no=3703211703772982&trade_state=TRADE_SUCCESS&usr_busi_agreement_id=UB201703211650520000000013656539&usr_pay_agreement_id=P2017011014175200000000023372710&version=4.0&sign=YgZqiVdBALgIFcu6bXQRfSSew4Pg2t1AK25fwMfb%2FukBeRlklTdrPNw3RGbdFGSzbp7WxnV7TD20PuVs1FQbrtFZMvo2DTgB1uxJN1HwciBO30EfmpEuFSfx4m%2BoaxFNwezHdf35EHqhptRR%2BOmEe7uaGpV1EOa%2Fe%2BQPSrYRRP4%3D&sign_type=RSA";
  562. //$notifyParamsStr = "amount=1&amt_type=RMB&charset=UTF-8&error_code=0000&media_type=MOBILE&mer_date=20180504&mer_id=60275202&order_id=201805041438217192&pay_date=20180504&pay_seq=ZXWC0000000000000000041671351885&pay_type=WECHATWEB&service=pay_result_notify&settle_date=20180504&trade_no=3805041438501905&trade_state=TRADE_SUCCESS&version=4.0&sign=VDU1kPMhf0d10h1t5FYbzhYz0Wn7LXtpBTZy3MpWrTfJ0d64jAe7sV%2FmeFf%2FQ7IuyGS9HNpzrilfzR6xwMXHAEYCuvqd07hoSxfAnfuikarVFkwSXdm53LZGz2m1rCt9Ink43uqy0nRTWfIatug17cGDbvA2Kf6D1%2BT6KLZxXLY%3D&sign_type=RSA";
  563. //$notifyParamsStr = "amount=500000&com_amt=80&com_amt_type=-99&mer_date=20180305&mer_id=9602&order_id=719540&ret_code=0000&ret_msg=%E4%BA%A4%E6%98%93%E6%88%90%E5%8A%9F&trade_no=1803051026644972&trade_state=4&transfer_date=20180305&transfer_settle_date=20180305&version=4.0&sign=JxyCw7CmvfsfyB1UkHLNyNrdql23O3sz09CvzKgNb00tATSxGoUFUBUMWAyoH3Kz21M%2Br35lCd2u6Zi6dY2nHnAD0skwiIN9H%2Fr4uHRPPMzhzTbvQtB3hopI8hHB7XjS31hDGKnh4bbxLX2SrZ%2BEzVgKow6O17clFpALYzKZ1Ro%3D&sign_type=RSA";
  564. //$notifyParamsStr = "amount=11&com_amt=100&com_amt_type=-99&extra_com_amt=0&mer_date=20190128&mer_id=60010902&order_id=Y119834965582103745_1&ret_code=0000&ret_msg=%E4%BA%A4%E6%98%93%E6%88%90%E5%8A%9F&trade_no=1901281551974287&trade_state=4&transfer_date=20190128&transfer_settle_date=20190128&version=4.0&sign=LJJSeluyHjKoxzBDhlLkiiY59JR8z1JduFEV3elHUEXmXu3AWJjZd%2BAYDJJrfFesLJDV%2F2sbaOp0B5O6ym0aw3NzGCP9X%2FxkDI%2BhSnGFmQERYxJc%2F6KaULqyrO6sheFu%2BcTr%2BcPCP59VnvFFI4IRxPNVS30aKRHGmn%2BWrmk9xZM%3D&sign_type=RSA";
  565. //$notifyParamsStr = "amount=11&com_amt=100&com_amt_type=-99&extra_com_amt=0&mer_date=20190128&mer_id=60010902&order_id=Y119834965582103745_1&ret_code=0000&ret_msg=%E4%BA%A4%E6%98%93%E6%88%90%E5%8A%9F&trade_no=1901281551974287&trade_state=4&transfer_date=20190128&transfer_settle_date=20190128&version=4.0&sign=LJJSeluyHjKoxzBDhlLkiiY59JR8z1JduFEV3elHUEXmXu3AWJjZd%2BAYDJJrfFesLJDV%2F2sbaOp0B5O6ym0aw3NzGCP9X%2FxkDI%2BhSnGFmQERYxJc%2F6KaULqyrO6sheFu%2BcTr%2BcPCP59VnvFFI4IRxPNVS30aKRHGmn%2BWrmk9xZM%3D&sign_type=RSA";
  566. // $notifyParamsStr = "amount=1000&com_amt=70&com_amt_type=2&extra_com_amt=0&mer_date=20190314&mer_id=50751&order_id=787761688&ret_code=0000&ret_msg=%E4%BA%A4%E6%98%93%E6%88%90%E5%8A%9F&trade_no=1903141204699317&trade_state=4&transfer_date=20190314&transfer_settle_date=20190314&version=4.0&sign=MLVriuhYPQ1sWeGz5vH4eGmKQDmiXrha8bVoEBl8L7dAaTukXiXES%2FwLLQxDCYcLuvJLUCPAE0BRUaiEVQPVpEg73VHV0hxQ0R3v0Iw4LANl0mAnEFtnDZcxRQhuSOQzrbnXCoxQ7xVVstxDV%2B%2FYDGzTxW0Yx%2FMnhL2JXfM0Hqo%3D&sign_type=RSA";
  567. //$notifyParamsStr ="amount=1&amt_type=RMB&charset=UTF-8&error_code=0000&media_type=MOBILE&mer_date=20190409&mer_id=60439102&open_id=oEufkwCVGcvptjaU5mUsNO3LhgMs&order_id=190409024430119926&pay_date=20190409&pay_seq=ECZ00130201904091444323474258482&pay_type=WECHATWEB&service=pay_result_notify&settle_date=20190409&trade_no=3904091444123362&trade_state=TRADE_SUCCESS&version=4.0&sign=AfxDTtNb7BSku6licNl3qYQ9pqAwANzGtPvrKURcfouKak%2B07sTb%2FRLZqZHWrmAdqH4CbvAoeiZGyFn5nHVX5kImqfyQo%2F%2BvC26g8pOoyj2DHVhEt2WPdkR4JUiGUXFMUbqJVgd1f%2Fr9vJPGSz5Q4tcaSlUK0Cd8Qf8LlvhCrOs%3D&sign_type=RSA";
  568. $service = new UmfService("60000100","D:/60000100_.key.pem");
  569. $array = $service->notifyDataParserMap($notifyParamsStr);
  570. $mer2UmfPlatStr = $service->responseUMFMap($array);
  571. var_dump($array);
  572. // echo("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
  573. // echo("<HTML>");
  574. // echo(" <HEAD><META NAME=\"MobilePayPlatform\" CONTENT=\"" . $mer2UmfPlatStr . "\"/></HEAD>");
  575. // echo(" <BODY>");
  576. // echo("</BODY>");
  577. // echo("</HTML>");
  578. }
  579. //------------------------------------------------------------
  580. // APP支付
  581. //------------------------------------------------------------
  582. /**
  583. * APP支付下单
  584. */
  585. public function test_mobileOrderMap(){
  586. $params = array(
  587. "mer_id"=>"60000100",
  588. "notify_url"=>"http://www.xxx.com/xxxx.php",
  589. "ret_url"=>"http://www.xxx.com/xxxx.php",
  590. "goods_id"=>"",
  591. "goods_inf"=>"商品描述",
  592. "media_id"=>"",
  593. "media_type"=>"",
  594. "order_id"=>rand(0,999999999),
  595. "mer_date"=>date ( "Ymd" ),
  596. "amount"=>"1",
  597. "mer_priv"=>"",
  598. "expand"=>"",
  599. "user_ip"=>"",
  600. "expire_time"=>"",
  601. );
  602. $service = new UmfService("60000100","D:/60000100_.key.pem");
  603. $res = $service->mobileOrderMap($params);
  604. var_dump($res);
  605. }
  606. /**
  607. * APP生成签名
  608. */
  609. public function test_mobileGenerateSignMap(){
  610. $params = array(
  611. "merId"=>"60000100",
  612. "orderId"=>"745239257",
  613. "orderDate"=> "20170929",
  614. "amount"=>"1",
  615. );
  616. $service = new UmfService("60000100","D:/60000100_.key.pem");
  617. $res = $service->mobileGenerateSignMap($params);
  618. var_dump($res);
  619. }
  620. /**
  621. * 传入请求参数,成sign字段
  622. * 生成 "a=1&b=2&c=3&d=4&mer_id=60000100" 的签名
  623. */
  624. public function test_generateSign(){
  625. $params = array(
  626. "mer_id"=>"60000100",// mer_id 是必传参数
  627. "c"=>"3",
  628. "d"=>"4",
  629. "b"=>"2",
  630. "a"=>"1",
  631. );
  632. $service = new UmfService("60000100","D:/60000100_.key.pem");
  633. $res = $service->generateSign($params);
  634. var_dump($res);
  635. }
  636. /**
  637. * 验签方法
  638. * @param string $plain 联动返回明文字符串按序拼接(明文串去除sign_type字段)和
  639. * @param string $sign 密文sign字段
  640. * @return bool
  641. */
  642. public function test_verifySign(){
  643. $plain =
  644. "amount=1&amt_type=RMB&bank_payurl=&mer_date=20180829&mer_id=60000100&mer_priv=&order_id=15319824&platDate=20180829&ret_code=00080502&ret_msg=根据gateId无法找到支付银行,PSP170451a51a482&trade_no=3808291704813123&trade_state=WAIT_BUYER_PAY&version=4.0";
  645. $sign = "ExKMJsC0djEgQrqgbgtf/mp7oPrwt5imNDW81fU14hxLphSfiG2RQvUzd75VSmonNzgzs3GtP6UTuoebIHzvb43ceglE0wgwpoDAwrvOPHpaqtymEX7GXeOzbew9XjSEH3FgdBGuxD6FaMfuMCIyNBM8LQ+BK4S3YkiFlKc62Sw=";
  646. // $plain =
  647. //"amount=1&amt_type=RMB&bank_payurl=&mer_date=20180829&mer_id=52079&mer_priv=&order_id=1234567789088777&platDate=20180829&ret_code=00252020&ret_msg=系统忙!请稍后再试!,PSP163919bca9cfe&trade_no=2808291224125993&trade_state=WAIT_BUYER_PAY&version=4.0";
  648. //$sign = "qMkQX352Gp6QSiuXCUC8c8NIR7bHRnGgO+D6r0oPqzqEemyC3k5MLHexPrhifaVLp7YT3BoIyBKPCN3FSznBz5CXOXw2L/j6ByqJorAJemYk8Xn+BWVbjQetPfqaiLB8PQ9K/pNiqvIN4s/9N2T8BsDo20B13DxTfPVmgCqrNuk=";
  649. $service = new UmfService("60000100","D:/60000100_.key.pem");
  650. $res = $service->verifySign($plain,$sign);
  651. var_dump($res);
  652. }
  653. /**
  654. * 添加新私钥
  655. */
  656. public function test_addMerPrivateCertMap(){
  657. UmfService::addMerPrivateCertMap("60000100","D:/60000100_.key.pem");
  658. UmfService::addMerPrivateCertMap("60000101","D:/60000100_.key.pem");
  659. var_dump(UmfService::$privateKeyPath);
  660. }
  661. //----------------------------------------
  662. // 子商户入网部分
  663. //----------------------------------------
  664. /**
  665. * 子商户入网--获取token方法
  666. */
  667. public function test_getTokenMap(){
  668. $params = array(
  669. "grant_type"=>"client_credentials",
  670. "client_id"=>"79756098a6d291260523f6199ddfc4bc0875ccf6",
  671. "client_secret"=>"f642ab9bd929ab0d7f802e12dc689e416d4b8e6a"
  672. );
  673. $service = new UmfService("60038402","D:/60038402_.key.pem");;
  674. $res = $service->getTokenMap($params);
  675. var_dump($res);
  676. }
  677. /**
  678. * 子商户入网--添加子商户方法
  679. */
  680. public function test_addChildMerInfoMap(){
  681. $params = array(
  682. "token" => "839836d8848f267ffee93d3005388bc18cba67b57e64b5c15eaf814a06a8ea1a",
  683. "merId"=>"60038402",
  684. "merName"=>"十九",
  685. "merType"=>"1",
  686. "contActsName"=>"白居易",
  687. "mobileNo"=>"13911698741",
  688. "licenseType"=>"1",
  689. "licenseNo"=>"91140100743546791A",
  690. "organizationId"=>"",
  691. "taxPayerNum"=>"",
  692. "lawyer"=>"李白",
  693. "cardNo"=>"143624199210050537",
  694. "bankName"=>"招商银行",
  695. "bankAccount"=>"4638792345247569",
  696. "province"=>"010",
  697. "areaCode"=>"010",
  698. "merNotifyUrl"=>"http://www.baidu.com",
  699. "pubPriFlag"=>"1",
  700. "bankBrhName"=>"招商银行"
  701. );
  702. $service = new UmfService("60038402","D:/60000100_.key.pem");
  703. $res = $service->addChildMerInfoMap($params);
  704. var_dump($res);
  705. }
  706. /**
  707. * 子商户入网--上传商户资质方法
  708. */
  709. public function test_uploadMerFileMap(){
  710. $params = array(
  711. "token" => "839836d8848f267ffee93d3005388bc18cba67b57e64b5c15eaf814a06a8ea1a",
  712. "licenseNo"=>"91140100743546791A",
  713. "merId"=>"60038402"
  714. );
  715. $files = array(
  716. "C:/APPLY_TABLE.jpg",
  717. "C:/BANK_ACCOUNT_LICENCE.jpg",
  718. "C:/BUSSINESS_LICENSE.jpg",
  719. "C:/ID_CARD_BACK.jpg",
  720. "C:/ID_CARD_FRONT.jpg"
  721. );
  722. $service = new UmfService("60038402","D:/60000100_.key.pem");
  723. $res = $service->uploadMerFileMap($params,$files);
  724. var_dump($res);
  725. }
  726. /**
  727. * 子商户入网--修改子商户信息方法
  728. */
  729. public function test_changeChildMerInfoMap(){
  730. $params = array(
  731. "token" => "839836d8848f267ffee93d3005388bc18cba67b57e64b5c15eaf814a06a8ea1a",
  732. "merId"=>"60038402",
  733. "merName"=>"十九",
  734. "merType"=>"1",
  735. "contActsName"=>"白居易",
  736. "mobileNo"=>"13911698741",
  737. "licenseType"=>"1",
  738. "licenseNo"=>"91140100743546791A",
  739. "organizationId"=>"",
  740. "taxPayerNum"=>"",
  741. "lawyer"=>"李白",
  742. "cardNo"=>"143624199210050537",
  743. "bankName"=>"招商银行",
  744. "bankAccount"=>"4638792345247569",
  745. "province"=>"010",
  746. "areaCode"=>"010",
  747. "merNotifyUrl"=>"http://www.baidu.com",
  748. "pubPriFlag"=>"1",
  749. "bankBrhName"=>"招商银行"
  750. );
  751. $service = new UmfService("60038402","D:/60000100_.key.pem");
  752. $res = $service->changeChildMerInfoMap($params);
  753. var_dump($res);
  754. }
  755. /**
  756. * 子商户入网--查询审核状态方法
  757. */
  758. public function test_queryMerStateMap(){
  759. $params = array(
  760. "token" => "839836d8848f267ffee93d3005388bc18cba67b57e64b5c15eaf814a06a8ea1a",
  761. "merId"=>"60038402",
  762. "licenseNo"=>"91140100743546791A"
  763. );
  764. $service = new UmfService("60038402","D:/60038402_.key.pem");;
  765. $res = $service->queryMerStateMap($params);
  766. var_dump($res);
  767. }
  768. /**
  769. * 子商户入网--异步通知
  770. */
  771. public function test_childDoGet(){
  772. //$notifyChildParamsStr = "checkState=2&licenseNo=98761131653694400B&merId=60038402&noPassInfo=%E5%AD%90%E5%95%86%E6%88%B7%EF%BC%9AFills944%E5%AE%A1%E6%A0%B8%E6%88%90%E5%8A%9F%EF%BC%81&subMerId=20000560&sign=VNVeO%2B%2FxPNEmwh9eXP4Aup0gJRQ4e6DqMY1PSv4sOF25skRgm23H2Mmy7b7sWu%2BAKGBLoOTlzdGpw%2Bmv5PwQgOfBgo8ykciIYIlwTt0yhtvAAzzvsOsLqx6Lr0A0p%2B5ubAWisk%2FB2KOMWWScHo8uZgnPIc%2FEeU2p0W%2BaYK2Pzzw%3D";
  773. //$notifyChildParamsStr = "amount=500000&com_amt=80&com_amt_type=-99&mer_date=20180305&mer_id=9602&order_id=719540&ret_code=0000&ret_msg=%E4%BA%A4%E6%98%93%E6%88%90%E5%8A%9F&trade_no=1803051026644972&trade_state=4&transfer_date=20180305&transfer_settle_date=20180305&version=4.0&sign=JxyCw7CmvfsfyB1UkHLNyNrdql23O3sz09CvzKgNb00tATSxGoUFUBUMWAyoH3Kz21M%2Br35lCd2u6Zi6dY2nHnAD0skwiIN9H%2Fr4uHRPPMzhzTbvQtB3hopI8hHB7XjS31hDGKnh4bbxLX2SrZ%2BEzVgKow6O17clFpALYzKZ1Ro%3D&sign_type=RSA";
  774. $notifyChildParamsStr = "amount=200000&amt_type=RMB&charset=UTF-8&error_code=0000&gate_id=CMB&last_four_cardid=9800&media_id=18358258638&media_type=MOBILE&mer_date=20180305&mer_id=8180&order_id=201803059127121&pay_date=20180305&pay_type=CREDITCARD&service=pay_result_notify&settle_date=20180305&trade_no=3803051650163801&trade_state=TRADE_SUCCESS&version=4.0&sign=p%2Fonvrt6%2FAD%2FfyWMdw7JRo3o%2BvQWQuyvxcJgXBANvp4vt%2BkNNkYs6Mayo1rFMdRGQfZnGB1XZuC3ffybSwntFz4wfSIahe277oirgNqbkBZ3i9kse9wQPV1E3bNzOywQb7cNBYoQIzfRxkQf7jmKdvUB%2BKLINR6K0PI6tAVokDo%3D&sign_type=RSA";
  775. //$service = new UmfService("60038402","D:/60038402_.key.pem");
  776. $service = new UmfService("60000100","D:/60000100_.key.pem");
  777. $array = $service->notifyChildParserMap($notifyChildParamsStr);
  778. $mer2UmfPlatStr = $service->responseChildNotifyMap($array);
  779. //调用SDK生成返回联动平台字符串,加到CONTENT中
  780. // echo("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
  781. // echo("<HTML>");
  782. // echo(" <HEAD><META NAME=\"MobilePayPlatform\" CONTENT=\"" . $mer2UmfPlatStr . "\"/></HEAD>");
  783. // echo(" <BODY>");
  784. // echo("</BODY>");
  785. // echo("</HTML>");
  786. }
  787. /**
  788. * 账户通---子商户提现
  789. */
  790. public function test_ChildWithdrawalsMap(){
  791. $params = array(
  792. "mer_id" => "60016102",
  793. "order_id"=>"201804030726",
  794. "mer_date"=>"20180403",
  795. "amount"=>"1",
  796. "sub_mer_id"=>"20000585",
  797. "set_com_type"=>"1"
  798. );
  799. $service = new UmfService("60016102","D:/60016102_.key.pem");
  800. $res = $service->withdrawalsMap($params);
  801. var_dump($res);
  802. }
  803. /**
  804. * 账户通---子商户提现查询
  805. */
  806. public function test_QueryChildWithdrawalsMap(){
  807. $params = array(
  808. "mer_id" => "60016102",
  809. "order_id"=>"201804030726",
  810. "mer_date"=>"20180403",
  811. "sub_mer_id"=>"20000583"
  812. );
  813. //$service = new UmfService("60000100","D:/60000100_.key.pem");
  814. $service = new UmfService("60016102","D:/60016102_.key.pem");
  815. $res = $service->queryWithdrawalsMap($params);
  816. var_dump($res);
  817. }
  818. /**
  819. * 账户通---子商户余额查询
  820. */
  821. public function test_QueryChildBalancesMap(){
  822. $params = array(
  823. "mer_id" => "60016102",
  824. "sub_mer_id"=>"20000583"
  825. );
  826. $service = new UmfService("60016102","D:/60016102_.key.pem");
  827. $res = $service->querySubBalanceMap($params);
  828. var_dump($res);
  829. }
  830. //----------------------------------------
  831. // 分账部分
  832. //----------------------------------------
  833. /**
  834. * 分账—分账请求针对标准分账的延时分账
  835. */
  836. public function test_splitReqMap(){
  837. $params = array(
  838. "mer_id"=>"60038402",
  839. "order_id"=>"6262051263",
  840. "mer_date"=>"20171106"
  841. );
  842. $service = new UmfService("60038402","D:/60038402_.key.pem");
  843. $res = $service->splitReqMap($params);
  844. var_dump($res);
  845. }
  846. /**
  847. * 分账---分账状态查询
  848. */
  849. public function test_splitStateMap(){
  850. $params = array(
  851. "mer_id"=>"60038402",
  852. "order_id"=>"20171025156977045",//rand(0,999999999),
  853. "mer_date"=>"20171025",//date ( "Ymd" )
  854. );
  855. $service = new UmfService("60038402","D:/60000100_.key.pem");
  856. $res = $service->splitStateMap($params);
  857. var_dump($res);
  858. }
  859. /**
  860. * 分账---分账退费
  861. */
  862. public function test_splitRefundMap(){
  863. $params = array(
  864. "mer_id"=>"60038402",
  865. "refund_no"=>"17102711311234",
  866. "order_id"=>"20171025156977045",
  867. "mer_date"=> "20171025",
  868. "org_amount"=>"2",
  869. );
  870. $service = new UmfService("60038402","D:/60000100_.key.pem");
  871. $res = $service->splitRefundMap($params);
  872. var_dump($res);
  873. }
  874. /**
  875. * 分账---分账退费子订单请求
  876. */
  877. public function test_massTransferRefundMap(){
  878. $params = array(
  879. "mer_id"=>"60000100",
  880. "mer_date"=>"20170913",
  881. "order_id"=>"8155547220",
  882. "refund_no"=>"1709131750281234",
  883. "refund_amount"=>"1",
  884. "org_amount"=>"1",
  885. "notify_url"=>"http://www.xxx.com/xxxx.php",
  886. "sub_mer_id"=>"2000",
  887. "sub_order_id"=>"20144546131213",
  888. "refund_desc"=>"测试",
  889. );
  890. $service = new UmfService("60000100","D:/60000100_.key.pem");
  891. $res = $service->splitSubRefundMap($params);
  892. var_dump($res);
  893. }
  894. /**
  895. * 分账---分账文件下载
  896. */
  897. public function test_splitFileDownloadMap(){
  898. $params = array(
  899. "mer_id"=>"60038402",
  900. "settle_date"=>"20171024",
  901. "settle_path"=>"C:/umf_settle",
  902. "settle_type"=>"SPLITDETAIL"
  903. );
  904. $service = new UmfService("60038402","D:/60000100_.key.pem");
  905. $res = $service->splitFileDownloadMap($params);
  906. var_dump($res);
  907. }
  908. //----------------------------------------
  909. // E秒付
  910. //----------------------------------------
  911. /**
  912. * E秒付
  913. */
  914. public function test_epaymentOrderMap(){
  915. $params = array(
  916. "mer_id"=>"60000100",
  917. "notify_url"=>"www.xxx.com",
  918. "order_id"=>rand(0,999999999),
  919. "mer_date"=> date ("Ymd"),
  920. "amount"=>"10",
  921. "recv_account_type"=>"00",
  922. "recv_bank_acc_pro"=>"0",
  923. "recv_user_name"=>"张三",
  924. "recv_account"=>"xxxxxxxxxxxxxxxx",
  925. "cut_fee_type"=>"2",
  926. );
  927. $service = new UmfService("60000100","D:/60000100_.key.pem");
  928. $res = $service->epaymentOrderMap($params);
  929. var_dump($res);
  930. }
  931. /**
  932. * 立码付API
  933. */
  934. public function test_publicVerticalMap(){
  935. $params = array(
  936. "mer_id"=>"60000100",
  937. "notify_url"=>"http://xxx.xxx.com",
  938. "goods_inf"=>"测试商品",
  939. "order_id"=>rand(0,999999999),
  940. "mer_date"=>date("Ymd"),
  941. "amount"=>"1",
  942. "app_id"=>"xxxxxxxx",
  943. "open_id"=>"xxxxxxxx",
  944. "scancode_type"=>"WECHAT",
  945. );
  946. $service = new UmfService("60000100","D:/60000100_.key.pem");
  947. $res = $service->publicVerticalMap($params);
  948. var_dump($res);
  949. }
  950. /**
  951. * 小程序API
  952. */
  953. public function test_miniProgramPayMap(){
  954. $params = array(
  955. "mer_id"=>"60000100",
  956. "notify_url"=>"http://xxx.xxx.com",
  957. "goods_inf"=>"测试商品",
  958. "order_id"=>rand(0,999999999),
  959. "mer_date"=>date("Ymd"),
  960. "amount"=>"1",
  961. "app_id"=>"xxxxxxxx",
  962. "open_id"=>"xxxxxxxx",
  963. "scancode_type"=>"WECHAT",
  964. );
  965. $service = new UmfService("60000100","D:/60000100_.key.pem");
  966. $res = $service->miniProgramPayMap($params);
  967. var_dump($res);
  968. }
  969. /**
  970. * 微信主扫线上
  971. */
  972. public function test_activeOnlineScanPayMap(){
  973. $params = array(
  974. "mer_id"=>"60000100",
  975. "notify_url"=>"http://xxx.xxx.com",
  976. "goods_inf"=>"测试商品",
  977. "order_id"=>rand(0,999999999),
  978. "mer_date"=>date("Ymd"),
  979. "amount"=>"1",
  980. "app_id"=>"xxxxxxxx",
  981. "open_id"=>"xxxxxxxx",
  982. "scancode_type"=>"WECHAT",
  983. );
  984. $service = new UmfService("60000100","D:/60000100_.key.pem");
  985. $res = $service->activeOnlineScanPayMap($params);
  986. var_dump($res);
  987. }
  988. /**
  989. * 公众号线上
  990. */
  991. public function test_publicOnlinePayMap(){
  992. $params = array(
  993. "mer_id"=>"60000100",
  994. "notify_url"=>"http://xxx.xxx.com",
  995. "goods_inf"=>"测试商品",
  996. "order_id"=>rand(0,999999999),
  997. "mer_date"=>date("Ymd"),
  998. "amount"=>"1",
  999. "app_id"=>"xxxxxxxx",
  1000. "open_id"=>"xxxxxxxx",
  1001. "scancode_type"=>"WECHAT",
  1002. );
  1003. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1004. $res = $service->publicOnlinePayMap($params);
  1005. var_dump($res);
  1006. }
  1007. /**
  1008. * 公众号线下
  1009. */
  1010. public function test_publicUnderlinePayMap(){
  1011. $params = array(
  1012. "mer_id"=>"60000100",
  1013. "notify_url"=>"http://xxx.xxx.com",
  1014. "goods_inf"=>"测试商品",
  1015. "order_id"=>rand(0,999999999),
  1016. "mer_date"=>date("Ymd"),
  1017. "amount"=>"1",
  1018. "app_id"=>"xxxxxxxx",
  1019. "open_id"=>"xxxxxxxx",
  1020. "scancode_type"=>"WECHAT",
  1021. );
  1022. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1023. $res = $service->publicUnderlinePayMap($params);
  1024. var_dump($res);
  1025. }
  1026. /**
  1027. * 立马付下单获取用户标识
  1028. */
  1029. public function test_prepareGetUserUnionMap(){
  1030. $params = array(
  1031. "mer_id"=>"60000100",
  1032. "order_id"=>rand(0,999999999),
  1033. "mer_date"=>date("Ymd"),
  1034. "amount"=>"1",
  1035. "userAuthCode"=>"11111111111111111111",
  1036. "respCode"=>"00",
  1037. );
  1038. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1039. $res = $service->getUseridUnionMap($params);
  1040. var_dump($res);
  1041. }
  1042. /**
  1043. * 分期用户手续费查询
  1044. */
  1045. public function test_prepareQuerystageUserStageNumMap(){
  1046. $params = array(
  1047. "mer_id"=>"60000100",
  1048. "order_id"=>rand(0,999999999),
  1049. "amount"=>"1",
  1050. "staging_num"=>"06",
  1051. "discount_mode"=>"01",
  1052. );
  1053. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1054. $res = $service->queryUserStagingComamtMap($params);
  1055. var_dump($res);
  1056. }
  1057. /**
  1058. * 一键支付下单
  1059. */
  1060. public function test_quickOrderMap(){
  1061. $params = array(
  1062. "mer_id"=>"60000100",
  1063. "goods_inf"=>"测试商品",
  1064. "order_id"=>rand(0,999999999),
  1065. "mer_date"=>date("Ymd"),
  1066. "amount"=>"1"
  1067. );
  1068. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1069. $res = $service->quickOrderMap($params);
  1070. var_dump($res);
  1071. }
  1072. /**
  1073. * 一键支付下单获取短信
  1074. */
  1075. public function test_getSMSMap(){
  1076. $params = array(
  1077. "mer_id"=>"60000100",
  1078. "trade_no"=>"3801261003248915",
  1079. "media_id"=>rand(0,999999999),
  1080. "amount"=>"1"
  1081. );
  1082. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1083. $res = $service->getSMSMap($params);
  1084. var_dump($res);
  1085. }
  1086. /**
  1087. * 一键支付协议支付、商业委托下单获取短信
  1088. */
  1089. public function test_getAgreementSMSMap(){
  1090. $params = array(
  1091. "mer_id"=>"60000100",
  1092. "trade_no"=>"3801261003248915",
  1093. "mer_cust_id"=>"13333333333",
  1094. "usr_pay_agreement_id"=>"P2017111208553000000000033565625"
  1095. );
  1096. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1097. $res = $service->getSMSMap($params);
  1098. var_dump($res);
  1099. }
  1100. /**
  1101. * 一键支付首次支付
  1102. */
  1103. public function test_FirstPaymentMap(){
  1104. $params = array(
  1105. "mer_id"=>"60000100",
  1106. "trade_no"=>"3801261003248915",
  1107. "identity_code"=>"111111111111111",
  1108. "card_id"=>"11111111111111",
  1109. "card_holder"=>"张三",
  1110. "media_type"=>"MOBILE",
  1111. "media_id"=>"13333333333",
  1112. "verify_code"=>"1111",
  1113. );
  1114. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1115. $res = $service->FirstPaymentMap($params);
  1116. var_dump($res);
  1117. }
  1118. /**
  1119. * 一键支付协议支付
  1120. */
  1121. public function test_agreementPaymentMap(){
  1122. $params = array(
  1123. "mer_id"=>"60000100",
  1124. "trade_no"=>"3801261003248915",
  1125. "usr_pay_agreement_id"=>"111111111111111",
  1126. "mer_cust_id"=>"11111111111111",
  1127. "verify_code"=>"1111",
  1128. );
  1129. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1130. $res = $service->agreementPaymentMap($params);
  1131. var_dump($res);
  1132. }
  1133. /**
  1134. * 一键支付查询商户支持的银行卡列表
  1135. */
  1136. public function test_supportBankMap(){
  1137. $params = array(
  1138. "mer_id"=>"60000100",
  1139. "pay_type"=>"DEBITCARD"
  1140. );
  1141. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1142. $res = $service->supportBankMap($params);
  1143. var_dump($res);
  1144. }
  1145. /**
  1146. * 一键支付查询商户用户已签约的银行列表
  1147. */
  1148. public function test_signedBankMap(){
  1149. $params = array(
  1150. "mer_id"=>"60000100",
  1151. "pay_type"=>"DEBITCARD",
  1152. "mer_cust_id"=>"11111111111111"
  1153. );
  1154. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1155. $res = $service->querySignedBankMapNew($params);
  1156. var_dump($res);
  1157. }
  1158. /**
  1159. * 一键支付用户签约下短信
  1160. */
  1161. public function test_bindingApplicationMap(){
  1162. $params = array(
  1163. "mer_id"=>"60000100",
  1164. "card_id"=>"11111111111111",
  1165. "media_id"=>rand(0,999999999),
  1166. );
  1167. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1168. $res = $service->bindingApplicationMap($params);
  1169. var_dump($res);
  1170. }
  1171. /**
  1172. * 一键支付签约确认
  1173. */
  1174. public function test_bindingConfirmationMap(){
  1175. $params = array(
  1176. "mer_id"=>"60000100",
  1177. "card_id"=>"11111111111111",
  1178. "media_id"=>rand(0,999999999),
  1179. "mer_cust_id"=>"11111111111111",
  1180. "verify_code"=>"1111",
  1181. "bind_no"=>"1111"
  1182. );
  1183. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1184. $res = $service->bindingConfirmationMap($params);
  1185. var_dump($res);
  1186. }
  1187. /**
  1188. * 一键支付API解除绑定
  1189. */
  1190. public function test_unbindMap(){
  1191. $params = array(
  1192. "mer_id"=>"60000100",
  1193. "mer_cust_id"=>"11111111111111",
  1194. );
  1195. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1196. $res = $service->unbindMap($params);
  1197. var_dump($res);
  1198. }
  1199. /**
  1200. * 商业委托---签约下单及获取短信验证码
  1201. */
  1202. public function test_CommercialSignOrderMap(){
  1203. $params = array(
  1204. "mer_id"=>"60000100",
  1205. "mer_cust_id"=>"11111111111111",
  1206. "media_id"=>"133333333333",
  1207. "card_id"=>"60000100",
  1208. "identity_type"=>"1",
  1209. "identity_code"=>"1000000000000",
  1210. "card_holder"=>"张三",
  1211. );
  1212. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1213. $res = $service->CommercialSignOrderMap($params);
  1214. var_dump($res);
  1215. }
  1216. /**
  1217. * 商业委托---签约确认
  1218. */
  1219. public function test_CommercialSignConfirmMap(){
  1220. $params = array(
  1221. "mer_id"=>"60000100",
  1222. "bind_id"=>"11111111111111",
  1223. "verify_code"=>"1234",
  1224. );
  1225. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1226. $res = $service->CommercialSignConfirmMap($params);
  1227. var_dump($res);
  1228. }
  1229. /**
  1230. * 借记卡认证支付下单
  1231. */
  1232. public function test_debitAuthenPayOrderMap(){
  1233. $params = array(
  1234. "mer_id"=>"60000100",
  1235. "notify_url"=>"",
  1236. "order_id"=>rand(0,999999999),
  1237. "mer_date"=>date("Ymd"),
  1238. "amount"=>"1"
  1239. );
  1240. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1241. $res = $service->debitAuthenPayOrderMap($params);
  1242. var_dump($res);
  1243. }
  1244. /**
  1245. * 借记卡认证支付获取短信验证码
  1246. */
  1247. public function test_debitAuthenPayGetVerifyCodeMap(){
  1248. $params = array(
  1249. "mer_id"=>"60000100",
  1250. "trade_no"=>"3801261003248915",
  1251. "media_id"=>"1333333333",
  1252. );
  1253. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1254. $res = $service->debitAuthenPayGetVerifyCodeMap($params);
  1255. var_dump($res);
  1256. }
  1257. /**
  1258. * 借记卡认证支付确认支付
  1259. */
  1260. public function test_debitAuthenPayConfirmMap(){
  1261. $params = array(
  1262. "mer_id"=>"60000100",
  1263. "card_id"=>"11111111111111",
  1264. "media_id"=>"1333333333",
  1265. "trade_no"=>"3801261003248915",
  1266. "identity_code"=>"11111111111111",
  1267. "card_holder"=>"张三",
  1268. );
  1269. $service = new UmfService("60000100","D:/60000100_.key.pem");
  1270. $res = $service->debitAuthenPayConfirmMap($params);
  1271. var_dump($res);
  1272. }
  1273. }
  1274. ?>