1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?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');
- class TestThirdRefill extends TestCase
- {
- public static function setUpBeforeClass() : void
- {
- Base::run_util();
- }
- public function testProviderPrice()
- {
- $thrid_refill = Model('thrid_refill');
- $product = $thrid_refill->getProviderProduct(34,1000,'LZPLM100591');
- }
- public function testMerchantPrice()
- {
- $thrid_refill = Model('thrid_refill');
- $price = $thrid_refill->getMerchantPrice(1,'LZ100465');
- }
- public function testSctongqian()
- {
- // $provider = new refill\sctongqian\RefillPhone([]);
- // $resp = $providers->CardOrderAdd(18500608333, 5, 50, ['order_sn' => $this->make_sn(), 'product_code' => 'PLM100024']);
- // $resp = $providers->query(['order_sn' => '84471620782999495754']);
- $data = '{"AppKey":"211394658","TimesTamp":"1620811809019","MOrderID":"84471620782999495754","OrderID":"210512093007747001","State":"2","ChargeAccount":"","Version":"1.0","BuyCount":"1","Attach":"","CardInfo":"HaDGHP8EECrqLl+Jlo1vqGP4Uws4dm9fd1msGnY3FBAPOQuvXcK9bd7Ffg5NKpkXLPH46\/dPGxM\/XR7UOXb4znxs9+7JOlCbw+AqdDJ2cxkzc\/euqHpc8VszvoUD6JpE1bgCaL0DdfCpcYhSzFOND7MnN+WIl+P\/jOn0j8k9I4Lfa2\/Y3\/V3TjKfc4CSnNTU0m+g8cGQ6AGJfSkNDbEg+RlcqW98nLWl\/+YO2wEnkzaMX2B966tjwuPIdsGZHntBXaIIJNwnQ4YWPlx8Hx6ms8s7QPYs8FuFDjdiJzlDEdjJyfyRIzsvY0LZYSZ9WWo8yqMtpulTzLrhVVjvxW7Upg==","Sign":"EEE6F112A14B38EF2BCA6BE37F030266"}';
- $params = json_decode($data, true);
- refill\RefillFactory::instance()->notify('sctongqian', $params);
- }
- public function testMerchantGoods()
- {
- $goods_list = refill\RefillFactory::instance()->goods();
- $sorter = function (array $items) {
- $ret = [];
- foreach ($items as $key => $val) {
- sort($val);
- $ret[$key] = $val;
- }
- return $ret;
- };
- $goods_list = $sorter($goods_list);
- $result = [];
- $mchid = 10254;
- $merchant_goods = rcache('merchant_goods', 'refill-', $mchid);
- $goods = $merchant_goods[$mchid] ?? serialize([]);
- $goods = unserialize($goods);
- foreach ($goods_list as $card_type => $value) {
- $key = mtopcard\scard_type($card_type);
- if (array_key_exists($key, $goods)) {
- $result[$key] = $goods[$key];
- } else {
- $result[$key] = $value;
- }
- }
- $thrid_refill = Model('thrid_refill');
- $pcode = $thrid_refill->getMerchantPcode($mchid);
- $result['third'] = $pcode;
- }
- }
|