diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php
index f66db9fb49d1f..f5dd670b2ede4 100644
--- a/app/code/Magento/Payment/Model/Method/Cc.php
+++ b/app/code/Magento/Payment/Model/Method/Cc.php
@@ -127,28 +127,25 @@ public function validate()
//Solo, Switch or Maestro. International safe
'SO' => '/(^(6334)[5-9](\d{11}$|\d{13,14}$))|(^(6767)(\d{12}$|\d{14,15}$))/',
'SM' => '/(^(5[0678])\d{11,18}$)|(^(6[^05])\d{11,18}$)|(^(601)[^1]\d{9,16}$)|(^(6011)\d{9,11}$)' .
- '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)' .
- '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))' .
- '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))' .
- '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
+ '|(^(6011)\d{13,16}$)|(^(65)\d{11,13}$)|(^(65)\d{15,18}$)' .
+ '|(^(49030)[2-9](\d{10}$|\d{12,13}$))|(^(49033)[5-9](\d{10}$|\d{12,13}$))' .
+ '|(^(49110)[1-2](\d{10}$|\d{12,13}$))|(^(49117)[4-9](\d{10}$|\d{12,13}$))' .
+ '|(^(49118)[0-2](\d{10}$|\d{12,13}$))|(^(4936)(\d{12}$|\d{14,15}$))/',
// Visa
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
// Master Card
- 'MC' => '/^5[1-5][0-9]{14}$/',
+ 'MC' => '/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/',
// American Express
'AE' => '/^3[47][0-9]{13}$/',
// Discover
- 'DI' => '/^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})' .
- '|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}' .
- '|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}' .
- '|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}' .
- '|5[0-9]{14}))$/',
+ 'DI' => '/^(6011((0|9|[2-4])[0-9]{11,14}|(74|7[7-9]|8[6-9])[0-9]{10,13})|6(4[4-9][0-9]{13,16}|' .
+ '5[0-9]{14,17}))/',
+ 'DN' => '/^3(0[0-5][0-9]{13,16}|095[0-9]{12,15}|(6|[8-9])[0-9]{14,17})/',
+ // UnionPay
+ 'UN' => '/^622(1(2[6-9][0-9]{10,13}|[3-9][0-9]{11,14})|[3-8][0-9]{12,15}|9([[0-1][0-9]{11,14}|' .
+ '2[0-5][0-9]{10,13}))|62[4-6][0-9]{13,16}|628[2-8][0-9]{12,15}/',
// JCB
- 'JCB' => '/^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}' .
- '|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}' .
- '|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}' .
- '|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}' .
- '|5[0-9]{14}))$/',
+ 'JCB' => '/^35(2[8-9][0-9]{12,15}|[3-8][0-9]{13,16})/',
'MI' => '/^(5(0|[6-9])|63|67(?!59|6770|6774))\d*$/',
'MD' => '/^(6759(?!24|38|40|6[3-9]|70|76)|676770|676774)\d*$/',
];
@@ -215,6 +212,8 @@ public function getVerificationRegEx()
'MC' => '/^[0-9]{3}$/',
'AE' => '/^[0-9]{4}$/',
'DI' => '/^[0-9]{3}$/',
+ 'DN' => '/^[0-9]{3}$/',
+ 'UN' => '/^[0-9]{3}$/',
'SS' => '/^[0-9]{3,4}$/',
'SM' => '/^[0-9]{3,4}$/',
'SO' => '/^[0-9]{3,4}$/',
diff --git a/app/code/Magento/Paypal/etc/adminhtml/system.xml b/app/code/Magento/Paypal/etc/adminhtml/system.xml
index 68fe46bc258b7..c4fe3def36c25 100644
--- a/app/code/Magento/Paypal/etc/adminhtml/system.xml
+++ b/app/code/Magento/Paypal/etc/adminhtml/system.xml
@@ -28,12 +28,12 @@
paypal-top-section paypal-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset
paypal-top-section payments-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset
diff --git a/app/code/Magento/Paypal/view/adminhtml/web/styles.css b/app/code/Magento/Paypal/view/adminhtml/web/styles.css
index 511623e1f596c..9e7cfb2afc18e 100644
--- a/app/code/Magento/Paypal/view/adminhtml/web/styles.css
+++ b/app/code/Magento/Paypal/view/adminhtml/web/styles.css
@@ -16,7 +16,7 @@
.payflow-settings-notice ul.options-list {list-style:disc;padding:0 2em;}
.paypal-express-section .heading {display: inline-block; background: url("images/pp-logo-200px.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
.paypal-express-section .button-container {display: inline-block; float: right;}
-.paypal-express-section .config-alt {background: url("images/pp-alt.png") no-repeat; height: 26px; margin: 0.5rem 0 0; width: 158px;}
+.paypal-express-section .config-alt {background: url("images/pp-alt.png") no-repeat; height: 26px; margin: .5rem 0 0; width: 158px;}
.paypal-express-section .link-more {margin-left: 5px;}
.paypal-other-section .heading {display: inline-block;}
.paypal-other-section .button-container {display: inline-block; float: right; margin: 1rem 0 0 !important;}
@@ -27,7 +27,9 @@
.paypal-top-section.active > .entry-edit-head.admin__collapsible-block {border-bottom: 1px solid #ccc;}
.paypal-top-section > .admin__collapsible-block > a {font-size: 1.4rem; font-weight: normal; text-transform: uppercase;}
.paypal-recommended-header > .admin__collapsible-block > a::before {content: "" !important;}
-.paypal-other-header > .admin__collapsible-block > a.open::before {content: "\25B2" !important;}
-.paypal-other-header > .admin__collapsible-block > a::before {color: #000; content: "\25BC" !important; font-size: 1rem; top: 2.2rem;}
+.paypal-other-header > .admin__collapsible-block > a::before {content: '' !important; width: 0; height: 0; border-color: transparent; border-top-color: #000; border-style: solid; border-width: .8rem .5rem 0 .5rem; margin-top:1px; transition: all .2s linear;}
+.paypal-other-header > .admin__collapsible-block > a.open::before {border-color: transparent; border-bottom-color: #000; border-width: 0 .5rem .8rem .5rem;}
.paypal-other-header > .admin__collapsible-block > a {color: #007bdb !important; text-align: right;}
-.payments-other-header > .admin__collapsible-block > a::before {content: "" !important;}
\ No newline at end of file
+.payments-other-header > .admin__collapsible-block > a {display: inline-block;}
+.payments-other-header > .admin__collapsible-block > a::before {content: '' !important; width: 0; height: 0; border-color: transparent; border-top-color: #000; border-style: solid; border-width: .8rem .5rem 0 .5rem; margin-top:1px; transition: all .2s linear;}
+.payments-other-header > .admin__collapsible-block > a.open::before {border-color: transparent; border-bottom-color: #000; border-width: 0 .5rem .8rem .5rem;}
\ No newline at end of file
diff --git a/app/code/Magento/Shipping/i18n/en_US.csv b/app/code/Magento/Shipping/i18n/en_US.csv
index 54d7c83e94c77..b1eaa148177e8 100644
--- a/app/code/Magento/Shipping/i18n/en_US.csv
+++ b/app/code/Magento/Shipping/i18n/en_US.csv
@@ -179,3 +179,4 @@ City,City
"Apply custom Shipping Policy","Apply custom Shipping Policy"
"Shipping Policy","Shipping Policy"
"Shipping Methods","Shipping Methods"
+"Track your order","Track your order"
diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml
index 15f2b45595e9f..caa7a9e5b7592 100644
--- a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml
+++ b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml
@@ -10,7 +10,7 @@
- Track your order
+ Track your order
diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml
index 15f2b45595e9f..caa7a9e5b7592 100644
--- a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml
+++ b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml
@@ -10,7 +10,7 @@
- Track your order
+ Track your order
diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml
index 15f2b45595e9f..caa7a9e5b7592 100644
--- a/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml
+++ b/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml
@@ -10,7 +10,7 @@
- Track your order
+ Track your order
diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml
index 15f2b45595e9f..caa7a9e5b7592 100644
--- a/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml
+++ b/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml
@@ -10,7 +10,7 @@
- Track your order
+ Track your order
diff --git a/app/code/Magento/Theme/view/frontend/web/js/view/messages.js b/app/code/Magento/Theme/view/frontend/web/js/view/messages.js
index 2969fdedd7d41..48507343fe28d 100644
--- a/app/code/Magento/Theme/view/frontend/web/js/view/messages.js
+++ b/app/code/Magento/Theme/view/frontend/web/js/view/messages.js
@@ -15,11 +15,23 @@ define([
cookieMessages: [],
messages: []
},
+
+ /**
+ * Extends Component object by storage observable messages.
+ */
initialize: function () {
this._super();
this.cookieMessages = $.cookieStorage.get('mage-messages');
- this.messages = customerData.get('messages').extend({disposableCustomerData: 'messages'});
+ this.messages = customerData.get('messages').extend({
+ disposableCustomerData: 'messages'
+ });
+
+ // Force to clean obsolete messages
+ if (!_.isEmpty(this.messages().messages)) {
+ customerData.set('messages', {});
+ }
+
$.cookieStorage.setConf({path: '/', expires: -1}).set('mage-messages', null);
}
});
diff --git a/app/code/Magento/Vault/Model/Method/Vault.php b/app/code/Magento/Vault/Model/Method/Vault.php
index aa0bead2327ea..0e6689461e14b 100644
--- a/app/code/Magento/Vault/Model/Method/Vault.php
+++ b/app/code/Magento/Vault/Model/Method/Vault.php
@@ -31,6 +31,9 @@
*/
final class Vault implements VaultPaymentInterface
{
+ /**
+ * @deprecated
+ */
const TOKEN_METADATA_KEY = 'token_metadata';
/**
@@ -111,6 +114,8 @@ final class Vault implements VaultPaymentInterface
* @param PaymentTokenManagementInterface $tokenManagement
* @param OrderPaymentExtensionInterfaceFactory $paymentExtensionFactory
* @param string $code
+ *
+ * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
ConfigInterface $config,
@@ -452,17 +457,14 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
private function attachTokenExtensionAttribute(OrderPaymentInterface $orderPayment)
{
$additionalInformation = $orderPayment->getAdditionalInformation();
-
- $tokenData = isset($additionalInformation[self::TOKEN_METADATA_KEY])
- ? $additionalInformation[self::TOKEN_METADATA_KEY]
- : null;
-
- if ($tokenData === null) {
- throw new \LogicException("Token metadata should be defined");
+ if (empty($additionalInformation[PaymentTokenInterface::CUSTOMER_ID]) ||
+ empty($additionalInformation[PaymentTokenInterface::PUBLIC_HASH])
+ ) {
+ throw new \LogicException('Customer id and public hash should be defined');
}
- $customerId = $tokenData[PaymentTokenInterface::CUSTOMER_ID];
- $publicHash = $tokenData[PaymentTokenInterface::PUBLIC_HASH];
+ $customerId = $additionalInformation[PaymentTokenInterface::CUSTOMER_ID];
+ $publicHash = $additionalInformation[PaymentTokenInterface::PUBLIC_HASH];
$paymentToken = $this->tokenManagement->getByPublicHash($publicHash, $customerId);
diff --git a/app/code/Magento/Vault/Observer/PaymentTokenAssigner.php b/app/code/Magento/Vault/Observer/PaymentTokenAssigner.php
index 9d5417726d0fe..7601d49b9fe84 100644
--- a/app/code/Magento/Vault/Observer/PaymentTokenAssigner.php
+++ b/app/code/Magento/Vault/Observer/PaymentTokenAssigner.php
@@ -65,7 +65,6 @@ public function execute(Observer $observer)
}
$paymentModel->setAdditionalInformation(
- Vault::TOKEN_METADATA_KEY,
[
PaymentTokenInterface::CUSTOMER_ID => $customerId,
PaymentTokenInterface::PUBLIC_HASH => $tokenPublicHash
diff --git a/app/code/Magento/Vault/Setup/UpgradeData.php b/app/code/Magento/Vault/Setup/UpgradeData.php
index 84668ce4443f6..3925aaa6c94fb 100644
--- a/app/code/Magento/Vault/Setup/UpgradeData.php
+++ b/app/code/Magento/Vault/Setup/UpgradeData.php
@@ -22,13 +22,41 @@ class UpgradeData implements UpgradeDataInterface
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
+ $connection = $setup->getConnection();
+ // data update for Vault module < 2.0.1
if (version_compare($context->getVersion(), '2.0.1', '<')) {
- $connection = $setup->getConnection();
+ // update sets credit card as default token type
$connection->update($setup->getTable(InstallSchema::PAYMENT_TOKEN_TABLE), [
PaymentTokenInterface::TYPE => CreditCardTokenFactory::TOKEN_TYPE_CREDIT_CARD
], PaymentTokenInterface::TYPE . ' = ""');
}
+
+ // data update for Vault module < 2.0.2
+ if (version_compare($context->getVersion(), '2.0.2', '<')) {
+ // update converts additional info with token metadata to single dimensional array
+ $select = $connection->select()
+ ->from($setup->getTable('sales_order_payment'), 'entity_id')
+ ->columns(['additional_information'])
+ ->where('additional_information LIKE ?', '%token_metadata%');
+
+ $items = $connection->fetchAll($select);
+ foreach ($items as $item) {
+ $additionalInfo = unserialize($item['additional_information']);
+ $additionalInfo[PaymentTokenInterface::CUSTOMER_ID] =
+ $additionalInfo['token_metadata'][PaymentTokenInterface::CUSTOMER_ID];
+ $additionalInfo[PaymentTokenInterface::PUBLIC_HASH] =
+ $additionalInfo['token_metadata'][PaymentTokenInterface::PUBLIC_HASH];
+ unset($additionalInfo['token_metadata']);
+
+ $connection->update(
+ $setup->getTable('sales_order_payment'),
+ ['additional_information' => serialize($additionalInfo)],
+ ['entity_id = ?' => $item['entity_id']]
+ );
+ }
+ }
+
$setup->endSetup();
}
}
diff --git a/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php b/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php
index 32e783278e130..fc6f3e4d2390b 100644
--- a/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php
+++ b/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php
@@ -50,10 +50,12 @@ public function testAuthorizeNotOrderPayment()
}
/**
+ * @param array $additionalInfo
* @expectedException \LogicException
- * @expectedExceptionMessage Token metadata should be defined
+ * @expectedExceptionMessage Customer id and public hash should be defined
+ * @dataProvider additionalInfoDataProvider
*/
- public function testAuthorizeNoTokenMetadata()
+ public function testAuthorizeNoTokenMetadata(array $additionalInfo)
{
$paymentModel = $this->getMockBuilder(Payment::class)
->disableOriginalConstructor()
@@ -61,13 +63,26 @@ public function testAuthorizeNoTokenMetadata()
$paymentModel->expects(static::once())
->method('getAdditionalInformation')
- ->willReturn([]);
+ ->willReturn($additionalInfo);
/** @var Vault $model */
$model = $this->objectManager->getObject(Vault::class);
$model->authorize($paymentModel, 0);
}
+ /**
+ * Get list of additional information variations
+ * @return array
+ */
+ public function additionalInfoDataProvider()
+ {
+ return [
+ ['additionalInfo' => []],
+ ['additionalInfo' => ['customer_id' => 1]],
+ ['additionalInfo' => ['public_hash' => 'df768aak12uf']],
+ ];
+ }
+
/**
* @expectedException \LogicException
* @expectedExceptionMessage No token found
@@ -86,10 +101,8 @@ public function testAuthorizeNoToken()
->method('getAdditionalInformation')
->willReturn(
[
- Vault::TOKEN_METADATA_KEY => [
- PaymentTokenInterface::CUSTOMER_ID => $customerId,
- PaymentTokenInterface::PUBLIC_HASH => $publicHash
- ]
+ PaymentTokenInterface::CUSTOMER_ID => $customerId,
+ PaymentTokenInterface::PUBLIC_HASH => $publicHash
]
);
$tokenManagement->expects(static::once())
@@ -133,10 +146,8 @@ public function testAuthorize()
->method('getAdditionalInformation')
->willReturn(
[
- Vault::TOKEN_METADATA_KEY => [
- PaymentTokenInterface::CUSTOMER_ID => $customerId,
- PaymentTokenInterface::PUBLIC_HASH => $publicHash
- ]
+ PaymentTokenInterface::CUSTOMER_ID => $customerId,
+ PaymentTokenInterface::PUBLIC_HASH => $publicHash
]
);
$tokenManagement->expects(static::once())
diff --git a/app/code/Magento/Vault/Test/Unit/Observer/PaymentTokenAssignerTest.php b/app/code/Magento/Vault/Test/Unit/Observer/PaymentTokenAssignerTest.php
index 6856cde3ebd2b..d973e1cce5782 100644
--- a/app/code/Magento/Vault/Test/Unit/Observer/PaymentTokenAssignerTest.php
+++ b/app/code/Magento/Vault/Test/Unit/Observer/PaymentTokenAssignerTest.php
@@ -161,7 +161,6 @@ public function testExecuteSaveMetadata()
$paymentModel->expects(static::once())
->method('setAdditionalInformation')
->with(
- Vault::TOKEN_METADATA_KEY,
[
PaymentTokenInterface::CUSTOMER_ID => $customerId,
PaymentTokenInterface::PUBLIC_HASH => $publicHash
diff --git a/app/code/Magento/Vault/etc/module.xml b/app/code/Magento/Vault/etc/module.xml
index 740d93b4e133d..7ab8db1d86fce 100644
--- a/app/code/Magento/Vault/etc/module.xml
+++ b/app/code/Magento/Vault/etc/module.xml
@@ -6,7 +6,7 @@
*/
-->
-
+
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml
index 6a607e45b68fa..6d77816d26292 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/actual/config.xml
@@ -28,12 +28,12 @@
paypal-top-section paypal-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset
paypal-top-section payments-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml
index 9dc77b836656a..40bf9602edb12 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml
@@ -28,12 +28,12 @@
paypal-top-section paypal-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset
paypal-top-section payments-other-header
- Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Expanded
+ \Magento\Config\Block\System\Config\Form\Fieldset