123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
- require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
- const LocalTest = 1;
- const NetTest = 2;
- const CurrentTest = NetTest;
- class TestRefillZY extends TestCase
- {
- public function __construct(?string $name = null, array $data = [], $dataName = '')
- {
- parent::__construct($name, $data, $dataName);
- if (CurrentTest == LocalTest) {
- $this->mReqHost = BASE_SITE_URL;
- $this->mMchid = 1;
- $this->mKey = '1ff02223b771c0414468c8892151c602';
- } else {
- $this->mReqHost = 'https://ylapi.xyzshops.cn';
- $this->mMchid = 1092;
- $this->mKey = '210fe406954220f56085997d6a4c5b80';
- }
- }
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- refill\RefillFactory::instance();
- }
- private function getProvider($name,$type = 'RefillPhone')
- {
- $file = BASE_HELPER_RAPI_PATH . "/$name/{$type}.php";
- if(!file_exists($file)){
- Log::record("provider api file={$file} not exist.",Log::DEBUG);
- return false;
- } else {
- require_once($file);
- Log::record("file={$file} load success.",Log::DEBUG);
- }
- $class_name = "refill\\{$name}\\{$type}";
- if (class_exists($class_name, false)) {
- $caller = new $class_name([]);
- return $caller;
- } else {
- $error = "Base Error: class {$class_name} isn't exists!";
- Log::record($error, Log::ERR);
- return false;
- }
- }
- private function make_sn()
- {
- return mt_rand(1000, 9999)
- . sprintf('%010d', time())
- . sprintf('%06d', (float)microtime() * 1000000);
- }
- public function testByq_tianrui()
- {
- // $provider = $this->getProvider('byq_tianrui');
- // $resp = $provider->balance();
- // $resp = $provider->add(18074608795, 4, 200, ['order_sn' => $this->make_sn(), 'product_code' => 'XYZ100777', 'goods_id' => 6978]);
- // $resp = $provider->query(['order_sn' => '69131683255011805153']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('byq_tianrui', 'RefillCallback');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testBy_shehzhou()
- {
- // $provider = $this->getProvider('by_shehzhou');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '12451683256478050996']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('by_shehzhou', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testRuidongsoil()
- {
- $provider = $this->getProvider('ruidongsoil', 'RefillOil');
- $resp = $provider->balance();
- }
- public function testpiaoxinfu()
- {
- // $provider = $this->getProvider('piaoxinfu');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '38681683352226951436']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('piaoxinfu', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testpiaoxianfu()
- {
- // $provider = $this->getProvider('piaoxianfu');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '94931683362066799924']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('piaoxianfu', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testchewshioil()
- {
- // $provider = $this->getProvider('chewshioil', 'RefillOil');
- // $resp = $provider->balance();
- // $resp = $provider->add(9030230005180327, 1, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '59611683363163135042']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('chewshioil', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testshenzhouoil()
- {
- // $provider = $this->getProvider('shenzhouoil', 'RefillOil');
- // $resp = $provider->balance();
- // $resp = $provider->add(9030230005180327, 1, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '51541683363805589800']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('shenzhouoil', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyouyi_sec()
- {
- // $provider = $this->getProvider('youyi_sec');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '33521683511231388870']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('youyi_sec', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testruidongyinhua()
- {
- // $provider = $this->getProvider('ruidongyinhua');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '48841683530671859794']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('ruidongyinhua', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testxunzhong_y()
- {
- // $provider = $this->getProvider('xunzhong_y');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '66421683531360403084']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('xunzhong_y', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testxunzhong_fy()
- {
- // $provider = $this->getProvider('xunzhong_fy');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '68981683533001657006']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('xunzhong_fy', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyitong_y()
- {
- // $provider = $this->getProvider('yitong_y');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '29271683536359007244']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('yitong_y', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyitong_fy()
- {
- // $provider = $this->getProvider('yitong_fy');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '76031683537375332938']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('yitong_fy', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testjinyu_fy()
- {
- // $provider = $this->getProvider('jinyu_fy');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '45841683538108468949']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('jinyu_fy', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyoujunfeinoy()
- {
- // $provider = $this->getProvider('youjunfeinoy');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '34581683596361384735']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('youjunfeinoy', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyoujunyesyi()
- {
- // $provider = $this->getProvider('youjunyesyi');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '78531683597555218180']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('youjunyesyi', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testyoulaicomeqy()
- {
- // $provider = $this->getProvider('youlaicomeqy');
- // $resp = $provider->balance();
- // $resp = $provider->add(18074608795, 4, 200, ['order_sn' => $this->make_sn(), 'product_code' => 'XYZ100777', 'goods_id' => 6978]);
- // $resp = $provider->query(['order_sn' => '28921683617219916086']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('youlaicomeqy', 'RefillCallback');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testpyxdcyfeiyin()
- {
- // $provider = $this->getProvider('pyxdcyfeiyin');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '29471683770402425621']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('pyxdcyfeiyin', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testBy_online()
- {
- $provider = $this->getProvider('by_online');
- $resp = $provider->balance();
- }
- public function testwogouyin()
- {
- // $provider = $this->getProvider('wogouyin');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '37421683861949893781']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('wogouyin', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testruidongnofyin()
- {
- // $provider = $this->getProvider('ruidongnofyin');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '70871684140929250680']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('ruidongnofyin', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testnanshantuopuzhic()
- {
- $provider = $this->getProvider('nanshantuopuzhic');
- $resp = $provider->balance();
- }
- public function testwogou_fy()
- {
- $provider = $this->getProvider('wogou_fy');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- $resp = $provider->query(['order_sn' => '75131684300921170045']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('wogou_fy', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- public function testbyq_lansexiongdi()
- {
- $provider = $this->getProvider('byq_lansexiongdi');
- $resp = $provider->balance();
- }
- public function testhuanqiu_y()
- {
- // $provider = $this->getProvider('huanqiu_y');
- // $resp = $provider->balance();
- // $resp = $provider->add(15811535608, 4, 100, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
- // $resp = $provider->query(['order_sn' => '21621684819321190603']);
- $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"}';
- $params = json_decode($body, true);
- $provider = $this->getProvider('huanqiu_y', 'RefillCallBack');
- $ret = $provider->verify($params);
- $resp = $provider->notify($params);
- }
- }
|