@@ -16,11 +16,11 @@ |
||
| 16 | 16 | class Trade |
| 17 | 17 | { |
| 18 | 18 | //交易类型 |
| 19 | - const TYPE_NATIVE = 'NATIVE';//原生扫码支付 |
|
| 20 | - const TYPE_JS_API = 'JSAPI';//应用内JS API,如微信 |
|
| 21 | - const TYPE_APP = 'APP';//app支付 |
|
| 22 | - const TYPE_H5 = 'WAP';//H5支付 |
|
| 23 | - const TYPE_PC = 'PC';//PC支付 |
|
| 24 | - const TYPE_MICROPAY = 'MICROPAY';//刷卡支付 |
|
| 25 | - const TYPE_OFFLINE = 'OFFLINE';//离线(汇款、转账等)支付 |
|
| 19 | + const TYPE_NATIVE = 'NATIVE'; //原生扫码支付 |
|
| 20 | + const TYPE_JS_API = 'JSAPI'; //应用内JS API,如微信 |
|
| 21 | + const TYPE_APP = 'APP'; //app支付 |
|
| 22 | + const TYPE_H5 = 'WAP'; //H5支付 |
|
| 23 | + const TYPE_PC = 'PC'; //PC支付 |
|
| 24 | + const TYPE_MICROPAY = 'MICROPAY'; //刷卡支付 |
|
| 25 | + const TYPE_OFFLINE = 'OFFLINE'; //离线(汇款、转账等)支付 |
|
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | * @var array 交易类型和Trade映射 |
| 68 | 68 | */ |
| 69 | 69 | public $tradeTypeMap = [ |
| 70 | - Gateway::TRADE_TYPE_NATIVE => 'NATIVE',//WEB 原生扫码支付 |
|
| 71 | - Gateway::TRADE_TYPE_JS_API => 'JSAPI',//应用内JS API,如微信 |
|
| 72 | - Gateway::TRADE_TYPE_APP => 'APP',//app支付 |
|
| 73 | - Gateway::TRADE_TYPE_H5 => 'MWEB',//H5支付 |
|
| 74 | - Gateway::TRADE_TYPE_MICROPAY => 'MICROPAY',//刷卡支付 |
|
| 70 | + Gateway::TRADE_TYPE_NATIVE => 'NATIVE', //WEB 原生扫码支付 |
|
| 71 | + Gateway::TRADE_TYPE_JS_API => 'JSAPI', //应用内JS API,如微信 |
|
| 72 | + Gateway::TRADE_TYPE_APP => 'APP', //app支付 |
|
| 73 | + Gateway::TRADE_TYPE_H5 => 'MWEB', //H5支付 |
|
| 74 | + Gateway::TRADE_TYPE_MICROPAY => 'MICROPAY', //刷卡支付 |
|
| 75 | 75 | ]; |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | parent::init(); |
| 84 | 84 | if (empty ($this->appId)) { |
| 85 | - throw new InvalidConfigException ('The "appId" property must be set.'); |
|
| 85 | + throw new InvalidConfigException('The "appId" property must be set.'); |
|
| 86 | 86 | } |
| 87 | 87 | if (empty ($this->apiKey)) { |
| 88 | - throw new InvalidConfigException ('The "apiKey" property must be set.'); |
|
| 88 | + throw new InvalidConfigException('The "apiKey" property must be set.'); |
|
| 89 | 89 | } |
| 90 | 90 | if (empty ($this->mchId)) { |
| 91 | - throw new InvalidConfigException ('The "mchId" property must be set.'); |
|
| 91 | + throw new InvalidConfigException('The "mchId" property must be set.'); |
|
| 92 | 92 | } |
| 93 | 93 | $this->initPrivateKey(); |
| 94 | 94 | $this->initPublicKey(); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | throw new InvalidConfigException(openssl_error_string()); |
| 116 | 116 | } |
| 117 | 117 | } else { |
| 118 | - throw new InvalidConfigException ('The "privateKey" property must be set.'); |
|
| 118 | + throw new InvalidConfigException('The "privateKey" property must be set.'); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | throw new InvalidConfigException(openssl_error_string()); |
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | - throw new InvalidConfigException ('The "publicKey" property must be set.'); |
|
| 135 | + throw new InvalidConfigException('The "publicKey" property must be set.'); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } elseif ($this->signType == self::SIGNATURE_METHOD_SHA256) { |
| 158 | 158 | $sign = hash_hmac('sha256', $bizString, $this->apiKey); |
| 159 | 159 | } else { |
| 160 | - throw new InvalidConfigException ('This encryption is not supported'); |
|
| 160 | + throw new InvalidConfigException('This encryption is not supported'); |
|
| 161 | 161 | } |
| 162 | 162 | return strtoupper($sign); |
| 163 | 163 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $weParams = $trade->user->socialAccounts['wechat']->getDecodedData(); |
| 199 | 199 | $data['openid'] = $weParams['openid']; |
| 200 | 200 | } else { |
| 201 | - throw new PaymentException ('Non-WeChat authorized login.'); |
|
| 201 | + throw new PaymentException('Non-WeChat authorized login.'); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | $response = $this->post('pay/unifiedorder', $data)->send(); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | throw new PaymentException($response->data['return_msg']); |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | - throw new Exception ('Http request failed.'); |
|
| 213 | + throw new Exception('Http request failed.'); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |