Passed
Pull Request — master (#28)
by pablo
02:15
created
examples/simpleTest_curl.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.