@@ -156,8 +156,7 @@ discard block |
||
| 156 | 156 | $customer = [ |
| 157 | 157 | "auth_code" => $auth_code, |
| 158 | 158 | ];; |
| 159 | - } |
|
| 160 | - else{ |
|
| 159 | + } else{ |
|
| 161 | 160 | $customer = [ |
| 162 | 161 | "country_code" => array_key_exists('country_code',$customerData) ? $customerData['country_code'] : '', |
| 163 | 162 | "phone_number" => array_key_exists('phone_number',$customerData) ? $customerData['phone_number'] : '', |
@@ -221,21 +220,21 @@ discard block |
||
| 221 | 220 | . Constant::DOCUMENTATION_LINK.' for details, ' |
| 222 | 221 | . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
| 223 | 222 | throw new Exception\UnexpectedValueException($msg); |
| 224 | - }else if(!self::$productsDefinition) |
|
| 223 | + } else if(!self::$productsDefinition) |
|
| 225 | 224 | { |
| 226 | 225 | $msg = 'No cart_items provided. (HINT: set your cart_items using ' |
| 227 | 226 | . '"bSecure::setCartItems(<ARRAY>). See"' |
| 228 | 227 | . Constant::DOCUMENTATION_LINK.' for details, ' |
| 229 | 228 | . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
| 230 | 229 | throw new Exception\UnexpectedValueException($msg); |
| 231 | - }else if(!self::$customerDefinition) |
|
| 230 | + } else if(!self::$customerDefinition) |
|
| 232 | 231 | { |
| 233 | 232 | $msg = 'No customer_details provided. (HINT: set your customer_details using ' |
| 234 | 233 | . '"bSecure::setCustomer(<ARRAY>). See"' |
| 235 | 234 | . Constant::DOCUMENTATION_LINK.' for details, ' |
| 236 | 235 | . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
| 237 | 236 | throw new Exception\UnexpectedValueException($msg); |
| 238 | - }else{ |
|
| 237 | + } else{ |
|
| 239 | 238 | self::$orderPayload = [ |
| 240 | 239 | 'order_id' => self::$orderId, |
| 241 | 240 | 'customer' => self::$customer, |
@@ -269,9 +268,9 @@ discard block |
||
| 269 | 268 | . Constant::DOCUMENTATION_LINK.', for details, ' |
| 270 | 269 | . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
| 271 | 270 | $access_token = bSecure::getAuthToken(); |
| 272 | - if($access_token == null) |
|
| 273 | - throw new Exception\AuthenticationException($msg); |
|
| 274 | - else{ |
|
| 271 | + if($access_token == null) { |
|
| 272 | + throw new Exception\AuthenticationException($msg); |
|
| 273 | + } else{ |
|
| 275 | 274 | return OrderController::createOrder(self::$orderPayload); |
| 276 | 275 | } |
| 277 | 276 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if(gettype($authToken) == "string") |
| 72 | 72 | { |
| 73 | 73 | $authHeader = ['Authorization' => 'Bearer ' .$authToken]; |
| 74 | - }else if(gettype($authToken) == "object"){ |
|
| 74 | + } else if(gettype($authToken) == "object"){ |
|
| 75 | 75 | $authHeader = []; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $error = null; |
| 154 | 154 | if (\is_array($errorData) && $errorData != []) { |
| 155 | 155 | $error = self::_specificAPIError($resp,$rheaders,$rcode); |
| 156 | - }else{ |
|
| 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})"; |
@@ -114,9 +114,7 @@ |
||
| 114 | 114 | . Constant::DOCUMENTATION_LINK.' for details, ' |
| 115 | 115 | . 'or email '.Constant::SUPPORT_EMAIL.' if you have any questions.'; |
| 116 | 116 | throw new Exception\UnexpectedValueException($msg); |
| 117 | - } |
|
| 118 | - |
|
| 119 | - else{ |
|
| 117 | + } else{ |
|
| 120 | 118 | self::setAuthenticationPayload(); |
| 121 | 119 | return self::setAuthenticationLink(); |
| 122 | 120 | } |
@@ -115,14 +115,15 @@ |
||
| 115 | 115 | if(array_key_exists('access_token',$tokenBody)){ |
| 116 | 116 | self::$authTokenEnv = array_key_exists('environment',$tokenBody) ? $tokenBody['environment'] :null; |
| 117 | 117 | self::$authToken = array_key_exists('access_token',$tokenBody) ? $tokenBody['access_token'] :null; |
| 118 | - }else{ |
|
| 118 | + } else{ |
|
| 119 | 119 | return $token; |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | - if(self::$appEnv == self::$authTokenEnv) |
|
| 123 | - return self::$authToken; |
|
| 124 | - else |
|
| 125 | - throw new Exception\UnexpectedValueException('Selected environment keys are invalid'); |
|
| 122 | + if(self::$appEnv == self::$authTokenEnv) { |
|
| 123 | + return self::$authToken; |
|
| 124 | + } else { |
|
| 125 | + throw new Exception\UnexpectedValueException('Selected environment keys are invalid'); |
|
| 126 | + } |
|
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | /** |