TestRefillYl.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. define('APP_ID', 'test');
  4. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  5. require_once(BASE_ROOT_PATH . '/global.php');
  6. require_once(BASE_CORE_PATH . '/lrlz.php');
  7. require_once(BASE_ROOT_PATH . '/fooder.php');
  8. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  9. require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
  10. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  11. const LocalTest = 1;
  12. const NetTest = 2;
  13. const CurrentTest = NetTest;
  14. class TestRefillYl extends TestCase
  15. {
  16. public static function setUpBeforeClass(): void
  17. {
  18. Base::run_util();
  19. refill\RefillFactory::instance();
  20. }
  21. private function getProvider($name,$type = 'RefillPhone')
  22. {
  23. $file = BASE_HELPER_RAPI_PATH . "/$name/{$type}.php";
  24. if(!file_exists($file)){
  25. Log::record("provider api file={$file} not exist.",Log::DEBUG);
  26. return false;
  27. } else {
  28. require_once($file);
  29. Log::record("file={$file} load success.",Log::DEBUG);
  30. }
  31. $class_name = "refill\\{$name}\\{$type}";
  32. if (class_exists($class_name, false)) {
  33. $caller = new $class_name([]);
  34. return $caller;
  35. } else {
  36. $error = "Base Error: class {$class_name} isn't exists!";
  37. Log::record($error, Log::ERR);
  38. return false;
  39. }
  40. }
  41. private function make_sn()
  42. {
  43. return mt_rand(1000, 9999)
  44. . sprintf('%010d', time())
  45. . sprintf('%06d', (float)microtime() * 1000000);
  46. }
  47. public function testYamiao_high()
  48. {
  49. // $provider = $this->getProvider('yamiao_high');
  50. // $resp = $provider->balance();
  51. // $resp = $provider->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  52. // $resp = $provider->query(['order_sn' => '80031648092448376229']);
  53. $body = '{"orderId":"220324112752228331","appId":"ILo9IfHYg0","outOrderId":"80031648092448376229","sign":"1ef1ba02308669673ebcb136cb67e1c1","orderStatus":"3","completeTime":"20220324112803","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  54. $params = json_decode($body, true);
  55. $provider = $this->getProvider('yamiao_high','RefillCallBack');
  56. $ret = $provider->verify($params);
  57. $resp = $provider->notify($params);
  58. }
  59. public function testYamiao_normal()
  60. {
  61. // $provider = $this->getProvider('yamiao_normal');
  62. // $resp = $provider->balance();
  63. // $resp = $provider->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  64. // $resp = $provider->query(['order_sn' => '65931648092912669252']);
  65. $body = '{"orderId":"220324113519231696","appId":"Mxh2JUZocr","outOrderId":"65931648092912669252","sign":"6560cab5e7ec5f265b04632c4c2a1f1a","orderStatus":"3","completeTime":"20220324113522","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  66. $params = json_decode($body, true);
  67. $provider = $this->getProvider('yamiao_normal','RefillCallBack');
  68. $ret = $provider->verify($params);
  69. $resp = $provider->notify($params);
  70. }
  71. public function testYamiaoman()
  72. {
  73. $provider = $this->getProvider('yamiaoman');
  74. $resp = $provider->balance();
  75. // $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  76. // $resp = $provider->query(['order_sn' => '53351647242979116742']);
  77. // $body = '{"orderId":"220314152954756093","appId":"zIODZmzSCk","outOrderId":"53351647242979116742","sign":"41ad7d4b4b26559377c6443d2b0d6c68","orderStatus":"3","completeTime":"20220314172722","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  78. // $params = json_decode($body, true);
  79. // $provider = $this->getProvider('yamiaoman','RefillCallBack');
  80. // $ret = $provider->verify($params);
  81. // $resp = $provider->notify($params);
  82. }
  83. public function testGuantu()
  84. {
  85. // $provider = $this->getProvider('guantu');
  86. // $resp = $provider->balance();
  87. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  88. // $resp = $provider->query(['order_sn' => '59041648111767968756']);
  89. $body = ' {"orderId":"220324164934076577","appId":"t7gmui2D3w","outOrderId":"59041648111767968756","sign":"e957df33cfaa777cd3c2349cd2023996","orderStatus":"3","completeTime":"20220324165033","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  90. $params = json_decode($body, true);
  91. $provider = $this->getProvider('guantu','RefillCallBack');
  92. $ret = $provider->verify($params);
  93. $resp = $provider->notify($params);
  94. }
  95. public function testLechong()
  96. {
  97. $provider = $this->getProvider('lechong');
  98. // $resp = $provider->balance();
  99. // $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  100. // $resp = $provider->query(['order_sn' => '65361648114672703928']);
  101. $body = '{"sellerid":"65361648114672703928","agentcode":"202203241556","account":"MTg1MDA2MDgzMzM=","value":"50","payvalue":"47.8000","voucher":"","createtime":"20220324173803","endtime":"20220324173857","state":"4","remark":"","time":"20220324174224","sign":"8a2c011095cadb6dc5abd00c25a11d1c"}';
  102. $params = json_decode($body, true);
  103. $provider = $this->getProvider('lechong','RefillCallBack');
  104. $ret = $provider->verify($params);
  105. $resp = $provider->notify($params);
  106. }
  107. public function testXinhengyangnew()
  108. {
  109. // $provider = $this->getProvider('xinhengyangnew');
  110. // $resp = $provider->balance();
  111. // $resp = $provider->add(13699279618, mtopcard\ChinaMobileCard, 30, ['order_sn' => $this->make_sn()]);
  112. // $resp = $provider->query(['order_sn' => '98351648200827982694']);
  113. $body = '{"mchid":"200065","msg":"充值失败","oid":"1000432223966","orderid":"98351648200827982694","price":"28.770","sign":"f3364cabace651f55f464aa5c6fa2d0b","status":"2","voucher":""}';
  114. $params = json_decode($body, true);
  115. $provider = $this->getProvider('xinhengyangnew', 'RefillCallBack');
  116. $ret = $provider->verify($params);
  117. $resp = $provider->notify($params);
  118. }
  119. public function testHuazhong()
  120. {
  121. $provider = $this->getProvider('huazhong');
  122. // $resp = $provider->balance();
  123. // $resp = $provider->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  124. // $resp = $provider->query(['order_sn' => '85281648450617184602']);
  125. $body = '{"orderid":"SAD22032814599651058","sporderid":"85281648450617184602","userid":"10002823","merchantsubmittime":"20220328145958","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.59","sign":"C43F386C2804A71208E74FB336A600DA"}';
  126. $params = json_decode($body, true);
  127. $provider = $this->getProvider('huazhong','RefillCallBack');
  128. $ret = $provider->verify($params);
  129. $resp = $provider->notify($params);
  130. }
  131. public function testYouhenew()
  132. {
  133. // $provider = $this->getProvider('youhenew');
  134. // $resp = $provider->balance();
  135. // $resp = $provider->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  136. // $resp = $provider->query(['order_sn' => '24941648452249459365']);
  137. $body = ' {"szOrderId":"24941648452249459365","fSalePrice":"28.74","szAgentId":"200039","nFlag":"3","szVerifyString":"57fa9c6232850f75841bee763d479dca","szPhoneNum":"13699279618","szRtnMsg":"","nDemo":"30"}';
  138. $params = json_decode($body, true);
  139. $provider = $this->getProvider('youhenew', 'RefillCallBack');
  140. $ret = $provider->verify($params);
  141. $resp = $provider->notify($params);
  142. }
  143. public function testLinzhu()
  144. {
  145. // $provider = $this->getProvider('linzhu');
  146. // $resp = $provider->balance();
  147. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  148. // $resp = $provider->query(['order_sn' => '71081648522867327868']);
  149. $body = '{"sign":"83fe70f514600e05348a2c655ab085674dfa6153","timestamp":"20220329112433","orderNo":"F2203291124306519238","status":"003","consumerNo":"42761648524235437895","account":"yelin","voucherNo":null,"mobile":"18500608333"}';
  150. $params = json_decode($body, true);
  151. $provider = $this->getProvider('linzhu', 'RefillCallBack');
  152. $ret = $provider->verify($params);
  153. $data = $provider->notify($params);
  154. }
  155. public function testRuixunda()
  156. {
  157. // $provider = $this->getProvider('ruixunda');
  158. // $resp = $provider->balance();
  159. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  160. // $resp = $provider->query(['order_sn' => '33231648458371654420']);
  161. $body = '{"orderId":"220328170618202120","appId":"IvpY5p7PF2","outOrderId":"33231648458371654420","sign":"c28dda0d82efac178933e34465c6bf10","orderStatus":"3","completeTime":"20220328170623","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  162. $params = json_decode($body, true);
  163. $provider = $this->getProvider('ruixunda', 'RefillCallBack');
  164. $ret = $provider->verify($params);
  165. $resp = $provider->notify($params);
  166. }
  167. public function testHangtong()
  168. {
  169. // $provider = $this->getProvider('hangtong');
  170. // $resp = $provider->balance();
  171. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  172. // $resp = $provider->query(['order_sn' => '74101648459089504352']);
  173. $body = '{"phone":"18500608333","orderNo":"F2203281718158019474","status":"fail","otherNo":"74101648459089504352","msg":"提交/充值失败","ext":null}';
  174. $params = json_decode($body, true);
  175. $provider = $this->getProvider('hangtong', 'RefillCallBack');
  176. $ret = $provider->verify($params);
  177. $resp = $provider->notify($params);
  178. }
  179. public function testRuixunda_lt()
  180. {
  181. // $provider = $this->getProvider('ruixunda_lt');
  182. // $resp = $provider->balance();
  183. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  184. // $resp = $provider->query(['order_sn' => '46111648526030456955']);
  185. $body = '{"orderId":"220329115433227387","appId":"Uue0cNoWpa","outOrderId":"46111648526030456955","sign":"10e5addeb793510c775acba893ffe293","orderStatus":"3","completeTime":"20220329115514","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
  186. $params = json_decode($body, true);
  187. $provider = $this->getProvider('ruixunda_lt', 'RefillCallBack');
  188. $ret = $provider->verify($params);
  189. $resp = $provider->notify($params);
  190. }
  191. public function testWangliantx()
  192. {
  193. // $provider = $this->getProvider('wangliantx');
  194. // $resp = $provider->balance();
  195. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  196. // $resp = $provider->query(['order_sn' => '94661648534383050223']);
  197. $body = '{"userid":"10073945","sporderid":"94661648534383050223","orderid":"674A7408073BED1573945","resultno":"9","merchantsubmittime":"20220329141510","ordermoney":"28.53","verifystring":"29c7929b53beb1d67844edc6ecc7e84d","sign":"27dfda24686f696e8360c27922fc7ad1"}';
  198. $params = json_decode($body, true);
  199. $provider = $this->getProvider('wangliantx', 'RefillCallBack');
  200. $ret = $provider->verify($params);
  201. $resp = $provider->notify($params);
  202. }
  203. public function testXianghongrui()
  204. {
  205. // $provider = $this->getProvider('xianghongrui');
  206. // $resp = $provider->balance();
  207. // $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  208. // $resp = $provider->query(['order_sn' => '87461648535891960493']);
  209. $body = '{"orderid":"JTH22032914388095709","sporderid":"87461648535891960493","userid":"10002703","merchantsubmittime":"20220329143837","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.5","sign":"A2F64CAE7B37AE11D4F95468BC836EC0"}';
  210. $params = json_decode($body, true);
  211. $provider = $this->getProvider('xianghongrui', 'RefillCallBack');
  212. $ret = $provider->verify($params);
  213. $resp = $provider->notify($params);
  214. }
  215. }