diff --git a/app/code/Magento/Braintree/etc/adminhtml/system.xml b/app/code/Magento/Braintree/etc/adminhtml/system.xml index 5f62a9d7cf192..e4f4e11983892 100644 --- a/app/code/Magento/Braintree/etc/adminhtml/system.xml +++ b/app/code/Magento/Braintree/etc/adminhtml/system.xml @@ -33,7 +33,7 @@ - + Magento\Config\Model\Config\Source\Yesno payment/braintree_cc_vault/active @@ -155,7 +155,7 @@ It is recommended to set this value to "PayPal" per store views. - + Magento\Config\Model\Config\Source\Yesno payment/braintree_paypal_vault/active diff --git a/app/code/Magento/Braintree/view/adminhtml/web/styles.css b/app/code/Magento/Braintree/view/adminhtml/web/styles.css index 31f48cd0b28df..81378f636eb61 100644 --- a/app/code/Magento/Braintree/view/adminhtml/web/styles.css +++ b/app/code/Magento/Braintree/view/adminhtml/web/styles.css @@ -3,6 +3,6 @@ * See COPYING.txt for license details. */ -.braintree-section .heading {display: inline-block; background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;} -.braintree-section .button-container {display: inline-block; float: right;} +.braintree-section .heading {background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;} +.braintree-section .button-container {float: right;} .braintree-section .config-alt {background: url("images/braintree_allinone.png") no-repeat scroll 0 0 / 100% auto; height: 28px; margin: 0.5rem 0 0; width: 230px;} \ No newline at end of file diff --git a/app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js b/app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js index c8a6fef58d31e..7d01c195791e4 100644 --- a/app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js +++ b/app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js @@ -154,6 +154,7 @@ define( */ clearTimeout: function () { clearTimeout(this.timeoutId); + this.fail(); return this; }, diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php index 4abe12cbc3715..725ebb2282418 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php @@ -78,18 +78,10 @@ protected function _isPaymentEnabled($element) */ protected function _getHeaderTitleHtml($element) { - $html = '
' . $element->getLegend(); + $html = '
'; $groupConfig = $element->getGroup(); - $html .= ''; - - if ($element->getComment()) { - $html .= '' . $element->getComment() . ''; - } - $html .= '
'; - $html .= '
'; - $disabledAttributeString = $this->_isPaymentEnabled($element) ? '' : ' disabled="disabled"'; $disabledClassString = $this->_isPaymentEnabled($element) ? '' : ' disabled'; $htmlId = $element->getHtmlId(); @@ -122,6 +114,13 @@ protected function _getHeaderTitleHtml($element) ) . ''; } + $html .= '
'; + $html .= '
' . $element->getLegend() . ''; + + if ($element->getComment()) { + $html .= '' . $element->getComment() . ''; + } + $html .= '
'; $html .= '
'; return $html; diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index e02615d24ad3d..0af8b18355ec3 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -866,7 +866,9 @@ public function isOrderReviewStepDisabled() */ public function getExpressCheckoutStartUrl($token) { - return $this->getPaypalUrl(['cmd' => '_express-checkout', 'token' => $token]); + return sprintf('https://www.%spaypal.com/checkoutnow/2%s', + $this->getValue('sandboxFlag') ? 'sandbox.' : '', + '?token=' . urlencode($token)); } /** diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index d377e8ed626e1..db1ecdf6b3379 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -672,19 +672,13 @@ public function assignData(\Magento\Framework\DataObject $data) $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); - if ( - !is_array($additionalData) - || !isset($additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT]) - ) { + if (!is_array($additionalData)) { return $this; } - $this->getInfoInstance() - ->setAdditionalInformation( - ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT, - $additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT] - ); - + foreach ($additionalData as $key => $value) { + $this->getInfoInstance()->setAdditionalInformation($key, $value); + } return $this; } diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index f0383dffc9b24..b5803c5ace392 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -166,6 +166,9 @@ public function authorize(InfoInterface $payment, $amount) $request->setData('trxtype', self::TRXTYPE_AUTH_ONLY); $request->setData('origid', $token); $request->setData('amt', $this->formatPrice($amount)); + $request->setData('currency', $order->getBaseCurrencyCode()); + $request->setData('taxamt', $this->formatPrice($order->getBaseTaxAmount())); + $request->setData('freightamt', $this->formatPrice($order->getBaseShippingAmount())); $response = $this->postRequest($request, $this->getConfig()); $this->processErrors($response); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php index 33065cc22713b..9816c37fa0126 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php @@ -182,7 +182,9 @@ public function testAssignData() $data = new DataObject( [ PaymentInterface::KEY_ADDITIONAL_DATA => [ - Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue + Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue, + Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue, + Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue ] ] ); @@ -202,11 +204,12 @@ public function testAssignData() $this->parentAssignDataExpectation($data); - $paymentInfo->expects(static::once()) + $paymentInfo->expects(static::exactly(3)) ->method('setAdditionalInformation') - ->with( - Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT, - $transportValue + ->withConsecutive( + [Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT, $transportValue], + [Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, $transportValue], + [Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN, $transportValue] ); $this->_model->assignData($data); diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php index a107918d16513..2d757147cec6a 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php @@ -122,7 +122,7 @@ protected function initializationAuthorizeMock() $this->orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) ->setMethods([ 'getCustomerId', 'getBillingAddress', 'getShippingAddress', 'getCustomerEmail', - 'getId', 'getIncrementId' + 'getId', 'getIncrementId', 'getBaseCurrencyCode' ]) ->disableOriginalConstructor() ->getMock(); @@ -164,6 +164,9 @@ protected function buildRequestData() $this->paymentMock->expects($this->once()) ->method('getOrder') ->willReturn($this->orderMock); + $this->orderMock->expects($this->once()) + ->method('getBaseCurrencyCode') + ->willReturn('USD'); $this->orderMock->expects($this->once()) ->method('getBillingAddress') ->willReturn($this->addressBillingMock); diff --git a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml index b567ac87c4fe2..98f340f0a2711 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml @@ -84,7 +84,7 @@
- + Magento\Config\Model\Config\Source\Yesno payment/payflowpro_cc_vault/active 1 diff --git a/app/code/Magento/Paypal/view/adminhtml/web/styles.css b/app/code/Magento/Paypal/view/adminhtml/web/styles.css index 9e7cfb2afc18e..9119a2e317fb7 100644 --- a/app/code/Magento/Paypal/view/adminhtml/web/styles.css +++ b/app/code/Magento/Paypal/view/adminhtml/web/styles.css @@ -14,12 +14,11 @@ .payflow-settings-notice { border:1px solid #d1d0ce;padding:0 10px;margin: 0;} .payflow-settings-notice .important-label {color:#f00;} .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: .5rem 0 0; width: 158px;} +.paypal-express-section .heading {background: url("images/pp-logo-200px.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;} +.paypal-express-section .button-container {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 .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;} +.paypal-other-section .button-container {float: right; margin: 1rem 0 0 !important;} .paypal-other-section > .entry-edit-head > a::before {left: auto !important; right: 1.3rem !important;} .paypal-all-in-one-section > .entry-edit-head {background: url("images/AM_mc_vs_dc_ae.jpg") no-repeat scroll 0 50% / 18rem auto; padding-left: 18rem;} .paypal-gateways-section > .entry-edit-head {background: url("images/pp-payflow-mark.png") no-repeat scroll 0 50% / 18rem auto; padding-left: 18rem;} diff --git a/app/code/Magento/Vault/Model/Method/Vault.php b/app/code/Magento/Vault/Model/Method/Vault.php index 0e6689461e14b..ce85936607192 100644 --- a/app/code/Magento/Vault/Model/Method/Vault.php +++ b/app/code/Magento/Vault/Model/Method/Vault.php @@ -579,7 +579,7 @@ public function assignData(\Magento\Framework\DataObject $data) public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { return $this->getVaultProvider()->isAvailable($quote) - && $this->config->getValue(self::$activeKey, $this->getStore() ?: $quote->getStoreId()); + && $this->config->getValue(self::$activeKey, $this->getStore() ?: ($quote ? $quote->getStoreId() : null)); } /** 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 fc6f3e4d2390b..e5c8391102524 100644 --- a/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php +++ b/app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php @@ -274,4 +274,32 @@ public function isAvailableDataProvider() ['isAvailableProvider' => true, 'isActiveVault' => true, 'expected' => true], ]; } + + /** + * @covers \Magento\Vault\Model\Method\Vault::isAvailable + */ + public function testIsAvailableWithoutQuote() + { + $quote = null; + + $vaultProvider = $this->getMockForAbstractClass(MethodInterface::class); + $config = $this->getMockForAbstractClass(ConfigInterface::class); + + $vaultProvider->expects(static::once()) + ->method('isAvailable') + ->with($quote) + ->willReturn(true); + + $config->expects(static::once()) + ->method('getValue') + ->with('active', $quote) + ->willReturn(false); + + /** @var Vault $model */ + $model = $this->objectManager->getObject(Vault::class, [ + 'config' => $config, + 'vaultProvider' => $vaultProvider + ]); + static::assertFalse($model->isAvailable($quote)); + } } diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/System/Config/Braintree.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/System/Config/Braintree.php index f46f070216c6e..c85c857cbeb54 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/System/Config/Braintree.php +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/System/Config/Braintree.php @@ -33,7 +33,7 @@ class Braintree extends Block private $enablers = [ 'Enable this Solution' => "#payment_us_braintree_section_braintree_active", 'Enable PayPal through Braintree' => '#payment_us_braintree_section_braintree_active_braintree_paypal', - 'Vault enabled' => '#payment_us_braintree_section_braintree_braintree_cc_vault_active' + 'Vault Enabled' => '#payment_us_braintree_section_braintree_braintree_cc_vault_active' ]; /** diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PayflowPro.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PayflowPro.php index f05092745c760..e3b01aa3af9a0 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PayflowPro.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PayflowPro.php @@ -42,7 +42,7 @@ class PayflowPro extends Block '_payflow_required_enable_paypal_payflow', 'Enable PayPal Credit' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal' . '_payflow_required_enable_express_checkout_bml_payflow', - 'Vault enabled' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_' . + 'Vault Enabled' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_' . 'payflow_required_payflowpro_cc_vault_active' ]; diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PaymentsPro.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PaymentsPro.php index 709dc4b54b53f..cd146aa8f809c 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PaymentsPro.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PaymentsPro.php @@ -42,7 +42,7 @@ class PaymentsPro extends Block '_payflow', 'Enable PayPal Credit' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_enable_' . 'express_checkout_bml_payflow', - 'Vault enabled' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_payflowpro_cc_vault' . + 'Vault Enabled' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_payflowpro_cc_vault' . '_active' ]; diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPayflowProConfigStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPayflowProConfigStep.php index a468fbde2f4d2..7e0c9d934161e 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPayflowProConfigStep.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPayflowProConfigStep.php @@ -130,7 +130,7 @@ private function enablePayflowPro() $this->payflowProConfigBlock->enablePayflowPro(); $this->assertFieldsAreActive->processAssert( $this->systemConfigEditSectionPayment, - [$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault enabled']] + [$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault Enabled']] ); $this->assertFieldsAreEnabled->processAssert( $this->systemConfigEditSectionPayment, diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPaymentsProConfigStep.php b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPaymentsProConfigStep.php index 2555eab030720..4c3318d14f961 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPaymentsProConfigStep.php +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPaymentsProConfigStep.php @@ -130,7 +130,7 @@ private function enablePaymentsPro() $this->paymentsProConfigBlock->enablePaymentsPro(); $this->assertFieldsAreActive->processAssert( $this->systemConfigEditSectionPayment, - [$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault enabled']] + [$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault Enabled']] ); $this->assertFieldsAreEnabled->processAssert( $this->systemConfigEditSectionPayment, 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 40bf9602edb12..f9f8f1ffba91a 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 @@ -115,7 +115,7 @@ - + Magento\Config\Model\Config\Source\Yesno payment/payflowpro_cc_vault/active 1