1 | define( |
||
2 | [ |
||
3 | 'jquery', |
||
4 | 'Magento_Checkout/js/view/payment/default', |
||
5 | 'mage/url', |
||
6 | 'Magento_Customer/js/customer-data', |
||
7 | 'Magento_Checkout/js/model/error-processor', |
||
8 | 'Magento_Checkout/js/model/full-screen-loader', |
||
9 | 'Magento_Checkout/js/model/quote', |
||
10 | '//cdn.pagantis.com/js/pg-v2/sdk.js', |
||
11 | 'Magento_Checkout/js/action/select-payment-method', |
||
12 | 'Magento_Checkout/js/checkout-data', |
||
13 | 'Magento_Checkout/js/model/totals', |
||
14 | 'Magento_Catalog/js/price-utils' |
||
15 | ], |
||
16 | function ($, Component, url, customerData, errorProcessor, fullScreenLoader, quote, pgSDK4x, selectPaymentMethodAction, checkoutData, totals, priceUtils) { |
||
0 ignored issues
–
show
|
|||
17 | 'use strict'; |
||
18 | |||
19 | return Component.extend({ |
||
20 | defaults: { |
||
21 | template: 'Pagantis_Pagantis/payment/checkout-form4x' |
||
22 | }, |
||
23 | |||
24 | redirectAfterPlaceOrder: false, |
||
25 | |||
26 | loadSimulator4x: function () { |
||
27 | window.loadingSimulator4x = setTimeout(function () { |
||
28 | if (window.checkoutConfig.payment.pagantis4x.enabled !='0' && |
||
0 ignored issues
–
show
There is no return statement if
window.checkoutConfig.pa...roduct_simulator == "1" is false . Are you sure this is correct? If so, consider adding return; explicitly.
This check looks for functions where a Consider this little piece of code function isBig(a) {
if (a > 5000) {
return "yes";
}
}
console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined
The function This behaviour may not be what you had intended. In any case, you can add a
Loading history...
|
|||
29 | window.checkoutConfig.payment.pagantis4x.publicKey!='' && |
||
30 | window.checkoutConfig.payment.pagantis4x.product_simulator=='1') { |
||
31 | var locale = window.checkoutConfig.payment.pagantis4x.locale; |
||
32 | var sdk = pgSDK4x; |
||
33 | |||
34 | var simulator_options4x = { |
||
35 | numInstalments : window.checkoutConfig.payment.pagantis4x.quotesStart, |
||
36 | type : eval(window.checkoutConfig.payment.pagantis4x.type), |
||
37 | skin : eval(window.checkoutConfig.payment.pagantis4x.skin), |
||
38 | publicKey: window.checkoutConfig.payment.pagantis4x.publicKey, |
||
39 | selector: window.checkoutConfig.payment.pagantis4x.position, |
||
40 | totalAmount: window.checkoutConfig.payment.pagantis4x.total, |
||
41 | locale: window.checkoutConfig.payment.pagantis4x.locale, |
||
42 | country: window.checkoutConfig.payment.pagantis4x.country |
||
43 | }; |
||
44 | |||
45 | if (typeof sdk !== 'undefined') { |
||
0 ignored issues
–
show
There is no return statement if
typeof sdk !== "undefined" is false . Are you sure this is correct? If so, consider adding return; explicitly.
This check looks for functions where a Consider this little piece of code function isBig(a) {
if (a > 5000) {
return "yes";
}
}
console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined
The function This behaviour may not be what you had intended. In any case, you can add a
Loading history...
|
|||
46 | window.MGSimulatorId4x = sdk.simulator.init(simulator_options4x); |
||
47 | return false; |
||
48 | } |
||
49 | } |
||
50 | }, 3000); |
||
51 | }, |
||
52 | |||
53 | getTitle: function () { |
||
54 | return window.checkoutConfig.payment.pagantis4x.title |
||
55 | }, |
||
56 | |||
57 | getSubtitle: function () { |
||
58 | return window.checkoutConfig.payment.pagantis4x.subtitle |
||
59 | }, |
||
60 | |||
61 | getDisplayMode: function () { |
||
62 | return window.checkoutConfig.payment.pagantis4x.displayMode |
||
63 | }, |
||
64 | |||
65 | getImage: function () { |
||
66 | return window.checkoutConfig.payment.pagantis4x.image |
||
67 | }, |
||
68 | |||
69 | placeOrder: function () { |
||
70 | var paymentUrl = url.build('pagantis/Payment'); |
||
71 | |||
72 | var guestEmail = window.checkoutConfig.payment.pagantis.fullQuote.guestEmail; |
||
73 | var product = 'pagantis4x'; |
||
74 | |||
75 | $.post(paymentUrl, { email: guestEmail, product: product }, 'json') |
||
76 | .done(function (response) { |
||
77 | window.location.replace(response); |
||
78 | }) |
||
79 | .fail(function (response) { |
||
80 | window.location.replace(response); |
||
81 | }) |
||
82 | }, |
||
83 | }); |
||
84 | } |
||
85 | ); |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.