@@ -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 | { |
@@ -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. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <?php if (isset($_SESSION['success_message'])): ?> |
33 | 33 | <div class="alert alert-success alert-dismissible fade show" role="alert" |
34 | 34 | onclick="<?php session_destroy(); |
35 | - session_regenerate_id(); ?>"> |
|
35 | + session_regenerate_id(); ?>"> |
|
36 | 36 | <h4 class="alert-heading"><?php echo $_SESSION['success_message'] ?></h4> |
37 | 37 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
38 | 38 | <span aria-hidden="true">×</span> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | <div class="alert alert-success alert-dismissible fade show" role="alert" |
45 | 45 | onclick="<?php session_destroy(); |
46 | - session_regenerate_id(); ?>"> |
|
46 | + session_regenerate_id(); ?>"> |
|
47 | 47 | <?php echo $_SESSION['failure_message'] ?> |
48 | 48 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
49 | 49 | <span aria-hidden="true">×</span> |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | <?php if (isset($_SESSION['order_not_found_message'])): ?> |
56 | 56 | <div class="alert alert-success alert-dismissible fade show" role="alert" |
57 | 57 | onclick="<?php session_destroy(); |
58 | - session_regenerate_id(); ?>"> |
|
58 | + session_regenerate_id(); ?>"> |
|
59 | 59 | <h4 class="alert-heading"><?php echo $_SESSION['order_not_found_message'] ?></h4> |
60 | 60 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
61 | 61 | <span aria-hidden="true">×</span> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $orderApiClient = getOrderApiClient(); |
39 | 39 | $refund = new \Pagantis\OrdersApiClient\Model\Order\Refund(); |
40 | 40 | $refund->setPromotedAmount(0) |
41 | - ->setTotalAmount($refundOrderAmount); |
|
41 | + ->setTotalAmount($refundOrderAmount); |
|
42 | 42 | $refundCreated = $orderApiClient->refundOrder($refundOrderID, $refund); |
43 | 43 | } catch (Exception $e) { |
44 | 44 | $e->getMessage(); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <!DOCTYPE HTML> |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | - <?php include(__DIR__.'/sections/header.php')?> |
|
4 | + <?php include(__DIR__ . '/sections/header.php')?> |
|
5 | 5 | <title> Refund Order ID</title> |
6 | 6 | </head> |
7 | 7 | <body> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | echo showKeysMissingErrorMessage(); |
15 | 15 | } ?> |
16 | 16 | </div> |
17 | - <?php include(__DIR__.'/sections/navBar.php') ?> |
|
17 | + <?php include(__DIR__ . '/sections/navBar.php') ?> |
|
18 | 18 | |
19 | 19 | <div class="col-md-auto"> |
20 | 20 | <div class="row justify-content-center"> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | <?php endif; ?> |
68 | 68 | </results> |
69 | 69 | |
70 | - <?php include(__DIR__.'/sections/footer.php') ?> |
|
70 | + <?php include(__DIR__ . '/sections/footer.php') ?> |
|
71 | 71 | |
72 | 72 | </div> |
73 | 73 | </body> |
@@ -69,10 +69,12 @@ |
||
69 | 69 | </div> |
70 | 70 | </orderCards> |
71 | 71 | |
72 | - <?php else : ?> |
|
72 | + <?php else { |
|
73 | + : ?> |
|
73 | 74 | <?php |
74 | 75 | try { |
75 | 76 | $orderApiClient = getOrderApiClient(); |
77 | +} |
|
76 | 78 | $createdOrders = getCreatedOrders($orderApiClient, $asJson = true); |
77 | 79 | $invalidatedOrders = getInvalidatedOrders($orderApiClient, $asJson = true); |
78 | 80 | } catch (\Exception $e) { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <!DOCTYPE HTML> |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | - <?php include(__DIR__.'/sections/header.php')?> |
|
4 | + <?php include(__DIR__ . '/sections/header.php')?> |
|
5 | 5 | <title>Confirm Orders</title> |
6 | 6 | </head> |
7 | 7 | <body> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | echo showKeysMissingErrorMessage(); |
15 | 15 | } ?> |
16 | 16 | </div> |
17 | - <?php include(__DIR__.'/sections/navBar.php') ?> |
|
17 | + <?php include(__DIR__ . '/sections/navBar.php') ?> |
|
18 | 18 | |
19 | 19 | <div class="col-md-auto"> |
20 | 20 | <div class="row justify-content-center"> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | </div> |
94 | 94 | </alertBoxes> |
95 | 95 | |
96 | - <?php include(__DIR__.'/sections/footer.php') ?>/sections/footer.php') ?> |
|
96 | + <?php include(__DIR__ . '/sections/footer.php') ?>/sections/footer.php') ?> |
|
97 | 97 | |
98 | 98 | </div> |
99 | 99 | </body> |
@@ -65,26 +65,26 @@ discard block |
||
65 | 65 | $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
66 | 66 | |
67 | 67 | $orderShippingAddress->setZipCode('08029') |
68 | - ->setFullName('Alberto Escudero Sanchez') |
|
69 | - ->setCountryCode('ES') |
|
70 | - ->setCity('Barcelona') |
|
71 | - ->setAddress('Avenida de la diagonal 525') |
|
72 | - ->setDni('77695544A') |
|
73 | - ->setNationalId('59661738Z') |
|
74 | - ->setFixPhone('931232345') |
|
75 | - ->setMobilePhone('600123124'); |
|
68 | + ->setFullName('Alberto Escudero Sanchez') |
|
69 | + ->setCountryCode('ES') |
|
70 | + ->setCity('Barcelona') |
|
71 | + ->setAddress('Avenida de la diagonal 525') |
|
72 | + ->setDni('77695544A') |
|
73 | + ->setNationalId('59661738Z') |
|
74 | + ->setFixPhone('931232345') |
|
75 | + ->setMobilePhone('600123124'); |
|
76 | 76 | writeLog('Adding the information of the user', $logsFileName, $logsWithDate); |
77 | 77 | $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User(); |
78 | 78 | $orderUser->setFullName('María Sanchez Escudero') |
79 | - ->setAddress($userAddress) |
|
80 | - ->setBillingAddress($orderBillingAddress) |
|
81 | - ->setShippingAddress($orderShippingAddress) |
|
82 | - ->setDateOfBirth('1985-12-30') |
|
83 | - ->setEmail('[email protected]') |
|
84 | - ->setFixPhone('911231234') |
|
85 | - ->setMobilePhone('600123123') |
|
86 | - ->setDni('59661738Z') |
|
87 | - ->setNationalId('59661738Z'); |
|
79 | + ->setAddress($userAddress) |
|
80 | + ->setBillingAddress($orderBillingAddress) |
|
81 | + ->setShippingAddress($orderShippingAddress) |
|
82 | + ->setDateOfBirth('1985-12-30') |
|
83 | + ->setEmail('[email protected]') |
|
84 | + ->setFixPhone('911231234') |
|
85 | + ->setMobilePhone('600123123') |
|
86 | + ->setDni('59661738Z') |
|
87 | + ->setNationalId('59661738Z'); |
|
88 | 88 | writeLog('User object created', $logsFileName, $logsWithDate); |
89 | 89 | |
90 | 90 | //2. ShoppingCart Object |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | writeLog('Adding the purchases of the customer, if there are any.', $logsFileName, $logsWithDate); |
93 | 93 | $orderHistory = new \Pagantis\OrdersApiClient\Model\Order\User\OrderHistory(); |
94 | 94 | $orderHistory->setAmount('2499') |
95 | - ->setDate('2010-01-31'); |
|
95 | + ->setDate('2010-01-31'); |
|
96 | 96 | |
97 | 97 | $orderUser->addOrderHistory($orderHistory); |
98 | 98 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | $orderShoppingCart = new \Pagantis\OrdersApiClient\Model\Order\ShoppingCart(); |
110 | 110 | $orderShoppingCart->setDetails($details) |
111 | - ->setOrderReference(ORDER_ID) |
|
112 | - ->setPromotedAmount(0) // This amount means that the merchant will assume the interests. |
|
113 | - ->setTotalAmount('59999'); |
|
111 | + ->setOrderReference(ORDER_ID) |
|
112 | + ->setPromotedAmount(0) // This amount means that the merchant will assume the interests. |
|
113 | + ->setTotalAmount('59999'); |
|
114 | 114 | writeLog('Created OrderShoppingCart object', $logsFileName, $logsWithDate); |
115 | 115 | |
116 | 116 | //3. Configuration Object |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | |
123 | 123 | $orderConfigurationUrls = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Urls(); |
124 | 124 | $orderConfigurationUrls->setCancel($errorUrl) |
125 | - ->setKo($errorUrl) |
|
126 | - ->setAuthorizedNotificationCallback($confirmUrl) |
|
127 | - ->setRejectedNotificationCallback($confirmUrl) |
|
128 | - ->setOk($confirmUrl); |
|
125 | + ->setKo($errorUrl) |
|
126 | + ->setAuthorizedNotificationCallback($confirmUrl) |
|
127 | + ->setRejectedNotificationCallback($confirmUrl) |
|
128 | + ->setOk($confirmUrl); |
|
129 | 129 | writeLog('Adding channel info', $logsFileName, $logsWithDate); |
130 | 130 | |
131 | 131 | $orderChannel = new \Pagantis\OrdersApiClient\Model\Order\Configuration\Channel(); |
132 | 132 | $orderChannel->setAssistedSale(false) |
133 | - ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
|
133 | + ->setType(\Pagantis\OrdersApiClient\Model\Order\Configuration\Channel::ONLINE); |
|
134 | 134 | |
135 | 135 | $orderConfiguration = new \Pagantis\OrdersApiClient\Model\Order\Configuration(); |
136 | 136 | $orderConfiguration->setChannel($orderChannel) |
137 | - ->setUrls($orderConfigurationUrls); |
|
137 | + ->setUrls($orderConfigurationUrls); |
|
138 | 138 | |
139 | 139 | writeLog('Created Configuration object', $logsFileName, $logsWithDate); |
140 | 140 | |
141 | 141 | $order = new \Pagantis\OrdersApiClient\Model\Order(); |
142 | 142 | $order->setConfiguration($orderConfiguration) |
143 | - ->setShoppingCart($orderShoppingCart) |
|
144 | - ->setUser($orderUser); |
|
143 | + ->setShoppingCart($orderShoppingCart) |
|
144 | + ->setUser($orderUser); |
|
145 | 145 | $orderClient = getOrderApiClient(); |
146 | 146 | $order = $orderClient->createOrder($order); |
147 | 147 | writeLog(jsonEncoded($order), $logsFileName, $logsWithDate); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | writeLog(jsonEncoded($order->export()), basename(__FILE__), $logsWithDate); |
161 | 161 | $formUrl = $order->getActionUrls() |
162 | - ->getForm(); |
|
162 | + ->getForm(); |
|
163 | 163 | // You can use our test credit cards to fill the Pagantis form |
164 | 164 | writeLog("Redirecting to Pagantis form => $formUrl", $logsFileName, $logsWithDate); |
165 | 165 | header('Location:' . $formUrl); |
@@ -200,7 +200,7 @@ |
||
200 | 200 | /* The order has been marked as paid and confirmed in Pagantis so you will send the product to your customer and |
201 | 201 | * Pagantis will pay you in the next 24h. |
202 | 202 | */ |
203 | - $_SESSION['success_message'] = 'Order ' . $order->getId() .' has been confirmed'; |
|
203 | + $_SESSION['success_message'] = 'Order ' . $order->getId() . ' has been confirmed'; |
|
204 | 204 | $_SESSION['confirmed_order_id'] = $order->getId(); |
205 | 205 | header('Location:' . 'http://0.0.0.0:8000'); |
206 | 206 | } else { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <!DOCTYPE HTML> |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | - <?php include(__DIR__.'/sections/header.php')?> |
|
4 | + <?php include(__DIR__ . '/sections/header.php')?> |
|
5 | 5 | <title> Get Order by ID</title> |
6 | 6 | </head> |
7 | 7 | <body> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | echo showKeysMissingErrorMessage(); |
16 | 16 | } ?> |
17 | 17 | </div> |
18 | - <?php include(__DIR__.'/sections/navBar.php') ?> |
|
18 | + <?php include(__DIR__ . '/sections/navBar.php') ?> |
|
19 | 19 | |
20 | 20 | <div class="col-md-auto"> |
21 | 21 | <div class="row justify-content-center"> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | </results> |
69 | 69 | |
70 | - <?php include(__DIR__.'/sections/footer.php') ?> |
|
70 | + <?php include(__DIR__ . '/sections/footer.php') ?> |
|
71 | 71 | |
72 | 72 | </body> |
73 | 73 | </html> |
74 | 74 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <!DOCTYPE HTML> |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | - <?php include(__DIR__.'/sections/header.php')?> |
|
4 | + <?php include(__DIR__ . '/sections/header.php')?> |
|
5 | 5 | <title> List orders by Status</title> |
6 | 6 | </head> |
7 | 7 | <body> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | echo showKeysMissingErrorMessage(); |
14 | 14 | } ?> |
15 | 15 | </div> |
16 | - <?php include(__DIR__.'/sections/navBar.php') ?> |
|
16 | + <?php include(__DIR__ . '/sections/navBar.php') ?> |
|
17 | 17 | <div class="col-md-auto"> |
18 | 18 | <div class="row justify-content-center"> |
19 | 19 | <h5>List Orders Example</h5> |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | </div> |
75 | 75 | </alertBoxes> |
76 | 76 | |
77 | - <?php include(__DIR__.'/sections/footer.php') ?> |
|
77 | + <?php include(__DIR__ . '/sections/footer.php') ?> |
|
78 | 78 | |
79 | 79 | </div> |
80 | 80 | </body> |