@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | ->setAddress($shippingAddress['address_1'] . ' ' . $shippingAddress['address_2']); |
242 | 242 | $orderShippingAddress = new Address(); |
243 | 243 | $orderShippingAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'] |
244 | - . ' ' |
|
244 | + . ' ' |
|
245 | 245 | . $shippingAddress['last_name']) |
246 | 246 | ->setCountryCode($shippingAddress['country'] !== '' |
247 | 247 | ? strtoupper($shippingAddress['country']) : strtoupper($this->language)) |
248 | 248 | ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
249 | 249 | . $shippingAddress['address_2']) |
250 | - ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
251 | - ->setNationalId($national_id)->setTaxId($tax_id); |
|
250 | + ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
251 | + ->setNationalId($national_id)->setTaxId($tax_id); |
|
252 | 252 | $orderBillingAddress = new Address(); |
253 | 253 | $orderBillingAddress->setZipCode($billingAddress['postcode'])->setFullName($billingAddress['first_name'] |
254 | - . ' ' |
|
254 | + . ' ' |
|
255 | 255 | . $billingAddress['last_name']) |
256 | 256 | ->setCountryCode($billingAddress['country'] !== '' |
257 | 257 | ? strtoupper($billingAddress['country']) : strtoupper($this->language)) |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | $orderUser = new User(); |
263 | 263 | $orderUser->setAddress($userAddress)->setFullName($billingAddress['first_name'] . ' ' |
264 | 264 | . $billingAddress['last_name']) |
265 | - ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
266 | - ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
267 | - ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
265 | + ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
266 | + ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
267 | + ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
268 | 268 | |
269 | 269 | $previousOrders = $this->getOrders($order->get_user(), $billingAddress['email']); |
270 | 270 | foreach ($previousOrders as $previousOrder) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $orderElement = wc_get_order($previousOrder); |
273 | 273 | $orderCreated = $orderElement->get_date_created(); |
274 | 274 | $orderHistory->setAmount(intval(100 * $orderElement->get_total())) |
275 | - ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
275 | + ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
276 | 276 | $orderUser->addOrderHistory($orderHistory); |
277 | 277 | } |
278 | 278 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $orderShoppingCart = new ShoppingCart(); |
323 | 323 | $orderShoppingCart->setDetails($details)->setOrderReference($order->get_id()) |
324 | - ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
324 | + ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
325 | 325 | $orderConfigurationUrls = new Urls(); |
326 | 326 | $cancelUrl = $this->getKoUrl($order); |
327 | 327 | $callback_arg = array( |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | $callback_url_notif = add_query_arg($callback_arg_notif, home_url('/')); |
341 | 341 | |
342 | 342 | $orderConfigurationUrls->setCancel($cancelUrl)->setKo($callback_url_user) |
343 | - ->setAuthorizedNotificationCallback($callback_url_notif) |
|
344 | - ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
343 | + ->setAuthorizedNotificationCallback($callback_url_notif) |
|
344 | + ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
345 | 345 | $orderChannel = new Channel(); |
346 | 346 | $orderChannel->setAssistedSale(false)->setType(Channel::ONLINE); |
347 | 347 | |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | |
356 | 356 | $orderConfiguration = new Configuration(); |
357 | 357 | $orderConfiguration->setChannel($orderChannel)->setUrls($orderConfigurationUrls) |
358 | - ->setPurchaseCountry($purchaseCountry); |
|
358 | + ->setPurchaseCountry($purchaseCountry); |
|
359 | 359 | |
360 | 360 | $orderApiClient = new Order(); |
361 | 361 | $orderApiClient->setConfiguration($orderConfiguration)->setMetadata($metadataOrder) |
362 | - ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
362 | + ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
363 | 363 | |
364 | 364 | if ($this->pagantis_public_key === '' || $this->pagantis_private_key === '') { |
365 | 365 | throw new \Exception('Public and Secret Key not found'); |
@@ -22,58 +22,58 @@ discard block |
||
22 | 22 | class WC_PG_Notification_Handler extends WC_Pagantis_Gateway |
23 | 23 | { |
24 | 24 | /** |
25 | - * Concurrency table name |
|
26 | - */ |
|
25 | + * Concurrency table name |
|
26 | + */ |
|
27 | 27 | const CONCURRENCY_TABLE = 'pagantis_concurrency'; |
28 | 28 | |
29 | 29 | /** |
30 | - * Seconds to expire a locked request |
|
31 | - */ |
|
30 | + * Seconds to expire a locked request |
|
31 | + */ |
|
32 | 32 | const CONCURRENCY_TIMEOUT = 5; |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Pagantis Order Number |
36 | 36 | * |
37 | - * @var mixed $pagantisOrder |
|
38 | - */ |
|
37 | + * @var mixed $pagantisOrder |
|
38 | + */ |
|
39 | 39 | protected $pagantisOrder; |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Origin of Order |
43 | 43 | * |
44 | - * @var $string $origin |
|
45 | - */ |
|
44 | + * @var $string $origin |
|
45 | + */ |
|
46 | 46 | public $origin; |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * WC_Order object |
50 | 50 | * |
51 | - * @var $string |
|
52 | - */ |
|
51 | + * @var $string |
|
52 | + */ |
|
53 | 53 | public $order; |
54 | 54 | |
55 | 55 | /** |
56 | - * @var mixed $woocommerceOrderId |
|
57 | - */ |
|
56 | + * @var mixed $woocommerceOrderId |
|
57 | + */ |
|
58 | 58 | protected $woocommerceOrderId = ''; |
59 | 59 | |
60 | 60 | /** |
61 | - * @var mixed $cfg |
|
62 | - */ |
|
61 | + * @var mixed $cfg |
|
62 | + */ |
|
63 | 63 | protected $cfg; |
64 | 64 | |
65 | 65 | /** |
66 | - * @var Client $orderClient |
|
66 | + * @var Client $orderClient |
|
67 | 67 | */ |
68 | 68 | protected $orderClient; |
69 | 69 | |
70 | 70 | /** |
71 | - * @var WC_Order $woocommerceOrder |
|
71 | + * @var WC_Order $woocommerceOrder |
|
72 | 72 | */ |
73 | 73 | protected $woocommerceOrder; |
74 | 74 | |
75 | 75 | /** |
76 | - * @var mixed $pagantisOrderId |
|
76 | + * @var mixed $pagantisOrderId |
|
77 | 77 | */ |
78 | 78 | protected $pagantisOrderId = ''; |
79 | 79 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | |
227 | 227 | if (!$this->woocommerceOrder->has_status($isValidStatus)) { // TO CONFIRM |
228 | 228 | $logMessage = 'WARNING checkMerchantOrderStatus.' . |
229 | - ' Merchant order id:'.$this->woocommerceOrder->get_id(). |
|
230 | - ' Merchant order status:'.$this->woocommerceOrder->get_status(). |
|
231 | - ' Pagantis order id:'.$this->pagantisOrder->getStatus(). |
|
232 | - ' Pagantis order status:'.$this->pagantisOrder->getId(); |
|
229 | + ' Merchant order id:'.$this->woocommerceOrder->get_id(). |
|
230 | + ' Merchant order status:'.$this->woocommerceOrder->get_status(). |
|
231 | + ' Pagantis order id:'.$this->pagantisOrder->getStatus(). |
|
232 | + ' Pagantis order status:'.$this->pagantisOrder->getId(); |
|
233 | 233 | |
234 | 234 | WC_Pagantis_Logger::insert_log_entry_in_wpdb(null, $logMessage); |
235 | 235 | $this->woocommerceOrder->add_order_note($logMessage); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * UTILS FUNCTIONS |
288 | 288 | */ |
289 | 289 | /** |
290 | - * STEP 1 CC - Check concurrency |
|
290 | + * STEP 1 CC - Check concurrency |
|
291 | 291 | */ |
292 | 292 | /** |
293 | 293 | * Check if orders table exists |
@@ -327,16 +327,16 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | - * STEP 2 GMO - Get Merchant Order |
|
330 | + * STEP 2 GMO - Get Merchant Order |
|
331 | 331 | */ |
332 | 332 | /** |
333 | - * STEP 3 GPOI - Get Pagantis OrderId |
|
333 | + * STEP 3 GPOI - Get Pagantis OrderId |
|
334 | 334 | */ |
335 | 335 | /** |
336 | - * STEP 4 GPO - Get Pagantis Order |
|
336 | + * STEP 4 GPO - Get Pagantis Order |
|
337 | 337 | */ |
338 | 338 | /** |
339 | - * STEP 5 COS - Check Order Status |
|
339 | + * STEP 5 COS - Check Order Status |
|
340 | 340 | */ |
341 | 341 | |
342 | 342 | /** |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * STEP 6 CMOS - Check Merchant Order Status |
|
370 | + * STEP 6 CMOS - Check Merchant Order Status |
|
371 | 371 | */ |
372 | 372 | /** |
373 | - * STEP 7 VA - Validate Amount |
|
373 | + * STEP 7 VA - Validate Amount |
|
374 | 374 | */ |
375 | 375 | /** |
376 | - * STEP 8 PMO - Process Merchant Order |
|
376 | + * STEP 8 PMO - Process Merchant Order |
|
377 | 377 | */ |
378 | 378 | /** |
379 | 379 | * @throws \Exception |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
429 | - * STEP 9 CPO - Confirmation Pagantis Order |
|
430 | - */ |
|
429 | + * STEP 9 CPO - Confirmation Pagantis Order |
|
430 | + */ |
|
431 | 431 | private function rollbackMerchantOrder() |
432 | 432 | { |
433 | 433 | $this->woocommerceOrder->update_status('pending', __('Pending payment', 'woocommerce')); // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch |