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 | '//cdn.pagamastarde.com/js/pmt-v2/sdk.js', |
||
12 | 'Magento_Checkout/js/action/select-payment-method', |
||
13 | 'Magento_Checkout/js/checkout-data', |
||
14 | 'Magento_Checkout/js/model/totals', |
||
15 | 'Magento_Catalog/js/price-utils' |
||
16 | ], |
||
17 | function ($, Component, url, customerData, errorProcessor, fullScreenLoader, quote, pgSDK, pmtSDK, selectPaymentMethodAction, checkoutData, totals, priceUtils) { |
||
0 ignored issues
–
show
|
|||
18 | 'use strict'; |
||
19 | |||
20 | window.checkoutConfig.payment.pagantis.guestEmail = quote.guestEmail; |
||
21 | |||
22 | return Component.extend({ |
||
23 | defaults: { |
||
24 | template: 'Pagantis_Pagantis/payment/checkout-form' |
||
25 | }, |
||
26 | |||
27 | redirectAfterPlaceOrder: false, |
||
28 | |||
29 | loadSimulator: function () { |
||
30 | setTimeout(function () { |
||
31 | if (window.checkoutConfig.payment.pagantis.enabled !='0' && |
||
32 | window.checkoutConfig.payment.pagantis.publicKey!='' && |
||
33 | window.checkoutConfig.payment.pagantis.secretKey!='') { |
||
34 | var locale = window.checkoutConfig.payment.pagantis.locale; |
||
35 | if (locale=='es'|| locale=='') { |
||
36 | var sdk = pmtSDK; |
||
37 | } else { |
||
38 | var sdk = pgSDK; |
||
39 | } |
||
40 | |||
41 | var simulator_options = { |
||
42 | publicKey: window.checkoutConfig.payment.pagantis.publicKey, |
||
43 | selector: '.pagantisSimulator', |
||
44 | totalAmount: window.checkoutConfig.payment.pagantis.total, |
||
45 | locale: window.checkoutConfig.payment.pagantis.locale, |
||
46 | totalPromotedAmount : window.checkoutConfig.payment.pagantis.promotedAmount |
||
47 | }; |
||
48 | |||
49 | if (typeof sdk !== 'undefined') { |
||
50 | window.MGSimulatorId = sdk.simulator.init(simulator_options); |
||
51 | return false; |
||
52 | } |
||
53 | } |
||
54 | }, 3000); |
||
55 | }, |
||
56 | |||
57 | getTitle: function () { |
||
58 | return window.checkoutConfig.payment.pagantis.title |
||
59 | }, |
||
60 | |||
61 | getSubtitle: function () { |
||
62 | return window.checkoutConfig.payment.pagantis.subtitle |
||
63 | }, |
||
64 | |||
65 | getDisplayMode: function () { |
||
66 | return window.checkoutConfig.payment.pagantis.displayMode |
||
67 | }, |
||
68 | |||
69 | getImage: function () { |
||
70 | return window.checkoutConfig.payment.pagantis.image |
||
71 | }, |
||
72 | |||
73 | placeOrder: function () { |
||
74 | var paymentUrl = url.build('pagantis/Payment'); |
||
75 | $.post(paymentUrl, { email: window.checkoutConfig.payment.pagantis.guestEmail }, '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 | ); |
||
86 |
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.