junfei 6 éve
szülő
commit
ca81a3132a
1 módosított fájl, 15 hozzáadás és 15 törlés
  1. 15 15
      app/controller/Index.php

+ 15 - 15
app/controller/Index.php

@@ -271,20 +271,26 @@ class Index extends BaseController
     function payment()
     {
 
-
         $url                     = "https://www.apifabric.com.cn/apiaccess/payment/paymentGateway/checkout/v1/payment";
-        $params                  = [];
-        $params['smsTemplateId'] = '695db7b5-6d4f-4791-aea0-f733f2ef06ce';
-        $paramValues             = [];
-        $paramValues['user']     = 'test1';
-        $params['paramValues']   = $paramValues; //        paramValues:{"user":"XXX"}
-        $params['msisdn']        = '8613162836361';
 
-        $params = json_encode($params);
+        $params = [
+            'originalAmount' => '6',
+            'currency' => 'USD',
+            'intent' => 'sale',
+            'shortCode' => '100000703',
+            'commodityDesc' => 'PGW payment',
+            'note2Payer' => 'Good Choice',
+            'merchantInvoiceNumber' => 'abc',
+            'discountedAmount' => '1',
+        ];
+
+        $params['originalAmount'] = I('price');
 
 
-        $params = '{"originalAmount":"6","currency":"USD","intent":"sale","shortCode":"100000703","commodityDesc":"PGW payment","note2Payer":"Good Choice","merchantInvoiceNumber":"abc","discountedAmount":"1"}';
+        //$params = '{"originalAmount":"6","currency":"USD","intent":"sale","shortCode":"100000703","commodityDesc":"PGW payment","note2Payer":"Good Choice","merchantInvoiceNumber":"abc","discountedAmount":"1"}';
 
+        //$params = var_export(json_decode($params,true),true);
+        $params = json_encode($params);
 
         $headers[] = 'X-APP-Key: APP ID';
         $headers[] = 'Authorization:Bearer Access-Token';
@@ -302,9 +308,6 @@ class Index extends BaseController
         //{"payeeName":"100000703","paymentID":"PP27F16000000000051006","commodityDesc":"PGW payment","note2Payer":"Good Choice","mctBusinessType":"Acquiring","createTime":"20190715172333","custPaymentType":"Consumption","amount":"9.00","originalAmount":"10.00","discountedAmount":"1.00","paymentStatus":"Unpaid","merchantInvoiceNumber":"abc","merchantName":"test3","intent":"sale"}
         //
 
-        $input = file_get_contents("php://input");
-        $input = json_decode($input,true);
-        $paymentID = $input['paymentID'];
         $paymentID          = 'PP27F16000000000051006';
         $url                = "https://www.apifabric.com.cn/apiaccess/payment/paymentGateway/checkout/v1/{$paymentID}/execute";
         $params             = [];
@@ -315,9 +318,6 @@ class Index extends BaseController
         $headers[] = 'Authorization:Bearer Access-Token';
         $headers[] = 'Content-Type: application/json; charset=UTF-8';
         $ret       = curl_post_json_pay($url, $params, $headers);
-        $ret = json_decode($ret,true);
-        $ret['isSuccess'] = true;
-        return jsonp($ret);
 
     }