Skip to content

Commit 64b5750

Browse files
committed
MC-32657: Deliver PR
- fix static tests
1 parent fd8247c commit 64b5750

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

app/code/Magento/Paypal/Test/Unit/Model/Express/LocaleResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class LocaleResolverTest extends \PHPUnit\Framework\TestCase
1919
{
2020
/**
21-
* @var \PHPUnit_Framework_MockObject_MockObject|ResolverInterface
21+
* @var \PHPUnit\Framework\MockObject\MockObject|ResolverInterface
2222
*/
2323
private $resolver;
2424

app/code/Magento/Paypal/view/frontend/templates/express/shortcut_button.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
// phpcs:disable Magento2.Templates.ThisInTemplate
78
/**
89
* @var \Magento\Paypal\Block\Express\InContext\SmartButton $block
910
*/
@@ -12,4 +13,5 @@ $widgetConfig = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonE
1213
$widget['Magento_Paypal/js/in-context/product-express-checkout']
1314
);
1415
?>
15-
<div data-mage-init='{"Magento_Paypal/js/in-context/product-express-checkout":<?= /* @noEscape */ $widgetConfig ?>}'></div>
16+
<div id ="paypal-smart-button" data-mage-init='{"Magento_Paypal/js/in-context/product-express-checkout"
17+
:<?= /* @noEscape */ $widgetConfig ?>}'></div>

app/code/Magento/Paypal/view/frontend/web/js/in-context/express-checkout-smart-buttons.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ define([
4343
* @param {Object} actions
4444
* @returns {Object} jQuery promise
4545
*/
46-
function performOnApprove(clientConfig, data, actions)
47-
{
46+
function performOnApprove(clientConfig, data, actions) {
4847
var params = {
4948
paymentToken: data.orderID,
5049
payerId: data.payerID,
@@ -79,22 +78,49 @@ define([
7978
onInit: function (data, actions) {
8079
clientConfig.rendererComponent.validate(actions);
8180
},
81+
82+
/**
83+
* Triggers beforePayment action on PayPal buttons
84+
* @returns {Object} jQuery promise
85+
*/
8286
createOrder: function () {
8387
return performCreateOrder(clientConfig);
8488
},
89+
90+
/**
91+
* Triggers beforeOnAuthorize action on PayPal buttons
92+
* @param {Object} data
93+
* @param {Object} actions
94+
*/
8595
onApprove: function (data, actions) {
8696
performOnApprove(clientConfig, data, actions);
8797
},
98+
99+
/**
100+
* Execute logic on Paypal button click
101+
*/
88102
onClick: function () {
89103
clientConfig.rendererComponent.validate();
90104
clientConfig.rendererComponent.onClick();
91105
},
106+
107+
/**
108+
* Process cancel action
109+
* @param {Object} data
110+
* @param {Object} actions
111+
*/
92112
onCancel: function (data, actions) {
93113
clientConfig.rendererComponent.onCancel(data, actions);
94114
},
115+
116+
/**
117+
* Process errors
118+
*
119+
* @param {Error} err
120+
*/
95121
onError: function (err) {
96122
clientConfig.rendererComponent.onError(err);
97-
},
123+
}
98124
}).render(element);
99125
});
100126
};

app/code/Magento/Paypal/view/frontend/web/js/in-context/express-checkout-wrapper.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ define([
107107
*/
108108
afterOnAuthorize: function (res, resolve, reject, actions) {
109109
$('body').trigger('processStop');
110+
110111
if (res.success) {
111112
resolve();
113+
112114
return actions.redirect(res.redirectUrl);
113115
}
114116

app/code/Magento/Paypal/view/frontend/web/js/in-context/paypal-sdk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ define([
2626
}
2727
});
2828

29-
if (dfd.state() !== "resolved") {
29+
if (dfd.state() !== 'resolved') {
3030
require(['paypalSdk'], function (paypalObject) {
3131
dfd.resolve(paypalObject);
3232
});

0 commit comments

Comments
 (0)