Completed
Push — master ( 326a90...9c76fe )
by Xu
966:36 queued 926:32
created
src/payment/channels/WeChat.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      * @var array 交易类型和Trade映射
72 72
      */
73 73
     public $tradeTypeMap = [
74
-        self::TRADE_TYPE_QR_CODE => 'NATIVE',//WEB 原生扫码支付
75
-        self::TRADE_TYPE_JS_API => 'JSAPI',//应用内JS API,如微信
76
-        self::TRADE_TYPE_APP => 'APP',//app支付
77
-        self::TRADE_TYPE_WAP => 'MWEB',//H5支付
78
-        self::TRADE_TYPE_POS => 'MICROPAY',//刷卡支付
74
+        self::TRADE_TYPE_QR_CODE => 'NATIVE', //WEB 原生扫码支付
75
+        self::TRADE_TYPE_JS_API => 'JSAPI', //应用内JS API,如微信
76
+        self::TRADE_TYPE_APP => 'APP', //app支付
77
+        self::TRADE_TYPE_WAP => 'MWEB', //H5支付
78
+        self::TRADE_TYPE_POS => 'MICROPAY', //刷卡支付
79 79
         self::TRADE_TYPE_WEB => 'NATIVE'//PC支付
80 80
     ];
81 81
 
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
             trigger_error('need openssl support sha256', E_USER_ERROR);
91 91
         }
92 92
         if (empty ($this->appId)) {
93
-            throw new InvalidConfigException ('The "appId" property must be set.');
93
+            throw new InvalidConfigException('The "appId" property must be set.');
94 94
         }
95 95
         if (empty ($this->apiKey)) {
96
-            throw new InvalidConfigException ('The "apiKey" property must be set.');
96
+            throw new InvalidConfigException('The "apiKey" property must be set.');
97 97
         }
98 98
         if (empty ($this->mchId)) {
99
-            throw new InvalidConfigException ('The "mchId" property must be set.');
99
+            throw new InvalidConfigException('The "mchId" property must be set.');
100 100
         }
101 101
         if (empty ($this->privateKey)) {
102
-            throw new InvalidConfigException ('The "privateKey" property must be set.');
102
+            throw new InvalidConfigException('The "privateKey" property must be set.');
103 103
         }
104 104
         if (empty ($this->publicKey)) {
105
-            throw new InvalidConfigException ('The "publicKey" property must be set.');
105
+            throw new InvalidConfigException('The "publicKey" property must be set.');
106 106
         }
107 107
         $this->initPrivateKey();
108 108
         $this->initPublicKey();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     protected function initPrivateKey()
116 116
     {
117 117
         $privateKey = Yii::getAlias($this->privateKey);
118
-        if (!is_file ($privateKey)) {
118
+        if (!is_file($privateKey)) {
119 119
             $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
120 120
                 wordwrap($this->privateKey, 64, "\n", true) .
121 121
                 "\n-----END RSA PRIVATE KEY-----";
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 $weParams = $trade->user->socialAccounts['wechat']->getDecodedData();
181 181
                 $data['openid'] = $weParams['openid'];
182 182
             } else {
183
-                throw new PaymentException ('Non-WeChat authorized login.');
183
+                throw new PaymentException('Non-WeChat authorized login.');
184 184
             }
185 185
         }
186 186
         $response = $this->post('pay/unifiedorder', $data)->send();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 throw new PaymentException($response->data['return_msg']);
193 193
             }
194 194
         } else {
195
-            throw new Exception ('Http request failed.');
195
+            throw new Exception('Http request failed.');
196 196
         }
197 197
     }
198 198
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         } elseif ($this->signType == self::SIGNATURE_METHOD_SHA256) {
273 273
             $sign = hash_hmac('sha256', $bizString, $this->apiKey);
274 274
         } else {
275
-            throw new InvalidConfigException ('This encryption is not supported');
275
+            throw new InvalidConfigException('This encryption is not supported');
276 276
         }
277 277
         return strtoupper($sign);
278 278
     }
Please login to merge, or discard this patch.