@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | const RESPONSE_TYPE = "code"; |
12 | 12 | |
13 | 13 | const HTTP_RESPONSE_STATUSES = [ |
14 | - 'success' => 200, |
|
15 | - 'failed' => 400, |
|
16 | - 'validationError' => 422, |
|
17 | - 'authenticationError' => 401, |
|
18 | - 'authorizationError' => 403, |
|
19 | - 'serverError' => 500, |
|
14 | + 'success' => 200, |
|
15 | + 'failed' => 400, |
|
16 | + 'validationError' => 422, |
|
17 | + 'authenticationError' => 401, |
|
18 | + 'authorizationError' => 403, |
|
19 | + 'serverError' => 500, |
|
20 | 20 | ]; |
21 | 21 | |
22 | 22 | const AUTH_GRANT_TYPE = "client_credentials"; |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | const API_VERSION = 'v1'; |
32 | 32 | |
33 | 33 | const API_ENDPOINTS = [ |
34 | - 'oauth' => Constant::API_VERSION . '/oauth/token', |
|
35 | - 'create_order' => Constant::API_VERSION . '/order/create', |
|
36 | - 'order_status' => Constant::API_VERSION . '/order/status', |
|
37 | - 'verify_client' => Constant::API_VERSION . '/sso/verify-client', |
|
38 | - 'customer_profile' => Constant::API_VERSION . '/sso/customer/profile', |
|
34 | + 'oauth' => Constant::API_VERSION . '/oauth/token', |
|
35 | + 'create_order' => Constant::API_VERSION . '/order/create', |
|
36 | + 'order_status' => Constant::API_VERSION . '/order/status', |
|
37 | + 'verify_client' => Constant::API_VERSION . '/sso/verify-client', |
|
38 | + 'customer_profile' => Constant::API_VERSION . '/sso/customer/profile', |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | const APP_ENVIRONMENT = [ |
42 | - 'live', |
|
43 | - 'sandbox', |
|
42 | + 'live', |
|
43 | + 'sandbox', |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | const APP_TYPE = [ |
47 | - 'checkout' => 1, |
|
48 | - 'sdk' => 2, |
|
47 | + 'checkout' => 1, |
|
48 | + 'sdk' => 2, |
|
49 | 49 | ]; |
50 | 50 | |
51 | 51 | const OrderStatus = [ |
52 | - 'created' => 1, |
|
53 | - 'initiated' => 2, |
|
54 | - 'placed' => 3, |
|
55 | - 'awaiting-confirmation' => 4, |
|
56 | - 'canceled' => 5, |
|
57 | - 'expired' => 6, |
|
58 | - 'failed' => 7 |
|
52 | + 'created' => 1, |
|
53 | + 'initiated' => 2, |
|
54 | + 'placed' => 3, |
|
55 | + 'awaiting-confirmation' => 4, |
|
56 | + 'canceled' => 5, |
|
57 | + 'expired' => 6, |
|
58 | + 'failed' => 7 |
|
59 | 59 | ]; |
60 | 60 | |
61 | 61 | const BUILDERS_DASHBOARD_LINK = "http://builder.bsecure.pk/"; |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | |
30 | 30 | /** @var array The shipment object to be used for Create Order requests. */ |
31 | 31 | private static $shipment = [ |
32 | - "charges" => '', |
|
33 | - "method_name" => '', |
|
32 | + "charges" => '', |
|
33 | + "method_name" => '', |
|
34 | 34 | ]; |
35 | 35 | |
36 | 36 | /* @var string $orderPayload this variable is used for, setting payload for create order API call to bSecure server */ |
37 | 37 | private static $orderPayload = [ |
38 | - 'order_id' => null, |
|
39 | - 'customer' => null, |
|
40 | - 'products' => null, |
|
41 | - 'shipment_charges' => null, |
|
42 | - 'shipment_method_name' => null, |
|
43 | - 'sub_total_amount' => null, |
|
44 | - 'discount_amount' => null, |
|
45 | - 'total_amount' => null |
|
38 | + 'order_id' => null, |
|
39 | + 'customer' => null, |
|
40 | + 'products' => null, |
|
41 | + 'shipment_charges' => null, |
|
42 | + 'shipment_method_name' => null, |
|
43 | + 'sub_total_amount' => null, |
|
44 | + 'discount_amount' => null, |
|
45 | + 'total_amount' => null |
|
46 | 46 | ]; |
47 | 47 | |
48 | 48 | /** |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | $product_sub_total = ( $price + $options_price ) * $quantity; |
112 | 112 | |
113 | 113 | $orderItems[] = [ |
114 | - "id" => array_key_exists('id',$product) ? $product['id'] : null, |
|
115 | - "name" => array_key_exists('name',$product) ? $product['name'] : null, |
|
116 | - "sku" => array_key_exists('sku',$product) ? $product['sku'] : null, |
|
117 | - "quantity" => $quantity, |
|
118 | - "price" => $product_price, |
|
119 | - "sale_price" => $sale_price, |
|
120 | - "discount" => $discount, |
|
121 | - "sub_total" => $product_sub_total, |
|
122 | - "image" => array_key_exists('image',$product) ? $product['image'] : null, |
|
123 | - "short_description" => array_key_exists('short_description',$product) ? $product['short_description'] : null, |
|
124 | - "description" => array_key_exists('description',$product) ? $product['description'] : null, |
|
125 | - "product_options" => $options |
|
114 | + "id" => array_key_exists('id',$product) ? $product['id'] : null, |
|
115 | + "name" => array_key_exists('name',$product) ? $product['name'] : null, |
|
116 | + "sku" => array_key_exists('sku',$product) ? $product['sku'] : null, |
|
117 | + "quantity" => $quantity, |
|
118 | + "price" => $product_price, |
|
119 | + "sale_price" => $sale_price, |
|
120 | + "discount" => $discount, |
|
121 | + "sub_total" => $product_sub_total, |
|
122 | + "image" => array_key_exists('image',$product) ? $product['image'] : null, |
|
123 | + "short_description" => array_key_exists('short_description',$product) ? $product['short_description'] : null, |
|
124 | + "description" => array_key_exists('description',$product) ? $product['description'] : null, |
|
125 | + "product_options" => $options |
|
126 | 126 | ]; |
127 | 127 | } |
128 | 128 | |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | if( !empty( $auth_code ) ) |
155 | 155 | { |
156 | 156 | $customer = [ |
157 | - "auth_code" => $auth_code, |
|
157 | + "auth_code" => $auth_code, |
|
158 | 158 | ];; |
159 | 159 | } |
160 | 160 | else{ |
161 | 161 | $customer = [ |
162 | - "country_code" => array_key_exists('country_code',$customerData) ? $customerData['country_code'] : '', |
|
163 | - "phone_number" => array_key_exists('phone_number',$customerData) ? $customerData['phone_number'] : '', |
|
164 | - "name" => array_key_exists('name',$customerData) ? $customerData['name'] : '', |
|
165 | - "email" => array_key_exists('email',$customerData) ? $customerData['email'] : '', |
|
162 | + "country_code" => array_key_exists('country_code',$customerData) ? $customerData['country_code'] : '', |
|
163 | + "phone_number" => array_key_exists('phone_number',$customerData) ? $customerData['phone_number'] : '', |
|
164 | + "name" => array_key_exists('name',$customerData) ? $customerData['name'] : '', |
|
165 | + "email" => array_key_exists('email',$customerData) ? $customerData['email'] : '', |
|
166 | 166 | ]; |
167 | 167 | } |
168 | 168 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | private static function _setShipmentDetails($shipmentData) |
174 | 174 | { |
175 | 175 | $shipmentDetail = [ |
176 | - "charges" => '', |
|
177 | - "method_name" => '', |
|
176 | + "charges" => '', |
|
177 | + "method_name" => '', |
|
178 | 178 | ]; |
179 | 179 | if(!empty($shipmentData)) |
180 | 180 | { |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | return [ |
210 | - 'price' => $price, |
|
211 | - 'options' => $product_options |
|
210 | + 'price' => $price, |
|
211 | + 'options' => $product_options |
|
212 | 212 | ]; |
213 | 213 | } |
214 | 214 | |
@@ -217,34 +217,34 @@ discard block |
||
217 | 217 | if(!self::$chargesDefinition) |
218 | 218 | { |
219 | 219 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
220 | - . '"bSecure::setCharges(<ARRAY>). See"' |
|
221 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
222 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
220 | + . '"bSecure::setCharges(<ARRAY>). See"' |
|
221 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
222 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
223 | 223 | throw new Exception\UnexpectedValueException($msg); |
224 | 224 | }else if(!self::$productsDefinition) |
225 | 225 | { |
226 | 226 | $msg = 'No cart_items provided. (HINT: set your cart_items using ' |
227 | - . '"bSecure::setCartItems(<ARRAY>). See"' |
|
228 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
229 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
227 | + . '"bSecure::setCartItems(<ARRAY>). See"' |
|
228 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
229 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
230 | 230 | throw new Exception\UnexpectedValueException($msg); |
231 | 231 | }else if(!self::$customerDefinition) |
232 | 232 | { |
233 | 233 | $msg = 'No customer_details provided. (HINT: set your customer_details using ' |
234 | - . '"bSecure::setCustomer(<ARRAY>). See"' |
|
235 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
236 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
234 | + . '"bSecure::setCustomer(<ARRAY>). See"' |
|
235 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
236 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
237 | 237 | throw new Exception\UnexpectedValueException($msg); |
238 | 238 | }else{ |
239 | 239 | self::$orderPayload = [ |
240 | - 'order_id' => self::$orderId, |
|
241 | - 'customer' => self::$customer, |
|
242 | - 'products' => self::$products, |
|
243 | - 'shipment_charges' => self::$shipment['charges'], |
|
244 | - 'shipment_method_name' => self::$shipment['method_name'], |
|
245 | - 'sub_total_amount' => self::$sub_total_amount, |
|
246 | - 'discount_amount' => self::$discount_amount, |
|
247 | - 'total_amount' => self::$total_amount |
|
240 | + 'order_id' => self::$orderId, |
|
241 | + 'customer' => self::$customer, |
|
242 | + 'products' => self::$products, |
|
243 | + 'shipment_charges' => self::$shipment['charges'], |
|
244 | + 'shipment_method_name' => self::$shipment['method_name'], |
|
245 | + 'sub_total_amount' => self::$sub_total_amount, |
|
246 | + 'discount_amount' => self::$discount_amount, |
|
247 | + 'total_amount' => self::$total_amount |
|
248 | 248 | ]; |
249 | 249 | return self::$orderPayload; |
250 | 250 | } |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | self::_setOrderPayload(); |
266 | 266 | |
267 | 267 | $msg = 'No auth_token provided. (HINT: set your auth_token using ' |
268 | - . '"bSecure::setAuthToken()". See ' |
|
269 | - . Constant::DOCUMENTATION_LINK.', for details, ' |
|
270 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
268 | + . '"bSecure::setAuthToken()". See ' |
|
269 | + . Constant::DOCUMENTATION_LINK.', for details, ' |
|
270 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
271 | 271 | $access_token = bSecure::getAuthToken(); |
272 | 272 | if($access_token == null) |
273 | 273 | throw new Exception\AuthenticationException($msg); |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | if($order_ref == null || $order_ref == "") |
291 | 291 | { |
292 | 292 | $msg = 'No order_ref provided. See"' |
293 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
294 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
293 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
294 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
295 | 295 | throw new Exception\UnexpectedValueException($msg); |
296 | 296 | } |
297 | 297 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | $requestor = new ApiRequest(); |
21 | 21 | $response = $requestor->request( |
22 | - 'post', |
|
23 | - Constant::API_ENDPOINTS['create_order'], |
|
24 | - $orderPayload, |
|
25 | - Constant::YES |
|
22 | + 'post', |
|
23 | + Constant::API_ENDPOINTS['create_order'], |
|
24 | + $orderPayload, |
|
25 | + Constant::YES |
|
26 | 26 | ); |
27 | 27 | return $response[0]; |
28 | 28 | } |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @throws \bSecure\ApiResponse if the request fails |
36 | 36 | * @return \bSecure\ApiResponse |
37 | - */ |
|
37 | + */ |
|
38 | 38 | |
39 | 39 | public static function orderStatus($orderRef) |
40 | 40 | { |
41 | 41 | $requestor = new ApiRequest(); |
42 | 42 | $response = $requestor->request( |
43 | - 'post', |
|
44 | - Constant::API_ENDPOINTS['order_status'], |
|
45 | - ['order_ref' => $orderRef], |
|
46 | - Constant::YES |
|
43 | + 'post', |
|
44 | + Constant::API_ENDPOINTS['order_status'], |
|
45 | + ['order_ref' => $orderRef], |
|
46 | + Constant::YES |
|
47 | 47 | ); |
48 | 48 | return $response[0]; |
49 | 49 | } |
@@ -21,12 +21,12 @@ |
||
21 | 21 | * @return InvalidRequestException |
22 | 22 | */ |
23 | 23 | public static function factory( |
24 | - $message, |
|
25 | - $httpStatus = null, |
|
26 | - $httpBody = null, |
|
27 | - $jsonBody = null, |
|
28 | - $httpHeaders = null, |
|
29 | - $Code = null |
|
24 | + $message, |
|
25 | + $httpStatus = null, |
|
26 | + $httpBody = null, |
|
27 | + $jsonBody = null, |
|
28 | + $httpHeaders = null, |
|
29 | + $Code = null |
|
30 | 30 | ) { |
31 | 31 | var_dump($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders); |
32 | 32 | $message = is_array($message) ? implode (", ", $message) : $message; |
@@ -28,12 +28,12 @@ |
||
28 | 28 | * @return static |
29 | 29 | */ |
30 | 30 | public static function factory( |
31 | - $message, |
|
32 | - $httpStatus = null, |
|
33 | - $httpBody = null, |
|
34 | - $jsonBody = null, |
|
35 | - $httpHeaders = null, |
|
36 | - $code = null |
|
31 | + $message, |
|
32 | + $httpStatus = null, |
|
33 | + $httpBody = null, |
|
34 | + $jsonBody = null, |
|
35 | + $httpHeaders = null, |
|
36 | + $code = null |
|
37 | 37 | ) { |
38 | 38 | $instance = new static($message); |
39 | 39 | $instance->setHttpStatus($httpStatus); |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | { |
86 | 86 | $curlVersion = \curl_version(); |
87 | 87 | $this->userAgentInfo = [ |
88 | - 'httplib' => 'curl ' . $curlVersion['version'], |
|
89 | - 'ssllib' => $curlVersion['ssl_version'], |
|
88 | + 'httplib' => 'curl ' . $curlVersion['version'], |
|
89 | + 'ssllib' => $curlVersion['ssl_version'], |
|
90 | 90 | ]; |
91 | 91 | } |
92 | 92 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $opts[\CURLOPT_POSTFIELDS] = http_build_query($params); |
212 | 212 | $opts[\CURLOPT_VERBOSE] = true; |
213 | 213 | $optsHeaders = [ |
214 | - 'X-HTTP-Method-Override: POST', |
|
215 | - 'Content-Type:application/x-www-form-urlencoded', |
|
216 | - 'Content-Length: ' . strlen(http_build_query($params)) |
|
214 | + 'X-HTTP-Method-Override: POST', |
|
215 | + 'Content-Type:application/x-www-form-urlencoded', |
|
216 | + 'Content-Length: ' . strlen(http_build_query($params)) |
|
217 | 217 | ]; |
218 | 218 | } else { |
219 | 219 | throw new Exception\UnexpectedValueException("Unrecognized method {$method}"); |
@@ -280,22 +280,22 @@ discard block |
||
280 | 280 | case \CURLE_COULDNT_RESOLVE_HOST: |
281 | 281 | case \CURLE_OPERATION_TIMEOUTED: |
282 | 282 | $msg = "Could not connect to bSecure ({$url}). Please check your " |
283 | - . 'internet connection and try again, or'; |
|
283 | + . 'internet connection and try again, or'; |
|
284 | 284 | |
285 | 285 | break; |
286 | 286 | |
287 | 287 | case \CURLE_SSL_CACERT: |
288 | 288 | case \CURLE_SSL_PEER_CERTIFICATE: |
289 | 289 | $msg = "Could not verify bSecure's SSL certificate. Please make sure " |
290 | - . 'that your network is not intercepting certificates. ' |
|
291 | - . "(Try going to {$url} in your browser.) " |
|
292 | - . 'If this problem persists,'; |
|
290 | + . 'that your network is not intercepting certificates. ' |
|
291 | + . "(Try going to {$url} in your browser.) " |
|
292 | + . 'If this problem persists,'; |
|
293 | 293 | |
294 | 294 | break; |
295 | 295 | |
296 | 296 | default: |
297 | 297 | $msg = 'Unexpected error communicating with bSecure. ' |
298 | - . 'If this problem persists,'; |
|
298 | + . 'If this problem persists,'; |
|
299 | 299 | } |
300 | 300 | $msg .= ' let us know at '.Constant::SUPPORT_EMAIL.'.'; |
301 | 301 |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | |
27 | 27 | $requestor = new ApiRequest(); |
28 | 28 | $response = $requestor->request( |
29 | - 'post', |
|
30 | - Constant::API_ENDPOINTS['oauth'], |
|
31 | - $credentials, |
|
32 | - Constant::NO |
|
29 | + 'post', |
|
30 | + Constant::API_ENDPOINTS['oauth'], |
|
31 | + $credentials, |
|
32 | + Constant::NO |
|
33 | 33 | ); |
34 | 34 | return $response[0]; |
35 | 35 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | } |
45 | 45 | if (null === $clientId) { |
46 | 46 | $msg = 'No client_id provided. (HINT: set your client_id using ' |
47 | - . '"bSecure::setClientId(<CLIENT-ID>)". You can find your client_ids ' |
|
48 | - . 'in your bSecure Builder\'s dashboard at ' |
|
49 | - . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
50 | - . 'after registering your account as a platform. See ' |
|
51 | - . '.Constant::SUPPORT_EMAIL.'.' for details, ' |
|
52 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
47 | + . '"bSecure::setClientId(<CLIENT-ID>)". You can find your client_ids ' |
|
48 | + . 'in your bSecure Builder\'s dashboard at ' |
|
49 | + . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
50 | + . 'after registering your account as a platform. See ' |
|
51 | + . '.Constant::SUPPORT_EMAIL.'.' for details, ' |
|
52 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
53 | 53 | throw new Exception\AuthenticationException($msg); |
54 | 54 | } |
55 | 55 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | } |
68 | 68 | if (null === $clientSecret) { |
69 | 69 | $msg = 'No client_secret provided. (HINT: set your client_secret using ' |
70 | - . '"bSecure::setClientSecret(<CLIENT-SECRET>)". You can find your client_secrets ' |
|
71 | - . 'in your bSecure Builder\'s dashboard at ' |
|
72 | - . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
73 | - . 'after registering your account as a platform. See ' |
|
74 | - . Constant::INTEGRATION_TAB_LINK.','.' for details, ' |
|
75 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
70 | + . '"bSecure::setClientSecret(<CLIENT-SECRET>)". You can find your client_secrets ' |
|
71 | + . 'in your bSecure Builder\'s dashboard at ' |
|
72 | + . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
73 | + . 'after registering your account as a platform. See ' |
|
74 | + . Constant::INTEGRATION_TAB_LINK.','.' for details, ' |
|
75 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
76 | 76 | |
77 | 77 | throw new Exception\AuthenticationException($msg); |
78 | 78 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | private static function verifyAppCredentials() |
84 | 84 | { |
85 | 85 | return [ |
86 | - "grant_type"=> self::GRANT_TYPE, |
|
87 | - 'client_id' => self::_getClientId(), |
|
88 | - 'client_secret' => self::_getClientSecret(), |
|
86 | + "grant_type"=> self::GRANT_TYPE, |
|
87 | + 'client_id' => self::_getClientId(), |
|
88 | + 'client_secret' => self::_getClientSecret(), |
|
89 | 89 | ]; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $params = $params ?: []; |
48 | 48 | list($rcode, $rbody, $rheaders) = |
49 | - $this->_requestRaw($method, $url, $params, $authKey); |
|
49 | + $this->_requestRaw($method, $url, $params, $authKey); |
|
50 | 50 | list($message, $exception, $rbody) = $this->_interpretResponse( $rcode,$rbody, $rheaders); |
51 | 51 | |
52 | 52 | $resp = new ApiResponse($rbody, $rcode, $message, $exception); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $rawHeaders[] = $header . ': ' . $value; |
103 | 103 | } |
104 | 104 | list($rbody, $rcode, $rheaders) = $this->httpClient()->request( |
105 | - $method, |
|
106 | - $absUrl, |
|
107 | - $rawHeaders, |
|
108 | - $params, |
|
109 | - false |
|
105 | + $method, |
|
106 | + $absUrl, |
|
107 | + $rawHeaders, |
|
108 | + $params, |
|
109 | + false |
|
110 | 110 | ); |
111 | 111 | return [$rbody, $rcode, $rheaders]; |
112 | 112 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | if (null === $resp && \JSON_ERROR_NONE !== $jsonError) { |
130 | 130 | $msg = "Invalid response body from API: {$rbody} " |
131 | - . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; |
|
131 | + . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; |
|
132 | 132 | throw new Exception\UnexpectedValueException($msg, $rcode); |
133 | 133 | } |
134 | 134 | $message = $resp['message']; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | }else{ |
157 | 157 | if (!\is_array($resp) || !isset($resp['error'])) { |
158 | 158 | $msg = "Invalid response object from API: {$rbody} " |
159 | - . "(HTTP response code was {$rcode})"; |
|
159 | + . "(HTTP response code was {$rcode})"; |
|
160 | 160 | |
161 | 161 | throw new Exception\UnexpectedValueException($msg); |
162 | 162 | } |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | if($clientId == null) |
66 | 66 | { |
67 | 67 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
68 | - . '"bSecure::setCharges(<ARRAY>). See"' |
|
69 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
70 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
68 | + . '"bSecure::setCharges(<ARRAY>). See"' |
|
69 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
70 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
71 | 71 | throw new Exception\UnexpectedValueException($msg); |
72 | 72 | } |
73 | 73 | return [ |
74 | - "client_id" => $clientId, |
|
75 | - "scope" => self::$scope, |
|
76 | - "response_type" => self::$response_type, |
|
77 | - "state" => self::$state |
|
74 | + "client_id" => $clientId, |
|
75 | + "scope" => self::$scope, |
|
76 | + "response_type" => self::$response_type, |
|
77 | + "state" => self::$state |
|
78 | 78 | ]; |
79 | 79 | } |
80 | 80 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | if(!self::$authCodeDefinition) |
88 | 88 | { |
89 | 89 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
90 | - . '"bSecure::setCharges(<ARRAY>). See"' |
|
91 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
92 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
90 | + . '"bSecure::setCharges(<ARRAY>). See"' |
|
91 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
92 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
93 | 93 | throw new Exception\UnexpectedValueException($msg); |
94 | 94 | } |
95 | 95 | return SSOController::customerProfile([ |
96 | - "code" => $authCode, |
|
96 | + "code" => $authCode, |
|
97 | 97 | ]); |
98 | 98 | } |
99 | 99 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | if(!self::$stateDefinition) |
111 | 111 | { |
112 | 112 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
113 | - . '"bSecure::setCharges(<ARRAY>). See"' |
|
114 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
115 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
113 | + . '"bSecure::setCharges(<ARRAY>). See"' |
|
114 | + . Constant::DOCUMENTATION_LINK.' for details, ' |
|
115 | + . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
116 | 116 | throw new Exception\UnexpectedValueException($msg); |
117 | 117 | } |
118 | 118 |