TestRefillZY.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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 TestRefillZY extends TestCase
  15. {
  16. public function __construct(?string $name = null, array $data = [], $dataName = '')
  17. {
  18. parent::__construct($name, $data, $dataName);
  19. if (CurrentTest == LocalTest) {
  20. $this->mReqHost = BASE_SITE_URL;
  21. $this->mMchid = 1;
  22. $this->mKey = '1ff02223b771c0414468c8892151c602';
  23. } else {
  24. $this->mReqHost = 'https://ylapi.xyzshops.cn';
  25. $this->mMchid = 1092;
  26. $this->mKey = '210fe406954220f56085997d6a4c5b80';
  27. }
  28. }
  29. public static function setUpBeforeClass(): void
  30. {
  31. Base::run_util();
  32. refill\RefillFactory::instance();
  33. }
  34. private function getProvider($name,$type = 'RefillPhone')
  35. {
  36. $file = BASE_HELPER_RAPI_PATH . "/$name/{$type}.php";
  37. if(!file_exists($file)){
  38. Log::record("provider api file={$file} not exist.",Log::DEBUG);
  39. return false;
  40. } else {
  41. require_once($file);
  42. Log::record("file={$file} load success.",Log::DEBUG);
  43. }
  44. $class_name = "refill\\{$name}\\{$type}";
  45. if (class_exists($class_name, false)) {
  46. $caller = new $class_name([]);
  47. return $caller;
  48. } else {
  49. $error = "Base Error: class {$class_name} isn't exists!";
  50. Log::record($error, Log::ERR);
  51. return false;
  52. }
  53. }
  54. private function make_sn()
  55. {
  56. return mt_rand(1000, 9999)
  57. . sprintf('%010d', time())
  58. . sprintf('%06d', (float)microtime() * 1000000);
  59. }
  60. public function testByq_tianrui()
  61. {
  62. // $provider = $this->getProvider('byq_tianrui');
  63. // $resp = $provider->balance();
  64. // $resp = $provider->add(18074608795, 4, 200, ['order_sn' => $this->make_sn(), 'product_code' => 'XYZ100777', 'goods_id' => 6978]);
  65. // $resp = $provider->query(['order_sn' => '69131683255011805153']);
  66. $body = '{"mchid":"10361","order_sn":"69131683255011805153","amount":"25.0000","cardno":"18074608795","trade_no":"1653600736599019783991","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"a64bfbc4c9928df9c223a603869ef9a2"}';
  67. $params = json_decode($body, true);
  68. $provider = $this->getProvider('byq_tianrui', 'RefillCallback');
  69. $ret = $provider->verify($params);
  70. $resp = $provider->notify($params);
  71. }
  72. public function testBy_shehzhou()
  73. {
  74. // $provider = $this->getProvider('by_shehzhou');
  75. // $resp = $provider->balance();
  76. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  77. // $resp = $provider->query(['order_sn' => '12451683256478050996']);
  78. $body = '{"mchid":"10364","order_sn":"12451683256478050996","amount":"100.0000","cardno":"15811535608","trade_no":"1804420736600486221819","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"a71cdd3c1bb2d94eea16a05c8a174e29"}';
  79. $params = json_decode($body, true);
  80. $provider = $this->getProvider('by_shehzhou', 'RefillCallBack');
  81. $ret = $provider->verify($params);
  82. $resp = $provider->notify($params);
  83. }
  84. public function testRuidongsoil()
  85. {
  86. $provider = $this->getProvider('ruidongsoil', 'RefillOil');
  87. $resp = $provider->balance();
  88. }
  89. public function testpiaoxinfu()
  90. {
  91. // $provider = $this->getProvider('piaoxinfu');
  92. // $resp = $provider->balance();
  93. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  94. // $resp = $provider->query(['order_sn' => '38681683352226951436']);
  95. $body = '{"mchid":"10366","order_sn":"38681683352226951436","amount":"100.0000","cardno":"15811535608","trade_no":"0628430736696256875704","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"7762763f08b1ff20c753c6fc50653a74"}';
  96. $params = json_decode($body, true);
  97. $provider = $this->getProvider('piaoxinfu', 'RefillCallBack');
  98. $ret = $provider->verify($params);
  99. $resp = $provider->notify($params);
  100. }
  101. public function testpiaoxianfu()
  102. {
  103. // $provider = $this->getProvider('piaoxianfu');
  104. // $resp = $provider->balance();
  105. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  106. // $resp = $provider->query(['order_sn' => '94931683362066799924']);
  107. $body = '{"mchid":"10367","order_sn":"94931683362066799924","amount":"100.0000","cardno":"15811535608","trade_no":"5136770736706073064484","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"7e71573f0e9e53e362d296cc1c4a879e"}';
  108. $params = json_decode($body, true);
  109. $provider = $this->getProvider('piaoxianfu', 'RefillCallBack');
  110. $ret = $provider->verify($params);
  111. $resp = $provider->notify($params);
  112. }
  113. public function testchewshioil()
  114. {
  115. // $provider = $this->getProvider('chewshioil', 'RefillOil');
  116. // $resp = $provider->balance();
  117. // $resp = $provider->add(9030230005180327, 1, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  118. // $resp = $provider->query(['order_sn' => '59611683363163135042']);
  119. $body = '{"mchid":"10368","order_sn":"59611683363163135042","amount":"50.0000","cardno":"9030230005180327","trade_no":"2099050736707162680154","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"9bf10edf94747dd7a9b7418f563a7e1d"}';
  120. $params = json_decode($body, true);
  121. $provider = $this->getProvider('chewshioil', 'RefillCallBack');
  122. $ret = $provider->verify($params);
  123. $resp = $provider->notify($params);
  124. }
  125. public function testshenzhouoil()
  126. {
  127. // $provider = $this->getProvider('shenzhouoil', 'RefillOil');
  128. // $resp = $provider->balance();
  129. // $resp = $provider->add(9030230005180327, 1, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  130. // $resp = $provider->query(['order_sn' => '51541683363805589800']);
  131. $body = ' {"mchid":"10369","order_sn":"51541683363805589800","amount":"50.0000","cardno":"9030230005180327","trade_no":"5801670736707804867217","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"188ce678c8b1edee7a3c663dc4bbcef1"}';
  132. $params = json_decode($body, true);
  133. $provider = $this->getProvider('shenzhouoil', 'RefillCallBack');
  134. $ret = $provider->verify($params);
  135. $resp = $provider->notify($params);
  136. }
  137. public function testyouyi_sec()
  138. {
  139. // $provider = $this->getProvider('youyi_sec');
  140. // $resp = $provider->balance();
  141. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  142. // $resp = $provider->query(['order_sn' => '33521683511231388870']);
  143. $body = '{"mchid":"10370","order_sn":"33521683511231388870","amount":"100.0000","cardno":"15811535608","trade_no":"1306950736855230660323","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"9d0a6d906532bd4f843f9a12b9a9d07a"}';
  144. $params = json_decode($body, true);
  145. $provider = $this->getProvider('youyi_sec', 'RefillCallBack');
  146. $ret = $provider->verify($params);
  147. $resp = $provider->notify($params);
  148. }
  149. public function testruidongyinhua()
  150. {
  151. // $provider = $this->getProvider('ruidongyinhua');
  152. // $resp = $provider->balance();
  153. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  154. // $resp = $provider->query(['order_sn' => '48841683530671859794']);
  155. $body = '{"mchid":"10373","order_sn":"48841683530671859794","amount":"100.0000","cardno":"15811535608","trade_no":"0684220736874677847428","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"76ad023cbd17f2105efbcbfacfe10b0e"}';
  156. $params = json_decode($body, true);
  157. $provider = $this->getProvider('ruidongyinhua', 'RefillCallBack');
  158. $ret = $provider->verify($params);
  159. $resp = $provider->notify($params);
  160. }
  161. public function testxunzhong_y()
  162. {
  163. // $provider = $this->getProvider('xunzhong_y');
  164. // $resp = $provider->balance();
  165. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  166. // $resp = $provider->query(['order_sn' => '66421683531360403084']);
  167. $body = '{"mchid":"10371","order_sn":"66421683531360403084","amount":"100.0000","cardno":"15811535608","trade_no":"5302700736875363378022","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"151c8a38741802e7086bf5cd43db3c77"}';
  168. $params = json_decode($body, true);
  169. $provider = $this->getProvider('xunzhong_y', 'RefillCallBack');
  170. $ret = $provider->verify($params);
  171. $resp = $provider->notify($params);
  172. }
  173. public function testxunzhong_fy()
  174. {
  175. // $provider = $this->getProvider('xunzhong_fy');
  176. // $resp = $provider->balance();
  177. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  178. // $resp = $provider->query(['order_sn' => '68981683533001657006']);
  179. $body = '{"mchid":"10372","order_sn":"68981683533001657006","amount":"100.0000","cardno":"15811535608","trade_no":"2985110736877005874796","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"f6cffa129652c8b1a817219a4d994e2b"}';
  180. $params = json_decode($body, true);
  181. $provider = $this->getProvider('xunzhong_fy', 'RefillCallBack');
  182. $ret = $provider->verify($params);
  183. $resp = $provider->notify($params);
  184. }
  185. public function testyitong_y()
  186. {
  187. // $provider = $this->getProvider('yitong_y');
  188. // $resp = $provider->balance();
  189. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  190. // $resp = $provider->query(['order_sn' => '29271683536359007244']);
  191. $body = ' {"mchid":"10374","order_sn":"29271683536359007244","amount":"100.0000","cardno":"15811535608","trade_no":"5741420736880363464775","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"7883268a0181e8173abd08bad54eee06"}';
  192. $params = json_decode($body, true);
  193. $provider = $this->getProvider('yitong_y', 'RefillCallBack');
  194. $ret = $provider->verify($params);
  195. $resp = $provider->notify($params);
  196. }
  197. public function testyitong_fy()
  198. {
  199. // $provider = $this->getProvider('yitong_fy');
  200. // $resp = $provider->balance();
  201. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  202. // $resp = $provider->query(['order_sn' => '76031683537375332938']);
  203. $body = '{"mchid":"10375","order_sn":"76031683537375332938","amount":"100.0000","cardno":"15811535608","trade_no":"2795320736881378900649","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"ffe4abc8e8e735958761c84f12b05596"}';
  204. $params = json_decode($body, true);
  205. $provider = $this->getProvider('yitong_fy', 'RefillCallBack');
  206. $ret = $provider->verify($params);
  207. $resp = $provider->notify($params);
  208. }
  209. public function testjinyu_fy()
  210. {
  211. // $provider = $this->getProvider('jinyu_fy');
  212. // $resp = $provider->balance();
  213. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  214. // $resp = $provider->query(['order_sn' => '45841683538108468949']);
  215. $body = '{"mchid":"10376","order_sn":"45841683538108468949","amount":"100.0000","cardno":"15811535608","trade_no":"5844660736882112151284","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"075782438743f91df69eb1fd7cbdfa8c"}';
  216. $params = json_decode($body, true);
  217. $provider = $this->getProvider('jinyu_fy', 'RefillCallBack');
  218. $ret = $provider->verify($params);
  219. $resp = $provider->notify($params);
  220. }
  221. public function testyoujunfeinoy()
  222. {
  223. // $provider = $this->getProvider('youjunfeinoy');
  224. // $resp = $provider->balance();
  225. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  226. // $resp = $provider->query(['order_sn' => '34581683596361384735']);
  227. $body = ' {"mchid":"10377","order_sn":"34581683596361384735","amount":"100.0000","cardno":"15811535608","trade_no":"1706340736940360640370","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"20aa717255a00db9629c49dc62dd6a5e"}';
  228. $params = json_decode($body, true);
  229. $provider = $this->getProvider('youjunfeinoy', 'RefillCallBack');
  230. $ret = $provider->verify($params);
  231. $resp = $provider->notify($params);
  232. }
  233. public function testyoujunyesyi()
  234. {
  235. // $provider = $this->getProvider('youjunyesyi');
  236. // $resp = $provider->balance();
  237. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  238. // $resp = $provider->query(['order_sn' => '78531683597555218180']);
  239. $body = '{"mchid":"10378","order_sn":"78531683597555218180","amount":"100.0000","cardno":"15811535608","trade_no":"2389530736941560843382","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"865d23f61d5550de4a8b70368e6f2d97"}';
  240. $params = json_decode($body, true);
  241. $provider = $this->getProvider('youjunyesyi', 'RefillCallBack');
  242. $ret = $provider->verify($params);
  243. $resp = $provider->notify($params);
  244. }
  245. public function testyoulaicomeqy()
  246. {
  247. // $provider = $this->getProvider('youlaicomeqy');
  248. // $resp = $provider->balance();
  249. // $resp = $provider->add(18074608795, 4, 200, ['order_sn' => $this->make_sn(), 'product_code' => 'XYZ100777', 'goods_id' => 6978]);
  250. // $resp = $provider->query(['order_sn' => '28921683617219916086']);
  251. $body = '{"mchid":"10379","order_sn":"28921683617219916086","amount":"25.0000","cardno":"18074608795","trade_no":"3663720736961233028740","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"cfef1c27f0bdafa75a1d05ce4926f963"}';
  252. $params = json_decode($body, true);
  253. $provider = $this->getProvider('youlaicomeqy', 'RefillCallback');
  254. $ret = $provider->verify($params);
  255. $resp = $provider->notify($params);
  256. }
  257. public function testpyxdcyfeiyin()
  258. {
  259. // $provider = $this->getProvider('pyxdcyfeiyin');
  260. // $resp = $provider->balance();
  261. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  262. // $resp = $provider->query(['order_sn' => '29471683770402425621']);
  263. $body = '{"mchid":"10381","order_sn":"29471683770402425621","amount":"100.0000","cardno":"15811535608","trade_no":"6368240737114408408717","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"87d061ef82870f87b04622de2e577eed"}';
  264. $params = json_decode($body, true);
  265. $provider = $this->getProvider('pyxdcyfeiyin', 'RefillCallBack');
  266. $ret = $provider->verify($params);
  267. $resp = $provider->notify($params);
  268. }
  269. public function testBy_online()
  270. {
  271. $provider = $this->getProvider('by_online');
  272. $resp = $provider->balance();
  273. }
  274. public function testwogouyin()
  275. {
  276. // $provider = $this->getProvider('wogouyin');
  277. // $resp = $provider->balance();
  278. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  279. // $resp = $provider->query(['order_sn' => '37421683861949893781']);
  280. $body = ' {"mchid":"10382","order_sn":"37421683861949893781","amount":"100.0000","cardno":"15811535608","trade_no":"3719900737205950012826","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"55beae2820202f8262df4c9d4b2a8adb"}';
  281. $params = json_decode($body, true);
  282. $provider = $this->getProvider('wogouyin', 'RefillCallBack');
  283. $ret = $provider->verify($params);
  284. $resp = $provider->notify($params);
  285. }
  286. public function testruidongnofyin()
  287. {
  288. // $provider = $this->getProvider('ruidongnofyin');
  289. // $resp = $provider->balance();
  290. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  291. // $resp = $provider->query(['order_sn' => '70871684140929250680']);
  292. $body = '{"mchid":"10385","order_sn":"70871684140929250680","amount":"100.0000","cardno":"15811535608","trade_no":"3451730737484936482296","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"4a5cb2a91be10589a7b89757af50e7ab"}';
  293. $params = json_decode($body, true);
  294. $provider = $this->getProvider('ruidongnofyin', 'RefillCallBack');
  295. $ret = $provider->verify($params);
  296. $resp = $provider->notify($params);
  297. }
  298. public function testnanshantuopuzhic()
  299. {
  300. $provider = $this->getProvider('nanshantuopuzhic');
  301. $resp = $provider->balance();
  302. }
  303. public function testwogou_fy()
  304. {
  305. $provider = $this->getProvider('wogou_fy');
  306. // $resp = $provider->balance();
  307. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  308. $resp = $provider->query(['order_sn' => '75131684300921170045']);
  309. $body = '{"mchid":"10387","order_sn":"75131684300921170045","amount":"100.0000","cardno":"15811535608","trade_no":"2586760737644928771072","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"c83c138385c12aa3b995efaa77d7f793"}';
  310. $params = json_decode($body, true);
  311. $provider = $this->getProvider('wogou_fy', 'RefillCallBack');
  312. $ret = $provider->verify($params);
  313. $resp = $provider->notify($params);
  314. }
  315. public function testbyq_lansexiongdi()
  316. {
  317. $provider = $this->getProvider('byq_lansexiongdi');
  318. $resp = $provider->balance();
  319. }
  320. public function testhuanqiu_y()
  321. {
  322. // $provider = $this->getProvider('huanqiu_y');
  323. // $resp = $provider->balance();
  324. // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
  325. // $resp = $provider->query(['order_sn' => '21621684819321190603']);
  326. $body = ' {"mchid":"10388","order_sn":"21621684819321190603","amount":"100.0000","cardno":"15811535608","trade_no":"6235960738163323458311","idcard":"","card_name":"","official_sn":"","message":"fail","state":"CANCEL","sign":"ebad8695d4840e4a0e63160de44f3418"}';
  327. $params = json_decode($body, true);
  328. $provider = $this->getProvider('huanqiu_y', 'RefillCallBack');
  329. $ret = $provider->verify($params);
  330. $resp = $provider->notify($params);
  331. }
  332. }