-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License version 3.0 | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 | ||
*/ | ||
|
||
namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\Comparator; | ||
|
||
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject\PayPalOrder; | ||
|
@@ -46,12 +65,14 @@ private function compareValues($value1, $value2) | |
} else { | ||
$result |= $value1 !== $value2; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* @param array $array1 | ||
* @param array $array2 | ||
* | ||
* @return false|int|string | ||
*/ | ||
private function compareArraysDeep($array1, $array2) | ||
|
@@ -70,6 +91,7 @@ private function compareArraysDeep($array1, $array2) | |
$result |= $oldValue !== $newValue; | ||
} | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License version 3.0 | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 | ||
*/ | ||
|
||
namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject; | ||
|
||
use PrestaShop\Module\PrestashopCheckout\Order\ValueObject\OrderId; | ||
|
@@ -39,7 +58,7 @@ class PayPalOrder | |
*/ | ||
private $links; | ||
|
||
public function __construct(PayPalOrderId $id = null, $status = null, $intent = null, PayPalOrderPaymentSource $paymentSource = null, $purchaseUnits = [], $payer = [], $createTime = null, $links = [] ) | ||
public function __construct(PayPalOrderId $id = null, $status = null, $intent = null, PayPalOrderPaymentSource $paymentSource = null, $purchaseUnits = [], $payer = [], $createTime = null, $links = []) | ||
{ | ||
$this->id = $id; | ||
$this->status = $status; | ||
|
@@ -189,12 +208,12 @@ public function toArray() | |
'status' => $this->status, | ||
'intent' => $this->intent, | ||
'payment_source' => $this->paymentSource === null ? null : $this->paymentSource->toArray(), | ||
'purchase_units' => array_map(function(PayPalOrderPurchaseUnit $purchaseUnit) { | ||
'purchase_units' => array_map(function (PayPalOrderPurchaseUnit $purchaseUnit) { | ||
return $purchaseUnit->toArray(); | ||
}, $this->purchaseUnits), | ||
'payer' => $this->payer, | ||
'create_time' => $this->createTime, | ||
'links' => $this->links | ||
'links' => $this->links, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License version 3.0 | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 | ||
*/ | ||
|
||
namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject; | ||
|
||
class PayPalOrderPayer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License version 3.0 | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 | ||
*/ | ||
|
||
namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject; | ||
|
||
class PayPalOrderPaymentSource | ||
|
@@ -59,7 +78,6 @@ class PayPalOrderPaymentSource | |
*/ | ||
public function __construct($name, $referenceId, $paymentMethodPreference = null, $paymentMethodSelected = null, $brandName = null, $locale = null, $landingPage = null, $userAction = null, $returnUrl = null, $cancelUrl = null) | ||
{ | ||
|
||
$this->name = $name; | ||
$this->referenceId = $referenceId; | ||
$this->paymentMethodPreference = $paymentMethodPreference; | ||
|
@@ -221,16 +239,16 @@ public function toArray() | |
return [ | ||
$this->name => [ | ||
'experience_context' => [ | ||
"payment_method_preference" => $this->paymentMethodPreference, | ||
"payment_method_selected" => $this->paymentMethodSelected, | ||
"brand_name" => $this->brandName, | ||
"locale" => $this->locale, | ||
"landing_page" => $this->landingPage, | ||
"user_action" => $this->userAction, | ||
"return_url" => $this->returnUrl, | ||
"cancel_url" => $this->cancelUrl, | ||
'payment_method_preference' => $this->paymentMethodPreference, | ||
'payment_method_selected' => $this->paymentMethodSelected, | ||
'brand_name' => $this->brandName, | ||
'locale' => $this->locale, | ||
'landing_page' => $this->landingPage, | ||
'user_action' => $this->userAction, | ||
'return_url' => $this->returnUrl, | ||
'cancel_url' => $this->cancelUrl, | ||
], | ||
] | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License version 3.0 | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/AFL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 | ||
*/ | ||
|
||
namespace PrestaShop\Module\PrestashopCheckout\PayPal\Order\ValueObject; | ||
|
||
class PayPalOrderPurchaseUnit | ||
|
@@ -100,10 +119,8 @@ public function toArray() | |
'custom_id' => $this->customId, | ||
'amount' => [ | ||
'currency' => $this->currency, | ||
'value' => $this->value | ||
] | ||
'value' => $this->value, | ||
], | ||
]; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters