|
@@ -371,30 +371,30 @@ discard block |
|
|
block discarded – undo |
|
371
|
371
|
->setAddress($shippingAddress['address_1'] . ' ' . $shippingAddress['address_2']); |
|
372
|
372
|
$orderShippingAddress = new Address(); |
|
373
|
373
|
$orderShippingAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'] |
|
374
|
|
- . ' ' |
|
375
|
|
- . $shippingAddress['last_name']) |
|
376
|
|
- ->setCountryCode($shippingAddress['country'] !== '' |
|
|
374
|
+ . ' ' |
|
|
375
|
+ . $shippingAddress['last_name']) |
|
|
376
|
+ ->setCountryCode($shippingAddress['country'] !== '' |
|
377
|
377
|
? strtoupper($shippingAddress['country']) : strtoupper($this->language)) |
|
378
|
|
- ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
|
379
|
|
- . $shippingAddress['address_2']) |
|
380
|
|
- ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
381
|
|
- ->setNationalId($national_id)->setTaxId($tax_id); |
|
|
378
|
+ ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
|
|
379
|
+ . $shippingAddress['address_2']) |
|
|
380
|
+ ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
|
381
|
+ ->setNationalId($national_id)->setTaxId($tax_id); |
|
382
|
382
|
$orderBillingAddress = new Address(); |
|
383
|
383
|
$orderBillingAddress->setZipCode($billingAddress['postcode'])->setFullName($billingAddress['first_name'] |
|
384
|
|
- . ' ' |
|
385
|
|
- . $billingAddress['last_name']) |
|
|
384
|
+ . ' ' |
|
|
385
|
+ . $billingAddress['last_name']) |
|
386
|
386
|
->setCountryCode($billingAddress['country'] !== '' |
|
387
|
387
|
? strtoupper($billingAddress['country']) : strtoupper($this->language)) |
|
388
|
388
|
->setCity($billingAddress['city'])->setAddress($billingAddress['address_1'] . ' ' |
|
389
|
|
- . $billingAddress['address_2']) |
|
|
389
|
+ . $billingAddress['address_2']) |
|
390
|
390
|
->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
391
|
391
|
->setNationalId($national_id)->setTaxId($tax_id); |
|
392
|
392
|
$orderUser = new User(); |
|
393
|
393
|
$orderUser->setAddress($userAddress)->setFullName($billingAddress['first_name'] . ' ' |
|
394
|
|
- . $billingAddress['last_name']) |
|
395
|
|
- ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
396
|
|
- ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
397
|
|
- ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
|
394
|
+ . $billingAddress['last_name']) |
|
|
395
|
+ ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
|
396
|
+ ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
|
397
|
+ ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
398
|
398
|
|
|
399
|
399
|
$previousOrders = $this->getOrders($order->get_user(), $billingAddress['email']); |
|
400
|
400
|
foreach ($previousOrders as $previousOrder) { |
|
@@ -402,7 +402,7 @@ discard block |
|
|
block discarded – undo |
|
402
|
402
|
$orderElement = wc_get_order($previousOrder); |
|
403
|
403
|
$orderCreated = $orderElement->get_date_created(); |
|
404
|
404
|
$orderHistory->setAmount(intval(100 * $orderElement->get_total())) |
|
405
|
|
- ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
|
405
|
+ ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
406
|
406
|
$orderUser->addOrderHistory($orderHistory); |
|
407
|
407
|
} |
|
408
|
408
|
|
|
@@ -451,7 +451,7 @@ discard block |
|
|
block discarded – undo |
|
451
|
451
|
|
|
452
|
452
|
$orderShoppingCart = new ShoppingCart(); |
|
453
|
453
|
$orderShoppingCart->setDetails($details)->setOrderReference($order->get_id()) |
|
454
|
|
- ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
|
454
|
+ ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
455
|
455
|
$orderConfigurationUrls = new Urls(); |
|
456
|
456
|
$cancelUrl = $this->getKoUrl($order); |
|
457
|
457
|
$callback_arg = array( |
|
@@ -470,8 +470,8 @@ discard block |
|
|
block discarded – undo |
|
470
|
470
|
$callback_url_notif = add_query_arg($callback_arg_notif, home_url('/')); |
|
471
|
471
|
|
|
472
|
472
|
$orderConfigurationUrls->setCancel($cancelUrl)->setKo($callback_url_user) |
|
473
|
|
- ->setAuthorizedNotificationCallback($callback_url_notif) |
|
474
|
|
- ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
|
473
|
+ ->setAuthorizedNotificationCallback($callback_url_notif) |
|
|
474
|
+ ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
475
|
475
|
$orderChannel = new Channel(); |
|
476
|
476
|
$orderChannel->setAssistedSale(false)->setType(Channel::ONLINE); |
|
477
|
477
|
|
|
@@ -487,11 +487,11 @@ discard block |
|
|
block discarded – undo |
|
487
|
487
|
|
|
488
|
488
|
$orderConfiguration = new Configuration(); |
|
489
|
489
|
$orderConfiguration->setChannel($orderChannel)->setUrls($orderConfigurationUrls) |
|
490
|
|
- ->setPurchaseCountry($purchaseCountry); |
|
|
490
|
+ ->setPurchaseCountry($purchaseCountry); |
|
491
|
491
|
|
|
492
|
492
|
$orderApiClient = new Order(); |
|
493
|
493
|
$orderApiClient->setConfiguration($orderConfiguration)->setMetadata($metadataOrder) |
|
494
|
|
- ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
|
494
|
+ ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
495
|
495
|
|
|
496
|
496
|
if ($this->pagantis_public_key === '' || $this->pagantis_private_key === '') { |
|
497
|
497
|
throw new \Exception('Public and Secret Key not found'); |