@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | parent::__construct($statusPhrase, $statusCode); |
| 69 | 69 | |
| 70 | - $header = sprintf('HTTP/1.1 %d %s', $statusCode, $statusPhrase); |
|
| 70 | + $header = sprintf('HTTP/1.1 %d %s', $statusCode, $statusPhrase); |
|
| 71 | 71 | |
| 72 | 72 | $this->addHeader($header); |
| 73 | 73 | $this->addHeaders($headers); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | foreach ($headers as $key => $header) { |
| 106 | 106 | if (!is_int($key)) { |
| 107 | - $header = $key.': '.$header; |
|
| 107 | + $header = $key . ': ' . $header; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $this->addHeader($header); |
@@ -47,7 +47,6 @@ |
||
| 47 | 47 | * @param $assistedSale |
| 48 | 48 | * |
| 49 | 49 | * @return $this |
| 50 | - |
|
| 51 | 50 | */ |
| 52 | 51 | public function setAssistedSale($assistedSale) |
| 53 | 52 | { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | //1. User Object |
| 34 | 34 | writeLog('Creating User object'); |
| 35 | 35 | writeLog('Adding the address of the user'); |
| 36 | - $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
| 36 | + $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
| 37 | 37 | $userAddress |
| 38 | 38 | ->setZipCode('28031') |
| 39 | 39 | ->setFullName('María Sanchez Escudero') |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $orderBillingAddress = $userAddress; |
| 48 | 48 | |
| 49 | - $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
| 49 | + $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
| 50 | 50 | $orderShippingAddress |
| 51 | 51 | ->setZipCode('08029') |
| 52 | 52 | ->setFullName('Alberto Escudero Sanchez') |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ->setUser($orderUser); |
| 132 | 132 | |
| 133 | 133 | writeLog('Creating OrdersApiClient'); |
| 134 | - if (PUBLIC_KEY=='' || PRIVATE_KEY == '') { |
|
| 134 | + if (PUBLIC_KEY == '' || PRIVATE_KEY == '') { |
|
| 135 | 135 | throw new \Exception('You need set the public and private key'); |
| 136 | 136 | } |
| 137 | 137 | $orderClient = new \Pagantis\OrdersApiClient\Client(PUBLIC_KEY, PRIVATE_KEY); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // You can use our test credit cards to fill the Pagantis form |
| 154 | 154 | writeLog("Redirecting to Pagantis form => $url"); |
| 155 | - header('Location:'. $url); |
|
| 155 | + header('Location:' . $url); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * @var array $allowedCountries |
| 32 | 32 | */ |
| 33 | - private $allowedCountries = array('IT','ES','PT','FR'); |
|
| 33 | + private $allowedCountries = array('IT', 'ES', 'PT', 'FR'); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Configuration constructor. |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $orderBillingAddress = $userAddress; |
| 42 | 42 | |
| 43 | - $orderShippingAddress = array(); |
|
| 43 | + $orderShippingAddress = array(); |
|
| 44 | 44 | $orderShippingAddress['zip_code'] = '08029'; |
| 45 | 45 | $orderShippingAddress['full_name'] = 'Alberto Escudero Sanchez'; |
| 46 | 46 | $orderShippingAddress['country_code'] = 'ES'; |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | $orderShippingAddress['national_id'] = '77695544A'; |
| 53 | 53 | |
| 54 | 54 | writeLog('Adding the purchases of the customer, if there are.'); |
| 55 | - $orderHistory = array ( |
|
| 56 | - 0 => array ( |
|
| 55 | + $orderHistory = array( |
|
| 56 | + 0 => array( |
|
| 57 | 57 | 'date' => '2020-01-31', |
| 58 | 58 | 'amount' => 989, |
| 59 | 59 | ), |
| 60 | - 1 => array ( |
|
| 60 | + 1 => array( |
|
| 61 | 61 | 'date' => '2020-01-31', |
| 62 | 62 | 'amount' => 898, |
| 63 | 63 | ) |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $order['user'] = $orderUser; |
| 129 | 129 | |
| 130 | 130 | writeLog('Preparing connection'); |
| 131 | - if (PUBLIC_KEY=='' || PRIVATE_KEY == '') { |
|
| 131 | + if (PUBLIC_KEY == '' || PRIVATE_KEY == '') { |
|
| 132 | 132 | throw new \Exception('You need set the public and private key'); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | curl_setopt($cliente, CURLOPT_RETURNTRANSFER, true); |
| 144 | 144 | curl_setopt($cliente, CURLOPT_HTTPHEADER, array( |
| 145 | 145 | "Content-Type:application/json", |
| 146 | - "Authorization: Bearer ".PRIVATE_KEY |
|
| 146 | + "Authorization: Bearer " . PRIVATE_KEY |
|
| 147 | 147 | )); |
| 148 | 148 | |
| 149 | 149 | $raw_response = curl_exec($cliente); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | // You can use our test credit cards to fill the Pagantis form |
| 164 | 164 | writeLog("Redirecting to Pagantis form => $url"); |
| 165 | - header('Location:'. $url); |
|
| 165 | + header('Location:' . $url); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -182,16 +182,16 @@ discard block |
||
| 182 | 182 | writeLog('Getting order information'); |
| 183 | 183 | |
| 184 | 184 | writeLog('Preparing connection'); |
| 185 | - if (PUBLIC_KEY=='' || PRIVATE_KEY == '') { |
|
| 185 | + if (PUBLIC_KEY == '' || PRIVATE_KEY == '') { |
|
| 186 | 186 | throw new \Exception('You need set the public and private key'); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $cliente = curl_init(); |
| 190 | - curl_setopt($cliente, CURLOPT_URL, "https://api.pagamastarde.com/v2/orders/".$_SESSION['order_id']."/"); |
|
| 190 | + curl_setopt($cliente, CURLOPT_URL, "https://api.pagamastarde.com/v2/orders/" . $_SESSION['order_id'] . "/"); |
|
| 191 | 191 | curl_setopt($cliente, CURLOPT_RETURNTRANSFER, true); |
| 192 | 192 | curl_setopt($cliente, CURLOPT_HTTPHEADER, array( |
| 193 | 193 | "Content-Type:application/json", |
| 194 | - "Authorization: Bearer ".PRIVATE_KEY |
|
| 194 | + "Authorization: Bearer " . PRIVATE_KEY |
|
| 195 | 195 | )); |
| 196 | 196 | |
| 197 | 197 | $raw_response = curl_exec($cliente); |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | writeLog('Confirming order'); |
| 204 | 204 | |
| 205 | 205 | $cliente = curl_init(); |
| 206 | - curl_setopt($cliente, CURLOPT_URL, "https://api.pagamastarde.com/v2/orders/".$order->id."/confirm"); |
|
| 206 | + curl_setopt($cliente, CURLOPT_URL, "https://api.pagamastarde.com/v2/orders/" . $order->id . "/confirm"); |
|
| 207 | 207 | curl_setopt($cliente, CURLOPT_CUSTOMREQUEST, "PUT"); |
| 208 | 208 | curl_setopt($cliente, CURLOPT_RETURNTRANSFER, true); |
| 209 | 209 | curl_setopt($cliente, CURLOPT_HTTPHEADER, array( |
| 210 | 210 | "Content-Type:application/json", |
| 211 | - "Authorization: Bearer ".PRIVATE_KEY |
|
| 211 | + "Authorization: Bearer " . PRIVATE_KEY |
|
| 212 | 212 | )); |
| 213 | 213 | |
| 214 | 214 | $raw_response = curl_exec($cliente); |