浏览代码

add by_online

stanley-king 1 年之前
父节点
当前提交
f968d39a15

+ 2 - 3
helper/refill/api/yl/by_online/API信息.txt

@@ -1,10 +1,9 @@
 测试域名 http://commapitest.bjzykj.work
 正式域名 http://commapi.bjzykj.work
 
-appId 1 商户编号(需要同运
-营开通)
+APPid:7
 version 1.0 版本号 默认 1.0
-sign 123456 签名密钥
+APPkey:Hfhsej959bReF4B
 
 
 1 北京

helper/refill/api/yl/by_online/RefillCallBack.php → helper/refill/api/xyz/by_online/RefillCallBack.php


+ 8 - 8
helper/refill/api/yl/by_online/RefillPhone.php

@@ -19,7 +19,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['appId'] = config::APP_ID;
         $params['version'] = '1.0';
         $params['merchantOrderNo'] = $order_sn;
-        $params['productId'] = config::ProductIdS[$card_type][$amount];
+        $params['productId'] = 1;
         $params['account'] = "{$phone}";
         $params['amt'] = $amount * 100;
         $params['callbackUrl'] = config::NOTIFY_URL;
@@ -30,18 +30,19 @@ class RefillPhone extends refill\IRefillPhone
         return $params;
     }
 
-    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0)
     {
         $regin_no = $params['regin_no'] ?? -1;
-        if($regin_no <= 0) {
+        if ($regin_no <= 0) {
             return [false, '省份获取错误', false];
         }
+
         $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn'], $regin_no);
         $sign = config::sign($params);
         $params['sign'] = $sign;
 
         $params = json_encode($params);
-        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders, $net_errno);
+        $resp = http_post_data(config::ORDER_URL, $params, config::ExtHeaders, $net_errno);
 
         if (empty($resp)) {
             return [false, '系统错误', true];
@@ -92,6 +93,7 @@ class RefillPhone extends refill\IRefillPhone
                 } else {
                     return [false, $status];
                 }
+
                 return [true, $order_state];
             }
             else {
@@ -111,15 +113,13 @@ class RefillPhone extends refill\IRefillPhone
 
         if (empty($resp)) {
             return [false, '系统错误'];
-        }
-        else
-        {
+        } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '系统错误'];
             } elseif ($resp['code'] === 1000) {
-                return [true, $resp['data']['balance']*100];
+                return [true, $resp['data']['balance'] * 100];
             } else {
                 return [false, $resp['msg']];
             }

+ 6 - 36
helper/refill/api/yl/by_online/config.php

@@ -1,46 +1,17 @@
 <?php
 namespace refill\by_online;
 
-use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://commapitest.bjzykj.work/comm/recharge';
-    const QUERY_URL = 'http://commapitest.bjzykj.work/comm/orderQuery';
-    const BALANCE_URL = 'http://commapitest.bjzykj.work/comm/account';
-
-    const APP_ID = '1';
-    const APP_KEY = 's33obkIGnCxgMM1eIXR95KSDSKgQdb6W';
-//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_by_online.php";
-    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const ORDER_URL = 'http://commapi.bjzykj.work/comm/recharge';
+    const QUERY_URL = 'http://commapi.bjzykj.work/comm/orderQuery';
+    const BALANCE_URL = 'http://commapi.bjzykj.work/comm/account';
 
+    const APP_ID = '7';
+    const APP_KEY = 'Hfhsej959bReF4B';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_by_online.php";
     const ExtHeaders = ['Content-Type: application/json'];
 
-    const ProductIdS = [
-        mtopcard\ChinaMobileCard =>
-            [
-                50  => '10003',
-                100 => '10004',
-                200 => '10005',
-                300 => '10006',
-                500 => '10007',
-            ],
-        mtopcard\ChinaUnicomCard =>
-            [
-                50  => '1',
-                100 => '10012',
-                200 => '10013',
-                300 => '10014',
-            ],
-        mtopcard\ChinaTelecomCard =>
-            [
-                50  => '10019',
-                100 => '10020',
-                200 => '10021',
-                300 => '10022',
-                500 => '10023',
-            ],
-    ];
-
     public static function sign($params)
     {
         ksort($params);
@@ -85,5 +56,4 @@ class config
         30	=> 30, //'宁夏',
         31	=> 31  //'新疆'
     ];
-
 }

helper/refill/api/yl/by_online/纸莺运营商数据管理平台对外接口.pdf → helper/refill/api/xyz/by_online/纸莺运营商数据管理平台对外接口.pdf


+ 4 - 0
mobile/callback/refill_by_online.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('by_online',$_POST);
+echo ('success');

+ 15 - 0
test/TestRefill.php

@@ -3340,6 +3340,21 @@ class TestRefill extends TestCase
 //        $resp = $provider->notify($params);
     }
 
+    public function testBy_online()
+    {
+//        $provider = $this->getProvider('by_online');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
+//        $resp = $provider->query(['order_sn' => '13041683603793048767']);
+
+        $body = '{"appId":"1","merchantorder_no":"13041683603793048767","order_sn":"2023050911432028374556511004","pay_mobile":"18500608333","amount":"5000","real_price":"5000","order_status":"7","extra":"","pay_time":"2023-05-09 11:43:22","completion_time":"2023-05-09 11:43:22","sign":"bdf57f1437a1ee4cdbbe62f0f44e98cd"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('by_online', 'RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+
+    }
+
     public function testAmingjd()
     {
 //        $provider = new refill\amingjd\RefillPhone([]);

+ 0 - 15
test/TestRefillYl.php

@@ -981,21 +981,6 @@ class TestRefillYl extends TestCase
         $resp = $provider->balance();
     }
 
-    public function testBy_online()
-    {
-//        $provider = $this->getProvider('by_online');
-//        $resp = $provider->balance();
-//        $resp = $provider->add(18500608333, 5, 50, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
-//        $resp = $provider->query(['order_sn' => '70831682580641580700']);
-
-        $body = '{"appId":"1","merchantorder_no":"70831682580641580700","order_sn":"2023042715304843866056509749","pay_mobile":"18500608333","amount":"5000","real_price":"5000","order_status":"7","extra":"","pay_time":"2023-04-27 15:30:48","completion_time":"2023-04-27 15:30:48","sign":"4ac35a9afc969eb7ad972d43909c8b41"}';
-        $params = json_decode($body, true);
-        $provider = $this->getProvider('by_online', 'RefillCallBack');
-        $ret = $provider->verify($params);
-        $resp = $provider->notify($params);
-
-    }
-
     public function testcomeoil()
     {
 //        $provider = $this->getProvider('comeoil', 'RefillOil');