|
@@ -12,6 +12,7 @@ require_once(BASE_ROOT_PATH . '/global.php');
|
|
|
require_once(BASE_CORE_PATH . '/lrlz.php');
|
|
|
require_once(BASE_ROOT_PATH . '/fooder.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
|
|
|
|
|
|
class TestRefillThird extends TestCase
|
|
|
{
|
|
@@ -44,7 +45,7 @@ class TestRefillThird extends TestCase
|
|
|
$ret = refill\util::push_add($params);
|
|
|
}
|
|
|
|
|
|
- public function testPushThird()
|
|
|
+ public function testPushLzThird()
|
|
|
{
|
|
|
$params = [ 'mchid' => 9618,
|
|
|
'buyer_id' => 6,
|
|
@@ -62,6 +63,24 @@ class TestRefillThird extends TestCase
|
|
|
$ret = refill\util::push_addthird($params);
|
|
|
}
|
|
|
|
|
|
+ public function testPushXYZThird()
|
|
|
+ {
|
|
|
+ $params = [ 'mchid' => 1092,
|
|
|
+ 'buyer_id' => 6,
|
|
|
+ 'amount' => refill\util::ThirdRefillAmount,
|
|
|
+ 'mch_order' => $this->make_sn(),
|
|
|
+ 'notify_url' => '',
|
|
|
+ 'org_quality' => 1,
|
|
|
+ 'card_type' => mtopcard\ThirdRefillCard,
|
|
|
+ 'card_no' => '403149064',
|
|
|
+ 'product_code' => 'XYZ100744',
|
|
|
+ 'quantity' => 5,
|
|
|
+ 'third_card_type' => 1
|
|
|
+ ];
|
|
|
+
|
|
|
+ $ret = refill\util::push_addthird($params);
|
|
|
+ }
|
|
|
+
|
|
|
private function make_sn()
|
|
|
{
|
|
|
return mt_rand(1000, 9999)
|
|
@@ -95,9 +114,11 @@ class TestRefillThird extends TestCase
|
|
|
|
|
|
public function testLingzhthirdPhone()
|
|
|
{
|
|
|
- $providers = new refill\lingzhthird\RefillPhone([]);
|
|
|
+ $providers = $this->getProvider('lingzhthird');
|
|
|
$resp = $providers->add(18500608333, 5, 10,
|
|
|
- ['order_sn' => $this->make_sn(),'goods_id' => 6559,'quantity'=>5,'product_code'=>'XYZ100744','third_card_type'=>1]);
|
|
|
+ ['order_sn' => $this->make_sn(),
|
|
|
+ 'goods_id' => 6559,
|
|
|
+ 'quantity'=>5,'product_code'=>'XYZ100744','third_card_type'=>1]);
|
|
|
// $resp = $providers->query(['order_sn' => '59911615124025101286']);
|
|
|
// $input['usr'] = 1;
|
|
|
// $input['ord'] = '52741615119546453690';
|
|
@@ -107,6 +128,28 @@ class TestRefillThird extends TestCase
|
|
|
// refill\RefillFactory::instance()->notify('lingzhthird',$input);
|
|
|
}
|
|
|
|
|
|
+ private function getProvider($name)
|
|
|
+ {
|
|
|
+ $file = BASE_HELPER_RAPI_PATH . "/$name/RefillPhone.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}\\RefillPhone";
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function testCallBack()
|
|
|
{
|
|
|
$body = '{"AppKey":"211394658","TimesTamp":"1620987358973","MOrderID":"7088040674302538334319","OrderID":"210514101558013001","State":"2","ChargeAccount":"403149064","Version":"1.0","BuyCount":"5","Attach":"","Sign":"BF8D2895A6C214931A511AE12EB9E8EE"}';
|