소스 검색

add ispname to commit

stanley-king 1 년 전
부모
커밋
811342a0bb
2개의 변경된 파일22개의 추가작업 그리고 1개의 파일을 삭제
  1. 21 0
      helper/refill/api/mh/kefei_fast/RefillPhone.php
  2. 1 1
      test/mh/TestRefill.php

+ 21 - 0
helper/refill/api/mh/kefei_fast/RefillPhone.php

@@ -4,6 +4,7 @@ namespace refill\kefei_fast;
 
 require_once(BASE_HELPER_RAPI_PATH . '/kefei_fast/config.php');
 
+use app\api\venderapi\card_checker\mtopcard;
 use refill;
 use Log;
 
@@ -17,12 +18,32 @@ class RefillPhone extends refill\IRefillPhone
     //[$state, $errmsg, $neterr]
     public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
     {
+        $typer = function ($card_type)
+        {
+            $types = [
+                4 => '移动',
+                5 => '联通',
+                6 => '电信'
+            ];
+
+            if(array_key_exists($card_type,$types)) {
+                return $types[$card_type];
+            } else {
+                return false;
+            }
+        };
+        $ispName = $typer($card_type);
+        if(empty($ispName)) {
+            return [false, '运营商错误', false];
+        }
+
         $input = [
             "action" => "CZ",
             "orderId" => $params['order_sn'],
             "chargeAcct" => "$card_no",
             "chargeCash" => "$amount",
             "chargeType" => "0",
+            'ispName' => urlencode($ispName),
             "retUrl" => urlencode(config::NOTIFY_URL)
         ];
 

+ 1 - 1
test/mh/TestRefill.php

@@ -133,7 +133,7 @@ class TestRefill extends TestCase
     {
         $provider = $this->getProvider('kefei_fast');
         $order_sn = $this->make_sn();
-        $resp = $provider->add(13911220681, 4, 1, ['order_sn' => $order_sn, 'regin_no' => 1]);//30为测试产品
+        $resp = $provider->add(13911129867, 4, 1, ['order_sn' => $order_sn, 'regin_no' => 1]);//30为测试产品
         $resp = $provider->query(['order_sn' => $order_sn]);
         $resp = $provider->balance();
     }