xiaoyu преди 3 години
родител
ревизия
3926a5d93d

+ 46 - 1
data/config/xyz/refill.ini.php

@@ -5436,6 +5436,51 @@ $jike_phone = ['name' => 'jike', 'store_id' => 211, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$jumeng_phone = ['name' => 'jumeng', 'store_id' => 215, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7797, 'price' => 9.61, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7797, 'price' => 9.44, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7797, 'price' => 9.44, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7798, 'price' => 19.22, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7798, 'price' => 18.88, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7798, 'price' => 18.88 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 7799, 'price' => 28.83, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7799, 'price' => 28.32, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7799, 'price' => 28.32, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7800, 'price' => 48.05, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7800, 'price' => 47.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7800, 'price' => 47.2, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7801, 'price' => 96.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7801, 'price' => 94.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7801, 'price' => 94.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7802, 'price' => 192.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7802, 'price' => 188.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7802, 'price' => 188.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 7803, 'price' => 288.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7803, 'price' => 283.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7803, 'price' => 283.2, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7804, 'price' => 480.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7804, 'price' => 472, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7804, 'price' => 472, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -5609,7 +5654,7 @@ $phone_providers = [
     ['name' => 'huoshenguoman', 'cfg' => $huoshenguoman_phone],
     ['name' => 'guitong', 'cfg' => $guitong_phone],
     ['name' => 'jike', 'cfg' => $jike_phone],
-
+    ['name' => 'jumeng', 'cfg' => $jumeng_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 2 - 2
helper/refill/api/xyz/shantong/RefillCallBack.php

@@ -10,7 +10,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $input = $params;
         unset($input['sign']);
-        $sign = $this->sign($input);
+        $sign = config::sign($input);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -23,7 +23,7 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['orderId'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+//            return [false, false, false,false];
         }
 
         $order_id = $order_info['order_id'];

+ 14 - 6
helper/refill/api/xyz/shantong/RefillPhone.php

@@ -26,7 +26,9 @@ class RefillPhone extends refill\IRefillPhone
 
     public function add($card_no, $card_type, $amount, $input, &$net_errno = 0)
     {
-        $params = $this->req_params($card_no, $amount, $input['order_sn']);
+        $params = config::pub_params();
+        $data = $this->req_params($card_no, $amount, $input['order_sn']);
+        $params['reqData'] = json_encode($data);
         $params['sign'] = config::sign($params);
 
         $params = json_encode($params);
@@ -53,9 +55,12 @@ class RefillPhone extends refill\IRefillPhone
 
     public function query($refill_info)
     {
-        $params['orderId'] = $refill_info['order_sn'];
-        $params['agentId'] = config::AGENT_ID;
-        $params['transactionPin'] = config::transactionPin;
+        $params = config::pub_params();
+
+        $data['orderId'] = $refill_info['order_sn'];
+        $data['agentId'] = config::AGENT_ID;
+        $data['transactionPin'] = config::transactionPin;
+        $params['reqData'] = json_encode($data);
         $params['sign'] = config::sign($params);
 
         $params = json_encode($params);
@@ -100,8 +105,11 @@ class RefillPhone extends refill\IRefillPhone
 
     public function balance()
     {
-        $params['agentId'] = config::AGENT_ID;
-        $params['transactionPin'] = config::transactionPin;
+        $params = config::pub_params();
+
+        $data['agentId'] = config::AGENT_ID;
+        $data['transactionPin'] = config::transactionPin;
+        $params['reqData'] = json_encode($data);
         $params['sign'] = config::sign($params);
 
         $params = json_encode($params);

+ 3 - 6
helper/refill/api/xyz/shantong/config.php

@@ -11,9 +11,8 @@ class config
     const transactionPin = 'Qwer@1234';
     const APP_ID = 'cz_1004';
     const APP_KEY = '3c7795c7-beb3-45fc-b764-98c270062c90';
-    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_shantong.php";
-
-
+//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_shantong.php";
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
     const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
 
     private static function createNoncestr( $length = 32 )
@@ -35,10 +34,8 @@ class config
         return $params;
     }
 
-    public static function sign($reqData)
+    public static function sign($params)
     {
-        $params = self::pub_params();
-        $params['reqData'] = $reqData;
         ksort($params);
         $content = '';
         foreach ($params as $key => $value) {

+ 4 - 0
mobile/callback/refill_jumeng.php

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

+ 22 - 2
test/TestRefill.php

@@ -2145,10 +2145,30 @@ class TestRefill extends TestCase
 
     public function testJumeng()
     {
-        $provider = $this->getProvider('jumeng');
-        $resp = $provider->balance();
+//        $provider = $this->getProvider('jumeng');
+//        $resp = $provider->balance();
 //        $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
 //        $resp = $provider->query(['order_sn' => '61891650433011979641']);
+
+        $body = '{"orderid":"NRG22042415190852684","sporderid":"54521650784779022915","userid":"10002591","merchantsubmittime":"20220424152241","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.32","sign":"315A02F52F772BFBE681541DC5D5A68F"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('jumeng','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
+    public function testShantong()
+    {
+//        $provider = $this->getProvider('shantong');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '35151650783370889788']);
+
+        $body = '{"orderId":"35151650783370889788","mobile":"18500608333","sign":"5a9295de0cab6b85c182a968a53b7f19","orderStatus":99,"businessOrderId":"10040424100000001","finishDate":"2022-04-24 14:56:24","perValue":100}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('shantong','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
     }
 
     public function testAmingjd()