@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $statusPhrase = $this->status[$statusCode]; |
67 | 67 | } |
68 | 68 | parent::__construct($statusPhrase, $statusCode); |
69 | - $header = sprintf('HTTP/1.1 %d %s', $statusCode, $statusPhrase); |
|
69 | + $header = sprintf('HTTP/1.1 %d %s', $statusCode, $statusPhrase); |
|
70 | 70 | $this->addHeader($header); |
71 | 71 | $this->addHeaders($headers); |
72 | 72 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | foreach ($headers as $key => $header) { |
104 | 104 | if (!is_int($key)) { |
105 | - $header = $key.': '.$header; |
|
105 | + $header = $key . ': ' . $header; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | $this->addHeader($header); |
@@ -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. |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | try { |
24 | 24 | $fileName = basename(__FILE__); |
25 | 25 | $withDate = true; |
26 | - writeLog('Creating Client', $fileName,$withDate); |
|
26 | + writeLog('Creating Client', $fileName, $withDate); |
|
27 | 27 | $orderApiClient = getClient(); |
28 | - writeLog('Client Created', $fileName,$withDate); |
|
29 | - writeLog('Fetching Authorized Orders', $fileName,$withDate); |
|
28 | + writeLog('Client Created', $fileName, $withDate); |
|
29 | + writeLog('Fetching Authorized Orders', $fileName, $withDate); |
|
30 | 30 | $authorizedOrders = $orderApiClient->listOrders(array( |
31 | 31 | 'status' => \Pagantis\OrdersApiClient\Model\Order::STATUS_AUTHORIZED |
32 | 32 | )); |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | if (!isAuthorizedOrderCountAboveZero($authorizedOrders)) { |
35 | 35 | $createdOrders = $orderApiClient->listOrders(array( |
36 | 36 | 'status' => \Pagantis\OrdersApiClient\Model\Order::STATUS_CREATED)); |
37 | - print("<pre>" . print_r("Number of Created Orders: ". count($createdOrders)."\n"."Number of Authorized Orders: " . count($authorizedOrders)."\n"."", true) . "</pre>"); |
|
37 | + print("<pre>" . print_r("Number of Created Orders: " . count($createdOrders) . "\n" . "Number of Authorized Orders: " . count($authorizedOrders) . "\n" . "", true) . "</pre>"); |
|
38 | 38 | exit(); |
39 | 39 | } |
40 | - writeLog('Confirming all Authorized Orders', $fileName,$withDate); |
|
40 | + writeLog('Confirming all Authorized Orders', $fileName, $withDate); |
|
41 | 41 | |
42 | - $confirmedOrders = getConfirmedOrdersRecursively($authorizedOrders,$orderApiClient); |
|
42 | + $confirmedOrders = getConfirmedOrdersRecursively($authorizedOrders, $orderApiClient); |
|
43 | 43 | |
44 | 44 | |
45 | - writeLog('Orders Confirmed', $fileName,$withDate); |
|
46 | - writeLog(jsonEncoded($confirmedOrders), $fileName,$withDate); |
|
45 | + writeLog('Orders Confirmed', $fileName, $withDate); |
|
46 | + writeLog(jsonEncoded($confirmedOrders), $fileName, $withDate); |
|
47 | 47 | /** WARNING: orders must be confirmed on your back office or you will get a empty object */ |
48 | 48 | print("<pre>" . print_r($confirmedOrders, true) . "</pre>"); |
49 | 49 |
@@ -26,17 +26,17 @@ |
||
26 | 26 | $refundTotalAmount = $_POST['refundOrderAmount']; |
27 | 27 | $refundOrderID = $_POST['refundOrderID']; |
28 | 28 | try { |
29 | - writeLog('Creating Client', $fileName,$withDate); |
|
29 | + writeLog('Creating Client', $fileName, $withDate); |
|
30 | 30 | $orderApiClient = getClient(); |
31 | - writeLog('Client Created', $fileName,$withDate); |
|
32 | - writeLog('Setting Refund', $fileName,$withDate); |
|
31 | + writeLog('Client Created', $fileName, $withDate); |
|
32 | + writeLog('Setting Refund', $fileName, $withDate); |
|
33 | 33 | $refund = new \Pagantis\OrdersApiClient\Model\Order\Refund(); |
34 | 34 | $refund |
35 | 35 | ->setPromotedAmount(0) |
36 | 36 | ->setTotalAmount($refundTotalAmount); |
37 | - writeLog('Refund Set', $fileName,$withDate); |
|
37 | + writeLog('Refund Set', $fileName, $withDate); |
|
38 | 38 | $refundCreated = $orderApiClient->refundOrder($refundOrderID, $refund); |
39 | - writeLog(jsonEncoded($refundCreated), $fileName,$withDate); |
|
39 | + writeLog(jsonEncoded($refundCreated), $fileName, $withDate); |
|
40 | 40 | |
41 | 41 | $refundedOrder = $orderApiClient->getOrder($refundOrderID, $asJson); |
42 | 42 | $refundsArray = jsonToArray($refundedOrder); |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
175 | 175 | |
176 | 176 | $orderShippingAddress->setZipCode('08029')->setFullName('Alberto Escudero Sanchez') |
177 | - ->setCountryCode('ES')->setCity('Barcelona') |
|
178 | - ->setAddress('Avenida de la diagonal 525')->setDni('77695544A') |
|
179 | - ->setNationalId('59661738Z')->setFixPhone('931232345') |
|
180 | - ->setMobilePhone('600123124'); |
|
177 | + ->setCountryCode('ES')->setCity('Barcelona') |
|
178 | + ->setAddress('Avenida de la diagonal 525')->setDni('77695544A') |
|
179 | + ->setNationalId('59661738Z')->setFixPhone('931232345') |
|
180 | + ->setMobilePhone('600123124'); |
|
181 | 181 | return $orderShippingAddress; |
182 | 182 | } |
183 | 183 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | { |
195 | 195 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
196 | 196 | $orderUser->setFullName('María Sanchez Escudero')->setAddress($userAddress) |
197 | - ->setBillingAddress($orderBillingAddress)->setShippingAddress($orderShippingAddress) |
|
198 | - ->setDateOfBirth('1985-12-30')->setEmail('[email protected]')->setFixPhone('911231234') |
|
199 | - ->setMobilePhone('600123123')->setDni('59661738Z')->setNationalId('59661738Z'); |
|
197 | + ->setBillingAddress($orderBillingAddress)->setShippingAddress($orderShippingAddress) |
|
198 | + ->setDateOfBirth('1985-12-30')->setEmail('[email protected]')->setFixPhone('911231234') |
|
199 | + ->setMobilePhone('600123123')->setDni('59661738Z')->setNationalId('59661738Z'); |
|
200 | 200 | return $orderUser; |
201 | 201 | } |
202 | 202 | |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | $orderShoppingCart = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart(); |
249 | 249 | |
250 | 250 | $orderShoppingCart->setDetails($details)->setOrderReference($orderID) |
251 | - ->setPromotedAmount(0) // This amount means that the merchant will assume the interests. |
|
252 | - ->setTotalAmount('59999'); |
|
251 | + ->setPromotedAmount(0) // This amount means that the merchant will assume the interests. |
|
252 | + ->setTotalAmount('59999'); |
|
253 | 253 | return $orderShoppingCart; |
254 | 254 | } |
255 | 255 | |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | |
264 | 264 | $orderConfigurationUrls = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Urls(); |
265 | 265 | $orderConfigurationUrls->setCancel($errorUrl)->setKo($errorUrl) |
266 | - ->setAuthorizedNotificationCallback($confirmUrl) |
|
267 | - ->setRejectedNotificationCallback($confirmUrl)->setOk($confirmUrl); |
|
266 | + ->setAuthorizedNotificationCallback($confirmUrl) |
|
267 | + ->setRejectedNotificationCallback($confirmUrl)->setOk($confirmUrl); |
|
268 | 268 | return $orderConfigurationUrls; |
269 | 269 | } |
270 | 270 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | { |
276 | 276 | $orderChannel = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Channel(); |
277 | 277 | $orderChannel->setAssistedSale(false) |
278 | - ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
|
278 | + ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
|
279 | 279 | return $orderChannel; |
280 | 280 | } |
281 | 281 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $order = new \Pagantis\OrdersApiClient\Model\Order(); |
310 | 310 | $order->setConfiguration($orderConfiguration)->setShoppingCart($orderShoppingCart) |
311 | - ->setUser($orderUser); |
|
311 | + ->setUser($orderUser); |
|
312 | 312 | return $order; |
313 | 313 | } |
314 | 314 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | const PUBLIC_KEY = ''; //Set your public key |
9 | 9 | const PRIVATE_KEY = ''; //Set your public key |
10 | 10 | |
11 | -if (!isset($_POST['getOrderID'])){ |
|
11 | +if (!isset($_POST['getOrderID'])) { |
|
12 | 12 | throw new \Exception('You need to input the Order ID'); |
13 | 13 | } |
14 | 14 | try { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $orderApiClient = getClient(); |
18 | 18 | $order = $orderApiClient->getOrder($orderID); |
19 | 19 | $fileName = basename(__FILE__); |
20 | - writeLog("Order ID: ".$order->getId(),$fileName, true); |
|
20 | + writeLog("Order ID: " . $order->getId(), $fileName, true); |
|
21 | 21 | print("<pre>" . print_r($order, true) . "</pre>"); |
22 | 22 | |
23 | 23 | } catch (Exception $e) { |