@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | { |
35 | 35 | try { |
36 | 36 | $orderResponse = Order::createMerchantOrder($orderData); |
37 | - if($orderResponse['error']) |
|
37 | + if ($orderResponse['error']) |
|
38 | 38 | { |
39 | - return ApiResponseHandler::failure($orderResponse['message'],$orderResponse['exception']); |
|
40 | - }else{ |
|
39 | + return ApiResponseHandler::failure($orderResponse['message'], $orderResponse['exception']); |
|
40 | + } else { |
|
41 | 41 | $response = $orderResponse['body']; |
42 | 42 | return ApiResponseHandler::success($response, trans('bSecurePayments::messages.order.success')); |
43 | 43 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | public function _setCharges($object) |
51 | 51 | { |
52 | - $orderData['sub_total_amount'] = array_key_exists('sub_total_amount',$object ) ? $object['sub_total_amount'] : null; |
|
53 | - $orderData['discount_amount'] = array_key_exists('discount_amount',$object ) ? $object['discount_amount'] : null; |
|
54 | - $orderData['total_amount'] = array_key_exists('total_amount',$object ) ? $object['total_amount'] : null; |
|
52 | + $orderData['sub_total_amount'] = array_key_exists('sub_total_amount', $object) ? $object['sub_total_amount'] : null; |
|
53 | + $orderData['discount_amount'] = array_key_exists('discount_amount', $object) ? $object['discount_amount'] : null; |
|
54 | + $orderData['total_amount'] = array_key_exists('total_amount', $object) ? $object['total_amount'] : null; |
|
55 | 55 | return $orderData; |
56 | 56 | } |
57 | 57 | |
@@ -59,22 +59,22 @@ discard block |
||
59 | 59 | public function _setCustomer($customerData) |
60 | 60 | { |
61 | 61 | $customer = []; |
62 | - if(!empty($customerData)) |
|
62 | + if (!empty($customerData)) |
|
63 | 63 | { |
64 | - $auth_code = array_key_exists('auth_code',$customerData) ? $customerData['auth_code'] : '' ; |
|
64 | + $auth_code = array_key_exists('auth_code', $customerData) ? $customerData['auth_code'] : ''; |
|
65 | 65 | |
66 | - if( !empty( $auth_code ) ) |
|
66 | + if (!empty($auth_code)) |
|
67 | 67 | { |
68 | 68 | $customer = [ |
69 | 69 | "auth_code" => $auth_code, |
70 | - ];; |
|
70 | + ]; ; |
|
71 | 71 | } |
72 | - else{ |
|
72 | + else { |
|
73 | 73 | $customer = [ |
74 | - "country_code" => array_key_exists('country_code',$customerData) ? $customerData['country_code'] : '', |
|
75 | - "phone_number" => array_key_exists('phone_number',$customerData) ? $customerData['phone_number'] : '', |
|
76 | - "name" => array_key_exists('name',$customerData) ? $customerData['name'] : '', |
|
77 | - "email" => array_key_exists('email',$customerData) ? $customerData['email'] : '', |
|
74 | + "country_code" => array_key_exists('country_code', $customerData) ? $customerData['country_code'] : '', |
|
75 | + "phone_number" => array_key_exists('phone_number', $customerData) ? $customerData['phone_number'] : '', |
|
76 | + "name" => array_key_exists('name', $customerData) ? $customerData['name'] : '', |
|
77 | + "email" => array_key_exists('email', $customerData) ? $customerData['email'] : '', |
|
78 | 78 | ]; |
79 | 79 | } |
80 | 80 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | public function _setCustomerAddress($customerData) |
86 | 86 | { |
87 | 87 | $customer = []; |
88 | - if(!empty($customerData)) |
|
88 | + if (!empty($customerData)) |
|
89 | 89 | { |
90 | 90 | $customer = [ |
91 | - "country" => array_key_exists('country',$customerData) ? $customerData['country'] : '', |
|
92 | - "province" => array_key_exists('province',$customerData) ? $customerData['province'] : '', |
|
93 | - "city" => array_key_exists('city',$customerData) ? $customerData['city'] : '', |
|
94 | - "area" => array_key_exists('area',$customerData) ? $customerData['area'] : '', |
|
95 | - "address" => array_key_exists('address',$customerData) ? $customerData['address'] : '', |
|
91 | + "country" => array_key_exists('country', $customerData) ? $customerData['country'] : '', |
|
92 | + "province" => array_key_exists('province', $customerData) ? $customerData['province'] : '', |
|
93 | + "city" => array_key_exists('city', $customerData) ? $customerData['city'] : '', |
|
94 | + "area" => array_key_exists('area', $customerData) ? $customerData['area'] : '', |
|
95 | + "address" => array_key_exists('address', $customerData) ? $customerData['address'] : '', |
|
96 | 96 | ]; |
97 | 97 | } |
98 | 98 |
@@ -28,10 +28,10 @@ |
||
28 | 28 | try { |
29 | 29 | $orderResponse = Order::getOrderStatus($order_ref); |
30 | 30 | |
31 | - if($orderResponse['error']) |
|
31 | + if ($orderResponse['error']) |
|
32 | 32 | { |
33 | - return ApiResponseHandler::failure($orderResponse['message'],$orderResponse['exception']); |
|
34 | - }else{ |
|
33 | + return ApiResponseHandler::failure($orderResponse['message'], $orderResponse['exception']); |
|
34 | + } else { |
|
35 | 35 | $response = $orderResponse['body']; |
36 | 36 | |
37 | 37 | return ApiResponseHandler::success($response, trans('bSecurePayments::messages.order.status.success')); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function setTransactionDetails($details) |
33 | 33 | { |
34 | 34 | try { |
35 | - if(empty($details)) |
|
35 | + if (empty($details)) |
|
36 | 36 | { |
37 | 37 | return ApiResponseHandler::validationError("Transaction details are required"); |
38 | 38 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function setCustomer($customerData) |
84 | 84 | { |
85 | 85 | try { |
86 | - if(empty($customerData)) |
|
86 | + if (empty($customerData)) |
|
87 | 87 | { |
88 | 88 | return ApiResponseHandler::validationError("Customer data is required"); |
89 | 89 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function setCustomerAddress($customerData) |
121 | 121 | { |
122 | 122 | try { |
123 | - if(empty($customerData)) |
|
123 | + if (empty($customerData)) |
|
124 | 124 | { |
125 | 125 | return ApiResponseHandler::validationError("Customer address data is required"); |
126 | 126 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public function createOrder() |
159 | 159 | { |
160 | 160 | try { |
161 | - if(empty($this->orderPayload)) |
|
161 | + if (empty($this->orderPayload)) |
|
162 | 162 | { |
163 | 163 | return ApiResponseHandler::validationError("Transaction data is required"); |
164 | 164 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->app->bind("bSecure_facade", function () { |
|
16 | + $this->app->bind("bSecure_facade", function() { |
|
17 | 17 | return new BsecurePayments(); |
18 | 18 | }); |
19 | 19 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'client_id' => env('BSECURE_CLIENT_ID', ''), |
5 | - 'integration_type' => env('BSECURE_INTEGRATION_TYPE','sandbox'), //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used |
|
6 | - 'store_slug' => env('BSECURE_STORE_SLUG'), //If store id is not mentioned your orders will be marked against your default store |
|
7 | - 'merchant_id' => env('BSECURE_MERCHANT_ID'), //If store id is not mentioned your orders will be marked against your default store |
|
5 | + 'integration_type' => env('BSECURE_INTEGRATION_TYPE', 'sandbox'), //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used |
|
6 | + 'store_slug' => env('BSECURE_STORE_SLUG'), //If store id is not mentioned your orders will be marked against your default store |
|
7 | + 'merchant_id' => env('BSECURE_MERCHANT_ID'), //If store id is not mentioned your orders will be marked against your default store |
|
8 | 8 | ]; |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $http = new Client(); |
58 | 58 | $authUrl = Constant::AUTH_SERVER_URL . Constant::API_ENDPOINTS['oauth']; |
59 | 59 | |
60 | - $storeId = array_key_exists('store_id',$data) ? $data['store_id'] : null; |
|
61 | - $clientId = !empty($storeId) ? $data['client_id'].':'.$storeId : $data['client_id']; |
|
60 | + $storeId = array_key_exists('store_id', $data) ? $data['store_id'] : null; |
|
61 | + $clientId = !empty($storeId) ? $data['client_id'] . ':' . $storeId : $data['client_id']; |
|
62 | 62 | |
63 | 63 | $response = $http->post($authUrl, [ |
64 | 64 | 'form_params' => [ |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | |
156 | - static function calculateSecureHash($payload){ |
|
156 | + static function calculateSecureHash($payload) { |
|
157 | 157 | $details = [ |
158 | 158 | '__00trid__' => $payload['order']['order_id'], |
159 | 159 | '__01curr__' => $payload['order']['currency'], |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | $salt = config('bSecurePayments.client_id'); |
182 | 182 | ksort($details); |
183 | - $signature = $salt."&"; |
|
184 | - foreach($details as $key => $value) |
|
183 | + $signature = $salt . "&"; |
|
184 | + foreach ($details as $key => $value) |
|
185 | 185 | { |
186 | 186 | $signature .= preg_replace("/\s+/", "", $value); |
187 | - if(next($details)) { |
|
187 | + if (next($details)) { |
|
188 | 188 | $signature .= "&"; |
189 | 189 | } |
190 | 190 | } |