getProvider('dixin_normal'); $order_sn = $this->make_sn(); $resp = $provider->add(13911129867, 5, 50, ['order_sn' => $order_sn, 'regin_no' => 1]); $resp = $provider->query(['order_sn' => $order_sn]); $resp = $provider->balance(); } public function testDixinCB() { $content = '{"order_no":"OD40636475187360296","merchant_no":"0059570753462761433314","recharge_account":"13911129867","recharge_status":4,"complete_time":"2023-11-16 15:12:42","settlement_price":"47.30","total_amount":"50.00","actual_amount":"0.00","create_time":"2023-11-16 15:12:41","custom_tag":"123456","sign":"49b7f9f32a34f1c83dcb0d976f28d061"}'; $provider = $this->getProvider('dixin_normal','RefillCallBack'); $content = json_decode($content,true); $provider->verify($content); $provider->notify($content); } public function testSuhu() { $provider = $this->getProvider('suhu_normal'); $order_sn = $this->make_sn(); $resp = $provider->add(13911129867, 5, 30, ['order_sn' => $order_sn, 'regin_no' => 1]); $resp = $provider->query(['order_sn' => $order_sn]); $resp = $provider->balance(); } public function testSuhuCB() { $content = '{"order_no":"OD40636475187360296","merchant_no":"0059570753462761433314","recharge_account":"13911129867","recharge_status":4,"complete_time":"2023-11-16 15:12:42","settlement_price":"47.30","total_amount":"50.00","actual_amount":"0.00","create_time":"2023-11-16 15:12:41","custom_tag":"123456","sign":"49b7f9f32a34f1c83dcb0d976f28d061"}'; $provider = $this->getProvider('suhu_normal','RefillCallBack'); $content = json_decode($content,true); $provider->verify($content); $provider->notify($content); } public function testSuhuWozhifu() { // $provider = $this->getProvider('suhu_wozhifu'); // $order_sn = $this->make_sn(); // $resp = $provider->add(13911129867, 5, 30, ['order_sn' => $order_sn, 'regin_no' => 1]); // $resp = $provider->query(['order_sn' => $order_sn]); // $resp = $provider->balance(); } public function testSuhuWozhifuCB() { // $content = '{"order_no":"OD40636475187360296","merchant_no":"0059570753462761433314","recharge_account":"13911129867","recharge_status":4,"complete_time":"2023-11-16 15:12:42","settlement_price":"47.30","total_amount":"50.00","actual_amount":"0.00","create_time":"2023-11-16 15:12:41","custom_tag":"123456","sign":"49b7f9f32a34f1c83dcb0d976f28d061"}'; // $provider = $this->getProvider('suhu_wozhifu','RefillCallBack'); // $content = json_decode($content,true); // $provider->verify($content); // $provider->notify($content); } public function testJson() { $val = json_encode(['account' => '13911129867']); } 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 testweisanhuo() { $provider = $this->getProvider('weisanhuo'); // $resp = $provider->balance(); // $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]); $resp = $provider->query(['order_sn' => '24271700815859899563-9']); $post = '{"operatorTradeNo":"","statusDesc":"δΊ€ζ˜“ζˆεŠŸ","phone":"18780103116","outTradeNo":"202309250000000006","sign":"d793406757c1bb920fe518e9673a28ea","inTradeNo":"202309251766523539","status":"success","reportTime":"1695607732705"}'; $data = json_decode($post, true); $provider = $this->getProvider('weisanhuo', 'RefillCallBack'); $ret = $provider->verify($data); // $resp = $provider->notify($data); } }