@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function setOrderId($orderId) |
54 | 54 | { |
55 | - self::$orderIdDefinition =true; |
|
55 | + self::$orderIdDefinition = true; |
|
56 | 56 | self::$orderId = $orderId; |
57 | 57 | } |
58 | 58 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public static function setCustomer($customerData) |
64 | 64 | { |
65 | - self::$customerDefinition =true; |
|
65 | + self::$customerDefinition = true; |
|
66 | 66 | $customer = self::_setCustomer($customerData); |
67 | 67 | self::$customer = $customer; |
68 | 68 | } |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | { |
91 | 91 | $orderItems = []; |
92 | 92 | |
93 | - if(!empty($products)) |
|
93 | + if (!empty($products)) |
|
94 | 94 | { |
95 | 95 | foreach ($products as $key => $product) { |
96 | 96 | //Product Price |
97 | - $price = array_key_exists('price',$product) ? $product['price'] : 0; |
|
98 | - $sale_price = array_key_exists('sale_price',$product) ? $product['sale_price'] : 0; |
|
99 | - $quantity = array_key_exists('quantity',$product) ? $product['quantity'] : 1; |
|
97 | + $price = array_key_exists('price', $product) ? $product['price'] : 0; |
|
98 | + $sale_price = array_key_exists('sale_price', $product) ? $product['sale_price'] : 0; |
|
99 | + $quantity = array_key_exists('quantity', $product) ? $product['quantity'] : 1; |
|
100 | 100 | |
101 | 101 | //Product options |
102 | 102 | $product_options = self::_setProductOptionsDataStructure($product); |
@@ -106,29 +106,29 @@ discard block |
||
106 | 106 | |
107 | 107 | |
108 | 108 | #Product charges |
109 | - $discount = ( $price - $sale_price ) * $quantity; |
|
110 | - $product_price = ( $price + $options_price ) * $quantity; |
|
111 | - $product_sub_total = ( $price + $options_price ) * $quantity; |
|
109 | + $discount = ($price - $sale_price) * $quantity; |
|
110 | + $product_price = ($price + $options_price) * $quantity; |
|
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, |
|
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 | 117 | "quantity" => $quantity, |
118 | 118 | "price" => $product_price, |
119 | 119 | "sale_price" => $sale_price, |
120 | 120 | "discount" => $discount, |
121 | 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, |
|
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 | 125 | "product_options" => $options |
126 | 126 | ]; |
127 | 127 | } |
128 | 128 | |
129 | 129 | } |
130 | 130 | self::$products = $orderItems; |
131 | - self::$productsDefinition =true; |
|
131 | + self::$productsDefinition = true; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | self::$sub_total_amount = array_key_exists('sub_total', $orderCharges) ? $orderCharges['sub_total'] : 0; |
142 | 142 | self::$discount_amount = array_key_exists('discount', $orderCharges) ? $orderCharges['discount'] : 0; |
143 | 143 | self::$total_amount = array_key_exists('total', $orderCharges) ? $orderCharges['total'] : 0; |
144 | - self::$chargesDefinition =true; |
|
144 | + self::$chargesDefinition = true; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | private static function _setCustomer($customerData) |
148 | 148 | { |
149 | 149 | $customer = []; |
150 | - if(!empty($customerData)) |
|
150 | + if (!empty($customerData)) |
|
151 | 151 | { |
152 | - $auth_code = array_key_exists('auth_code',$customerData) ? $customerData['auth_code'] : '' ; |
|
152 | + $auth_code = array_key_exists('auth_code', $customerData) ? $customerData['auth_code'] : ''; |
|
153 | 153 | |
154 | - if( !empty( $auth_code ) ) |
|
154 | + if (!empty($auth_code)) |
|
155 | 155 | { |
156 | 156 | $customer = [ |
157 | 157 | "auth_code" => $auth_code, |
158 | - ];; |
|
158 | + ]; ; |
|
159 | 159 | } |
160 | - else{ |
|
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 | } |
@@ -176,28 +176,28 @@ discard block |
||
176 | 176 | "charges" => '', |
177 | 177 | "method_name" => '', |
178 | 178 | ]; |
179 | - if(!empty($shipmentData)) |
|
179 | + if (!empty($shipmentData)) |
|
180 | 180 | { |
181 | - $shipmentDetail['charges'] = array_key_exists('charges',$shipmentData) ? $shipmentData['charges'] : ''; |
|
182 | - $shipmentDetail['method_name'] = array_key_exists('method_name',$shipmentData) ? $shipmentData['method_name'] : ''; |
|
181 | + $shipmentDetail['charges'] = array_key_exists('charges', $shipmentData) ? $shipmentData['charges'] : ''; |
|
182 | + $shipmentDetail['method_name'] = array_key_exists('method_name', $shipmentData) ? $shipmentData['method_name'] : ''; |
|
183 | 183 | } |
184 | 184 | return $shipmentDetail; |
185 | 185 | } |
186 | 186 | |
187 | 187 | private static function _setProductOptionsDataStructure($product) |
188 | 188 | { |
189 | - $product_options = array_key_exists('product_options',$product) ? $product['product_options'] : []; |
|
189 | + $product_options = array_key_exists('product_options', $product) ? $product['product_options'] : []; |
|
190 | 190 | |
191 | 191 | $price = 0; |
192 | - if( isset($product_options) && !empty($product_options) ) |
|
192 | + if (isset($product_options) && !empty($product_options)) |
|
193 | 193 | { |
194 | - foreach( $product_options as $productOption ) |
|
194 | + foreach ($product_options as $productOption) |
|
195 | 195 | { |
196 | - $productValue = array_key_exists('value',$productOption) ? $productOption['value'] : []; |
|
197 | - foreach( $productValue as $key => $optionValue ) |
|
196 | + $productValue = array_key_exists('value', $productOption) ? $productOption['value'] : []; |
|
197 | + foreach ($productValue as $key => $optionValue) |
|
198 | 198 | { |
199 | - $optionPrice = array_key_exists('price',$optionValue) ? $optionValue['price'] : []; |
|
200 | - if(!empty($optionPrice)) |
|
199 | + $optionPrice = array_key_exists('price', $optionValue) ? $optionValue['price'] : []; |
|
200 | + if (!empty($optionPrice)) |
|
201 | 201 | { |
202 | 202 | #Price ++ |
203 | 203 | $price += $optionPrice; |
@@ -214,28 +214,28 @@ discard block |
||
214 | 214 | |
215 | 215 | private static function _setOrderPayload() |
216 | 216 | { |
217 | - if(!self::$chargesDefinition) |
|
217 | + if (!self::$chargesDefinition) |
|
218 | 218 | { |
219 | 219 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
220 | 220 | . '"bSecure::setCharges(<ARRAY>). See"' |
221 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
222 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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 | - }else if(!self::$productsDefinition) |
|
224 | + } else if (!self::$productsDefinition) |
|
225 | 225 | { |
226 | 226 | $msg = 'No cart_items provided. (HINT: set your cart_items using ' |
227 | 227 | . '"bSecure::setCartItems(<ARRAY>). See"' |
228 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
229 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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 | - }else if(!self::$customerDefinition) |
|
231 | + } else if (!self::$customerDefinition) |
|
232 | 232 | { |
233 | 233 | $msg = 'No customer_details provided. (HINT: set your customer_details using ' |
234 | 234 | . '"bSecure::setCustomer(<ARRAY>). See"' |
235 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
236 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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 | - }else{ |
|
238 | + } else { |
|
239 | 239 | self::$orderPayload = [ |
240 | 240 | 'order_id' => self::$orderId, |
241 | 241 | 'customer' => self::$customer, |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | |
267 | 267 | $msg = 'No auth_token provided. (HINT: set your auth_token using ' |
268 | 268 | . '"bSecure::setAuthToken()". See ' |
269 | - . Constant::DOCUMENTATION_LINK.', for details, ' |
|
270 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
269 | + . Constant::DOCUMENTATION_LINK . ', for details, ' |
|
270 | + . 'or email ' . Constant::SUPPORT_EMAIL . ' if you have any questions.'; |
|
271 | 271 | $access_token = bSecure::getAuthToken(); |
272 | - if($access_token == null) |
|
272 | + if ($access_token == null) |
|
273 | 273 | throw new Exception\AuthenticationException($msg); |
274 | - else{ |
|
274 | + else { |
|
275 | 275 | return OrderController::createOrder(self::$orderPayload); |
276 | 276 | } |
277 | 277 | } |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public static function orderStatus($order_ref) |
289 | 289 | { |
290 | - if($order_ref == null || $order_ref == "") |
|
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 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | ) { |
31 | 31 | var_dump($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders); |
32 | 32 | $message = is_array($message) ? implode (", ", $message) : $message; |
33 | - $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders,$Code); |
|
33 | + $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $Code); |
|
34 | 34 | return $instance; |
35 | 35 | } |
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param null|array $message |
34 | 34 | * @param null|array $exception |
35 | 35 | */ |
36 | - public function __construct( $body, $status, $message, $exception) |
|
36 | + public function __construct($body, $status, $message, $exception) |
|
37 | 37 | { |
38 | 38 | $this->body = $body; |
39 | 39 | $this->status = $status; |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | $optsHeaders = [ |
214 | 214 | 'X-HTTP-Method-Override: POST', |
215 | 215 | 'Content-Type:application/x-www-form-urlencoded', |
216 | - 'Content-Length: ' . strlen(http_build_query($params)) |
|
216 | + 'Content-Length: ' . strlen(http_build_query($params)) |
|
217 | 217 | ]; |
218 | 218 | } else { |
219 | 219 | throw new Exception\UnexpectedValueException("Unrecognized method {$method}"); |
220 | 220 | } |
221 | 221 | |
222 | 222 | $opts[\CURLOPT_URL] = $absUrl; |
223 | - $opts[\CURLOPT_HTTPHEADER] = array_merge($optsHeaders,$headers); |
|
223 | + $opts[\CURLOPT_HTTPHEADER] = array_merge($optsHeaders, $headers); |
|
224 | 224 | list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl); |
225 | 225 | |
226 | 226 | return [$rbody, $rcode, $rheaders]; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $msg = 'Unexpected error communicating with bSecure. ' |
298 | 298 | . 'If this problem persists,'; |
299 | 299 | } |
300 | - $msg .= ' let us know at '.Constant::SUPPORT_EMAIL.'.'; |
|
300 | + $msg .= ' let us know at ' . Constant::SUPPORT_EMAIL . '.'; |
|
301 | 301 | |
302 | 302 | $msg .= "\n\n(Network error [errno {$errno}]: {$message})"; |
303 | 303 |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | $msg = 'No client_id provided. (HINT: set your client_id using ' |
47 | 47 | . '"bSecure::setClientId(<CLIENT-ID>)". You can find your client_ids ' |
48 | 48 | . 'in your bSecure Builder\'s dashboard at ' |
49 | - . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
49 | + . Constant::BUILDERS_DASHBOARD_LINK . ', ' |
|
50 | 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.'; |
|
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 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $msg = 'No client_secret provided. (HINT: set your client_secret using ' |
70 | 70 | . '"bSecure::setClientSecret(<CLIENT-SECRET>)". You can find your client_secrets ' |
71 | 71 | . 'in your bSecure Builder\'s dashboard at ' |
72 | - . Constant::BUILDERS_DASHBOARD_LINK.', ' |
|
72 | + . Constant::BUILDERS_DASHBOARD_LINK . ', ' |
|
73 | 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.'; |
|
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 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param null|string $apiBase |
26 | 26 | */ |
27 | - public function __construct( $apiBase = null) |
|
27 | + public function __construct($apiBase = null) |
|
28 | 28 | { |
29 | 29 | if (!$apiBase) { |
30 | 30 | $apiBase = bSecure::$apiBase; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $params = $params ?: []; |
48 | 48 | list($rcode, $rbody, $rheaders) = |
49 | 49 | $this->_requestRaw($method, $url, $params, $authKey); |
50 | - list($message, $exception, $rbody) = $this->_interpretResponse( $rcode,$rbody, $rheaders); |
|
50 | + list($message, $exception, $rbody) = $this->_interpretResponse($rcode, $rbody, $rheaders); |
|
51 | 51 | |
52 | 52 | $resp = new ApiResponse($rbody, $rcode, $message, $exception); |
53 | 53 | return [$resp]; |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | $authHeader = []; |
66 | 66 | $defaultHeaders = []; |
67 | 67 | |
68 | - if($authKey) |
|
68 | + if ($authKey) |
|
69 | 69 | { |
70 | 70 | $authToken = bSecure::getAuthToken(); |
71 | - if(gettype($authToken) == "string") |
|
71 | + if (gettype($authToken) == "string") |
|
72 | 72 | { |
73 | - $authHeader = ['Authorization' => 'Bearer ' .$authToken]; |
|
74 | - }else if(gettype($authToken) == "object"){ |
|
73 | + $authHeader = ['Authorization' => 'Bearer ' . $authToken]; |
|
74 | + } else if (gettype($authToken) == "object") { |
|
75 | 75 | $authHeader = []; |
76 | 76 | } |
77 | 77 | } |
78 | - $headers = array_merge($defaultHeaders,$authHeader); |
|
78 | + $headers = array_merge($defaultHeaders, $authHeader); |
|
79 | 79 | return $headers; |
80 | 80 | } |
81 | 81 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return array |
123 | 123 | */ |
124 | - private function _interpretResponse( $rcode,$rbody, $rheaders) |
|
124 | + private function _interpretResponse($rcode, $rbody, $rheaders) |
|
125 | 125 | { |
126 | 126 | $resp = \json_decode($rbody, true); |
127 | 127 | $jsonError = \json_last_error(); |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $errorData = $resp['message']; |
153 | 153 | $error = null; |
154 | 154 | if (\is_array($errorData) && $errorData != []) { |
155 | - $error = self::_specificAPIError($resp,$rheaders,$rcode); |
|
156 | - }else{ |
|
155 | + $error = self::_specificAPIError($resp, $rheaders, $rcode); |
|
156 | + } else { |
|
157 | 157 | if (!\is_array($resp) || !isset($resp['error'])) { |
158 | 158 | $msg = "Invalid response object from API: {$rbody} " |
159 | 159 | . "(HTTP response code was {$rcode})"; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return Exception\ApiErrorException |
177 | 177 | */ |
178 | - private static function _specificAPIError($errorData,$rheaders, $code) |
|
178 | + private static function _specificAPIError($errorData, $rheaders, $code) |
|
179 | 179 | { |
180 | 180 | $msg = isset($errorData['message']) ? $errorData['message'] : null; |
181 | 181 | $body = isset($errorData['body']) ? $errorData['body'] : null; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | private static function setState($state) |
30 | 30 | { |
31 | - self::$stateDefinition =true; |
|
31 | + self::$stateDefinition = true; |
|
32 | 32 | self::$state = $state; |
33 | 33 | } |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | private static function setAuthCode($authCode) |
41 | 41 | { |
42 | - self::$authCodeDefinition =true; |
|
42 | + self::$authCodeDefinition = true; |
|
43 | 43 | self::$authCode = $authCode; |
44 | 44 | } |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $scope = self::$scope; |
54 | 54 | $response_type = self::$response_type; |
55 | 55 | $state = self::$state; |
56 | - return bSecure::$loginBase.'?client_id='.$clientId.'&scope='.$scope.'&response_type='.$response_type.'&state='.$state; |
|
56 | + return bSecure::$loginBase . '?client_id=' . $clientId . '&scope=' . $scope . '&response_type=' . $response_type . '&state=' . $state; |
|
57 | 57 | } |
58 | 58 | /** |
59 | 59 | * Sets the authentication request payload. |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | private static function setAuthenticationPayload() |
63 | 63 | { |
64 | 64 | $clientId = bSecure::getClientId(); |
65 | - if($clientId == null) |
|
65 | + if ($clientId == null) |
|
66 | 66 | { |
67 | 67 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
68 | 68 | . '"bSecure::setCharges(<ARRAY>). See"' |
69 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
70 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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 [ |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | public static function customerProfile($authCode) |
85 | 85 | { |
86 | 86 | self::setAuthCode($authCode); |
87 | - if(!self::$authCodeDefinition) |
|
87 | + if (!self::$authCodeDefinition) |
|
88 | 88 | { |
89 | 89 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
90 | 90 | . '"bSecure::setCharges(<ARRAY>). See"' |
91 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
92 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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([ |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | public static function clientAuthenticate($state) |
108 | 108 | { |
109 | 109 | self::setState($state); |
110 | - if(!self::$stateDefinition) |
|
110 | + if (!self::$stateDefinition) |
|
111 | 111 | { |
112 | 112 | $msg = 'No charges provided. (HINT: set your sub_total, discount and total amount using ' |
113 | 113 | . '"bSecure::setCharges(<ARRAY>). See"' |
114 | - . Constant::DOCUMENTATION_LINK.' for details, ' |
|
115 | - . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
|
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 | |
119 | - else{ |
|
119 | + else { |
|
120 | 120 | self::setAuthenticationPayload(); |
121 | 121 | return self::setAuthenticationLink(); |
122 | 122 | } |
@@ -108,18 +108,18 @@ |
||
108 | 108 | */ |
109 | 109 | public static function getAuthToken() |
110 | 110 | { |
111 | - if(self::$authToken == null || gettype(self::$authToken) != "string"){ |
|
112 | - (array) $token = self::setAuthToken(); |
|
111 | + if (self::$authToken == null || gettype(self::$authToken) != "string") { |
|
112 | + (array) $token = self::setAuthToken(); |
|
113 | 113 | |
114 | 114 | $tokenBody = $token->body; |
115 | - if(array_key_exists('access_token',$tokenBody)){ |
|
116 | - self::$authTokenEnv = array_key_exists('environment',$tokenBody) ? $tokenBody['environment'] :null; |
|
117 | - self::$authToken = array_key_exists('access_token',$tokenBody) ? $tokenBody['access_token'] :null; |
|
118 | - }else{ |
|
115 | + if (array_key_exists('access_token', $tokenBody)) { |
|
116 | + self::$authTokenEnv = array_key_exists('environment', $tokenBody) ? $tokenBody['environment'] : null; |
|
117 | + self::$authToken = array_key_exists('access_token', $tokenBody) ? $tokenBody['access_token'] : null; |
|
118 | + } else { |
|
119 | 119 | return $token; |
120 | 120 | } |
121 | 121 | } |
122 | - if(self::$appEnv == self::$authTokenEnv) |
|
122 | + if (self::$appEnv == self::$authTokenEnv) |
|
123 | 123 | return self::$authToken; |
124 | 124 | else |
125 | 125 | throw new Exception\UnexpectedValueException('Selected environment keys are invalid'); |