|
@@ -0,0 +1,81 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+use PHPUnit\Framework\TestCase;
|
|
|
+use refill\lingzhdl\config;
|
|
|
+
|
|
|
+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_HELPER_PATH . '/refill/RefillFactory.php');
|
|
|
+
|
|
|
+class TestRefillThird extends TestCase
|
|
|
+{
|
|
|
+ public static function setUpBeforeClass(): void
|
|
|
+ {
|
|
|
+ Base::run_util();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testProvider()
|
|
|
+ {
|
|
|
+ $provider = new refill\ProviderManager();
|
|
|
+ $provider->load();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testAddthird()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testPushThird()
|
|
|
+ {
|
|
|
+ $params = [ 'mchid' => 9618,
|
|
|
+ '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' => 'LZ100744',
|
|
|
+ 'quantity' => 5,
|
|
|
+ 'third_card_type' => 1
|
|
|
+ ];
|
|
|
+
|
|
|
+ $ret = refill\util::push_addthird($params);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function make_sn()
|
|
|
+ {
|
|
|
+ return mt_rand(1000, 9999)
|
|
|
+ . sprintf('%010d', time())
|
|
|
+ . sprintf('%06d', (float)microtime() * 1000000);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function params($card_no,$card_type,$quantity,$pcode,$order_sn)
|
|
|
+ {
|
|
|
+ $params['act'] = 'lzrefill';
|
|
|
+ $params['op'] = 'add_third';
|
|
|
+ $params['notifyurl'] = config::NOTIFY_URL;
|
|
|
+ $params['usr'] = config::USR;
|
|
|
+
|
|
|
+ $params['card_no'] = $card_no;
|
|
|
+ $params['quantity'] = $quantity;
|
|
|
+ $params['product_code'] = $pcode;
|
|
|
+ $params['card_type'] = $card_type;
|
|
|
+
|
|
|
+ $params['ord'] = $order_sn;
|
|
|
+ $params['tim'] = date("YmdHis");
|
|
|
+ $params['yysid'] = 0;
|
|
|
+ $params['hmlx'] = 0;
|
|
|
+ return $params;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testInstance()
|
|
|
+ {
|
|
|
+ refill\RefillFactory::instance()->notify_merchant(1,false);
|
|
|
+ }
|
|
|
+}
|