-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#11680: Merge branch '2.3-develop' of github.com:magento/magento2 int…
…o 8022
- Loading branch information
Showing
322 changed files
with
14,171 additions
and
1,443 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
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
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,4 +1,4 @@ | ||
memory_limit = 768M | ||
memory_limit = 756M | ||
max_execution_time = 18000 | ||
session.auto_start = off | ||
suhosin.session.cryptua = off |
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
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
42 changes: 42 additions & 0 deletions
42
app/code/Magento/Braintree/Model/InstantPurchase/CreditCard/AvailabilityChecker.php
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Braintree\Model\InstantPurchase\CreditCard; | ||
|
||
use Magento\Braintree\Gateway\Config\Config; | ||
use Magento\InstantPurchase\PaymentMethodIntegration\AvailabilityCheckerInterface; | ||
|
||
/** | ||
* Availability of Braintree vaults for instant purchase. | ||
*/ | ||
class AvailabilityChecker implements AvailabilityCheckerInterface | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* AvailabilityChecker constructor. | ||
* @param Config $config | ||
*/ | ||
public function __construct(Config $config) | ||
{ | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function isAvailable(): bool | ||
{ | ||
if ($this->config->isVerify3DSecure()) { | ||
// Support of 3D secure not implemented for instant purchase yet. | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
app/code/Magento/Braintree/Model/InstantPurchase/CreditCard/TokenFormatter.php
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Braintree\Model\InstantPurchase\CreditCard; | ||
|
||
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface; | ||
use Magento\Vault\Api\Data\PaymentTokenInterface; | ||
|
||
/** | ||
* Braintree stored credit card formatter. | ||
*/ | ||
class TokenFormatter implements PaymentTokenFormatterInterface | ||
{ | ||
/** | ||
* Most used credit card types | ||
* @var array | ||
*/ | ||
public static $baseCardTypes = [ | ||
'AE' => 'American Express', | ||
'VI' => 'Visa', | ||
'MC' => 'MasterCard', | ||
'DI' => 'Discover', | ||
'JBC' => 'JBC', | ||
'CUP' => 'China Union Pay', | ||
'MI' => 'Maestro', | ||
]; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string | ||
{ | ||
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true); | ||
if (!isset($details['type'], $details['maskedCC'], $details['expirationDate'])) { | ||
throw new \InvalidArgumentException('Invalid Braintree credit card token details.'); | ||
} | ||
|
||
if (isset(self::$baseCardTypes[$details['type']])) { | ||
$ccType = self::$baseCardTypes[$details['type']]; | ||
} else { | ||
$ccType = $details['type']; | ||
} | ||
|
||
$formatted = sprintf( | ||
'%s: %s, %s: %s (%s: %s)', | ||
__('Credit Card'), | ||
$ccType, | ||
__('ending'), | ||
$details['maskedCC'], | ||
__('expires'), | ||
$details['expirationDate'] | ||
); | ||
|
||
return $formatted; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
app/code/Magento/Braintree/Model/InstantPurchase/PayPal/TokenFormatter.php
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Braintree\Model\InstantPurchase\PayPal; | ||
|
||
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface; | ||
use Magento\Vault\Api\Data\PaymentTokenInterface; | ||
|
||
/** | ||
* Braintree PayPal token formatter. | ||
*/ | ||
class TokenFormatter implements PaymentTokenFormatterInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string | ||
{ | ||
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true); | ||
if (!isset($details['payerEmail'])) { | ||
throw new \InvalidArgumentException('Invalid Braintree PayPal token details.'); | ||
} | ||
|
||
$formatted = sprintf( | ||
'%s: %s', | ||
__('PayPal'), | ||
$details['payerEmail'] | ||
); | ||
|
||
return $formatted; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/code/Magento/Braintree/Model/InstantPurchase/PaymentAdditionalInformationProvider.php
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Braintree\Model\InstantPurchase; | ||
|
||
use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand; | ||
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentAdditionalInformationProviderInterface; | ||
use Magento\Vault\Api\Data\PaymentTokenInterface; | ||
|
||
/** | ||
* Provides Braintree specific payment additional information for instant purchase. | ||
*/ | ||
class PaymentAdditionalInformationProvider implements PaymentAdditionalInformationProviderInterface | ||
{ | ||
/** | ||
* @var GetPaymentNonceCommand | ||
*/ | ||
private $getPaymentNonceCommand; | ||
|
||
/** | ||
* PaymentAdditionalInformationProvider constructor. | ||
* @param GetPaymentNonceCommand $getPaymentNonceCommand | ||
*/ | ||
public function __construct(GetPaymentNonceCommand $getPaymentNonceCommand) | ||
{ | ||
$this->getPaymentNonceCommand = $getPaymentNonceCommand; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAdditionalInformation(PaymentTokenInterface $paymentToken): array | ||
{ | ||
$paymentMethodNonce = $this->getPaymentNonceCommand->execute([ | ||
PaymentTokenInterface::CUSTOMER_ID => $paymentToken->getCustomerId(), | ||
PaymentTokenInterface::PUBLIC_HASH => $paymentToken->getPublicHash(), | ||
])->get()['paymentMethodNonce']; | ||
|
||
return [ | ||
'payment_method_nonce' => $paymentMethodNonce, | ||
]; | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.