From 4dbd4eaacdef8fddeeb71929b883235f357a005b Mon Sep 17 00:00:00 2001 From: Tony Zou Date: Sun, 27 Jan 2019 11:11:06 +0800 Subject: [PATCH] update: shorter url for trimepay wepay_jspi. --- app/Services/Gateway/TrimePay.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Services/Gateway/TrimePay.php b/app/Services/Gateway/TrimePay.php index e8b86713..a40da4b4 100644 --- a/app/Services/Gateway/TrimePay.php +++ b/app/Services/Gateway/TrimePay.php @@ -64,8 +64,10 @@ class TrimePay extends AbstractPayment public function post($data, $type = "pay"){ if ($type == "pay"){ $this->gatewayUri .= "pay/go"; - } else { + } else if ($type == "refund") { $this->gatewayUri .= "refund/go"; + } else { + $this->gatewayUri .= "pay/pre"; } $curl = curl_init(); @@ -110,8 +112,7 @@ class TrimePay extends AbstractPayment $data['sign'] = self::sign($params); switch ($type) { case('WEPAY_JSAPI'): - $result['code'] = 0; - $result['data'] = "http://cashier.hlxpay.com/jsapi.html?payData=".base64_encode(json_encode($data)); + $result = json_decode(self::post($data, $type = "pre"), TRUE); $result['pid'] = $pl->tradeno; return json_encode($result); default: