Skip to content

Commit 152dbdc

Browse files
author
Oleksii Korshenko
authored
Merge pull request #386 from magento-mpi/MAGETWO-58282
Fixed issues: - MAGETWO-56347 [Github] #5788 REST API PayPal does not call setExpressCheckout method - MAGETWO-57744 Configure button for Paypal solutions is shifted after changing window width - MAGETWO-57855 Outdated PayPal URL - MAGETWO-58162 PayPal Payflow Pro always using USD (even if this currency is absent on your store) - MAGETWO-58255 Unable to view signed up billing agreement on storefront - MAGETWO-58282 [PR] Bugfixes delivery for 2.2 - MAGETWO-56934 Checkout page freezes when ordering with Authorize.net with invalid credit card - MAGETWO-57893 Orders processed via Paypal Payflow Pro not receiving shipping/tax charges
2 parents 1ade3b7 + 656a3c5 commit 152dbdc

File tree

19 files changed

+75
-43
lines changed

19 files changed

+75
-43
lines changed

app/code/Magento/Braintree/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</requires>
3434
</field>
3535
<field id="braintree_cc_vault_active" translate="label" type="select" sortOrder="12" showInDefault="1" showInWebsite="1" showInStore="0">
36-
<label>Vault enabled</label>
36+
<label>Vault Enabled</label>
3737
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3838
<config_path>payment/braintree_cc_vault/active</config_path>
3939
<requires>
@@ -155,7 +155,7 @@
155155
<comment>It is recommended to set this value to "PayPal" per store views.</comment>
156156
</field>
157157
<field id="braintree_paypal_vault_active" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="0">
158-
<label>Vault enabled</label>
158+
<label>Vault Enabled</label>
159159
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
160160
<config_path>payment/braintree_paypal_vault/active</config_path>
161161
<requires>

app/code/Magento/Braintree/view/adminhtml/web/styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
.braintree-section .heading {display: inline-block; background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
7-
.braintree-section .button-container {display: inline-block; float: right;}
6+
.braintree-section .heading {background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
7+
.braintree-section .button-container {float: right;}
88
.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;}

app/code/Magento/Payment/view/frontend/web/js/view/payment/iframe.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ define(
154154
*/
155155
clearTimeout: function () {
156156
clearTimeout(this.timeoutId);
157+
this.fail();
157158

158159
return this;
159160
},

app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,10 @@ protected function _isPaymentEnabled($element)
7878
*/
7979
protected function _getHeaderTitleHtml($element)
8080
{
81-
$html = '<div class="config-heading" ><div class="heading"><strong>' . $element->getLegend();
81+
$html = '<div class="config-heading" >';
8282

8383
$groupConfig = $element->getGroup();
8484

85-
$html .= '</strong>';
86-
87-
if ($element->getComment()) {
88-
$html .= '<span class="heading-intro">' . $element->getComment() . '</span>';
89-
}
90-
$html .= '<div class="config-alt"></div>';
91-
$html .= '</div>';
92-
9385
$disabledAttributeString = $this->_isPaymentEnabled($element) ? '' : ' disabled="disabled"';
9486
$disabledClassString = $this->_isPaymentEnabled($element) ? '' : ' disabled';
9587
$htmlId = $element->getHtmlId();
@@ -122,6 +114,13 @@ protected function _getHeaderTitleHtml($element)
122114
) . '</a>';
123115
}
124116

117+
$html .= '</div>';
118+
$html .= '<div class="heading"><strong>' . $element->getLegend() . '</strong>';
119+
120+
if ($element->getComment()) {
121+
$html .= '<span class="heading-intro">' . $element->getComment() . '</span>';
122+
}
123+
$html .= '<div class="config-alt"></div>';
125124
$html .= '</div></div>';
126125

127126
return $html;

app/code/Magento/Paypal/Model/Config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,9 @@ public function isOrderReviewStepDisabled()
866866
*/
867867
public function getExpressCheckoutStartUrl($token)
868868
{
869-
return $this->getPaypalUrl(['cmd' => '_express-checkout', 'token' => $token]);
869+
return sprintf('https://www.%spaypal.com/checkoutnow/2%s',
870+
$this->getValue('sandboxFlag') ? 'sandbox.' : '',
871+
'?token=' . urlencode($token));
870872
}
871873

872874
/**

app/code/Magento/Paypal/Model/Express.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,19 +672,13 @@ public function assignData(\Magento\Framework\DataObject $data)
672672

673673
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
674674

675-
if (
676-
!is_array($additionalData)
677-
|| !isset($additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT])
678-
) {
675+
if (!is_array($additionalData)) {
679676
return $this;
680677
}
681678

682-
$this->getInfoInstance()
683-
->setAdditionalInformation(
684-
ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT,
685-
$additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT]
686-
);
687-
679+
foreach ($additionalData as $key => $value) {
680+
$this->getInfoInstance()->setAdditionalInformation($key, $value);
681+
}
688682
return $this;
689683
}
690684

app/code/Magento/Paypal/Model/Payflow/Transparent.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ public function authorize(InfoInterface $payment, $amount)
166166
$request->setData('trxtype', self::TRXTYPE_AUTH_ONLY);
167167
$request->setData('origid', $token);
168168
$request->setData('amt', $this->formatPrice($amount));
169+
$request->setData('currency', $order->getBaseCurrencyCode());
170+
$request->setData('taxamt', $this->formatPrice($order->getBaseTaxAmount()));
171+
$request->setData('freightamt', $this->formatPrice($order->getBaseShippingAmount()));
169172

170173
$response = $this->postRequest($request, $this->getConfig());
171174
$this->processErrors($response);

app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ public function testAssignData()
182182
$data = new DataObject(
183183
[
184184
PaymentInterface::KEY_ADDITIONAL_DATA => [
185-
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue
185+
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue,
186+
Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue,
187+
Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue
186188
]
187189
]
188190
);
@@ -202,11 +204,12 @@ public function testAssignData()
202204

203205
$this->parentAssignDataExpectation($data);
204206

205-
$paymentInfo->expects(static::once())
207+
$paymentInfo->expects(static::exactly(3))
206208
->method('setAdditionalInformation')
207-
->with(
208-
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT,
209-
$transportValue
209+
->withConsecutive(
210+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT, $transportValue],
211+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, $transportValue],
212+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN, $transportValue]
210213
);
211214

212215
$this->_model->assignData($data);

app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function initializationAuthorizeMock()
122122
$this->orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
123123
->setMethods([
124124
'getCustomerId', 'getBillingAddress', 'getShippingAddress', 'getCustomerEmail',
125-
'getId', 'getIncrementId'
125+
'getId', 'getIncrementId', 'getBaseCurrencyCode'
126126
])
127127
->disableOriginalConstructor()
128128
->getMock();
@@ -164,6 +164,9 @@ protected function buildRequestData()
164164
$this->paymentMock->expects($this->once())
165165
->method('getOrder')
166166
->willReturn($this->orderMock);
167+
$this->orderMock->expects($this->once())
168+
->method('getBaseCurrencyCode')
169+
->willReturn('USD');
167170
$this->orderMock->expects($this->once())
168171
->method('getBillingAddress')
169172
->willReturn($this->addressBillingMock);

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
</requires>
8585
</field>
8686
<field id="payflowpro_cc_vault_active" translate="label" type="select" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="0">
87-
<label>Vault enabled</label>
87+
<label>Vault Enabled</label>
8888
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
8989
<config_path>payment/payflowpro_cc_vault/active</config_path>
9090
<attribute type="shared">1</attribute>

app/code/Magento/Paypal/view/adminhtml/web/styles.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
.payflow-settings-notice { border:1px solid #d1d0ce;padding:0 10px;margin: 0;}
1515
.payflow-settings-notice .important-label {color:#f00;}
1616
.payflow-settings-notice ul.options-list {list-style:disc;padding:0 2em;}
17-
.paypal-express-section .heading {display: inline-block; background: url("images/pp-logo-200px.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
18-
.paypal-express-section .button-container {display: inline-block; float: right;}
19-
.paypal-express-section .config-alt {background: url("images/pp-alt.png") no-repeat; height: 26px; margin: .5rem 0 0; width: 158px;}
17+
.paypal-express-section .heading {background: url("images/pp-logo-200px.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
18+
.paypal-express-section .button-container {float: right;}
19+
.paypal-express-section .config-alt {background: url("images/pp-alt.png") no-repeat; height: 26px; margin: 0.5rem 0 0; width: 158px;}
2020
.paypal-express-section .link-more {margin-left: 5px;}
21-
.paypal-other-section .heading {display: inline-block;}
22-
.paypal-other-section .button-container {display: inline-block; float: right; margin: 1rem 0 0 !important;}
21+
.paypal-other-section .button-container {float: right; margin: 1rem 0 0 !important;}
2322
.paypal-other-section > .entry-edit-head > a::before {left: auto !important; right: 1.3rem !important;}
2423
.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;}
2524
.paypal-gateways-section > .entry-edit-head {background: url("images/pp-payflow-mark.png") no-repeat scroll 0 50% / 18rem auto; padding-left: 18rem;}

app/code/Magento/Vault/Model/Method/Vault.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ public function assignData(\Magento\Framework\DataObject $data)
579579
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
580580
{
581581
return $this->getVaultProvider()->isAvailable($quote)
582-
&& $this->config->getValue(self::$activeKey, $this->getStore() ?: $quote->getStoreId());
582+
&& $this->config->getValue(self::$activeKey, $this->getStore() ?: ($quote ? $quote->getStoreId() : null));
583583
}
584584

585585
/**

app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,32 @@ public function isAvailableDataProvider()
274274
['isAvailableProvider' => true, 'isActiveVault' => true, 'expected' => true],
275275
];
276276
}
277+
278+
/**
279+
* @covers \Magento\Vault\Model\Method\Vault::isAvailable
280+
*/
281+
public function testIsAvailableWithoutQuote()
282+
{
283+
$quote = null;
284+
285+
$vaultProvider = $this->getMockForAbstractClass(MethodInterface::class);
286+
$config = $this->getMockForAbstractClass(ConfigInterface::class);
287+
288+
$vaultProvider->expects(static::once())
289+
->method('isAvailable')
290+
->with($quote)
291+
->willReturn(true);
292+
293+
$config->expects(static::once())
294+
->method('getValue')
295+
->with('active', $quote)
296+
->willReturn(false);
297+
298+
/** @var Vault $model */
299+
$model = $this->objectManager->getObject(Vault::class, [
300+
'config' => $config,
301+
'vaultProvider' => $vaultProvider
302+
]);
303+
static::assertFalse($model->isAvailable($quote));
304+
}
277305
}

dev/tests/functional/tests/app/Magento/Braintree/Test/Block/System/Config/Braintree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Braintree extends Block
3333
private $enablers = [
3434
'Enable this Solution' => "#payment_us_braintree_section_braintree_active",
3535
'Enable PayPal through Braintree' => '#payment_us_braintree_section_braintree_active_braintree_paypal',
36-
'Vault enabled' => '#payment_us_braintree_section_braintree_braintree_cc_vault_active'
36+
'Vault Enabled' => '#payment_us_braintree_section_braintree_braintree_cc_vault_active'
3737
];
3838

3939
/**

dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PayflowPro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PayflowPro extends Block
4242
'_payflow_required_enable_paypal_payflow',
4343
'Enable PayPal Credit' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal' .
4444
'_payflow_required_enable_express_checkout_bml_payflow',
45-
'Vault enabled' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_' .
45+
'Vault Enabled' => '#payment_us_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_' .
4646
'payflow_required_payflowpro_cc_vault_active'
4747
];
4848

dev/tests/functional/tests/app/Magento/Paypal/Test/Block/System/Config/PaymentsPro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PaymentsPro extends Block
4242
'_payflow',
4343
'Enable PayPal Credit' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_enable_' .
4444
'express_checkout_bml_payflow',
45-
'Vault enabled' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_payflowpro_cc_vault' .
45+
'Vault Enabled' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_payflowpro_cc_vault' .
4646
'_active'
4747
];
4848

dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPayflowProConfigStep.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private function enablePayflowPro()
130130
$this->payflowProConfigBlock->enablePayflowPro();
131131
$this->assertFieldsAreActive->processAssert(
132132
$this->systemConfigEditSectionPayment,
133-
[$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault enabled']]
133+
[$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault Enabled']]
134134
);
135135
$this->assertFieldsAreEnabled->processAssert(
136136
$this->systemConfigEditSectionPayment,

dev/tests/functional/tests/app/Magento/Paypal/Test/TestStep/CheckPaymentsProConfigStep.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private function enablePaymentsPro()
130130
$this->paymentsProConfigBlock->enablePaymentsPro();
131131
$this->assertFieldsAreActive->processAssert(
132132
$this->systemConfigEditSectionPayment,
133-
[$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault enabled']]
133+
[$enablers['Enable this Solution'], $enablers['Enable PayPal Credit'], $enablers['Vault Enabled']]
134134
);
135135
$this->assertFieldsAreEnabled->processAssert(
136136
$this->systemConfigEditSectionPayment,

dev/tests/integration/testsuite/Magento/Paypal/Model/Config/Structure/Reader/_files/expected/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
</requires>
116116
</field>
117117
<field id="payflowpro_cc_vault_active" translate="label" type="select" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="0">
118-
<label>Vault enabled</label>
118+
<label>Vault Enabled</label>
119119
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
120120
<config_path>payment/payflowpro_cc_vault/active</config_path>
121121
<attribute type="shared">1</attribute>

0 commit comments

Comments
 (0)