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
|
|
|
'Magento_Checkout/js/action/select-payment-method', |
11
|
|
|
'Magento_Checkout/js/checkout-data', |
12
|
|
|
'Magento_Checkout/js/model/totals', |
13
|
|
|
'Magento_Catalog/js/price-utils' |
14
|
|
|
], |
15
|
|
|
function ($, Component, url, customerData, errorProcessor, fullScreenLoader, quote, selectPaymentMethodAction, checkoutData, totals, priceUtils) { |
|
|
|
|
16
|
|
|
'use strict'; |
17
|
|
|
|
18
|
|
|
window.checkoutConfig.payment.paylater.guestEmail = quote.guestEmail; |
19
|
|
|
|
20
|
|
|
return Component.extend({ |
21
|
|
|
defaults: { |
22
|
|
|
template: 'DigitalOrigin_Pmt/payment/checkout-form' |
23
|
|
|
}, |
24
|
|
|
|
25
|
|
|
redirectAfterPlaceOrder: false, |
26
|
|
|
|
27
|
|
|
getTitle: function () { |
28
|
|
|
return window.checkoutConfig.payment.paylater.title |
29
|
|
|
}, |
30
|
|
|
|
31
|
|
|
getSubtitle: function () { |
32
|
|
|
return window.checkoutConfig.payment.paylater.subtitle |
33
|
|
|
}, |
34
|
|
|
|
35
|
|
|
getDisplayMode: function () { |
36
|
|
|
return window.checkoutConfig.payment.paylater.displayMode |
37
|
|
|
}, |
38
|
|
|
|
39
|
|
|
selectPaymentMethod: function() { |
40
|
|
|
selectPaymentMethodAction(this.getData()); |
41
|
|
|
checkoutData.setSelectedPaymentMethod(this.item.method); |
42
|
|
|
return true; |
43
|
|
|
}, |
44
|
|
|
|
45
|
|
|
placeOrder: function () { |
46
|
|
|
var paymentUrl = url.build('paylater/Payment'); |
47
|
|
|
$.post(paymentUrl, { email: window.checkoutConfig.payment.paylater.guestEmail }, 'json') |
48
|
|
|
.done(function (response) { |
49
|
|
|
window.location.replace(response); |
50
|
|
|
}) |
51
|
|
|
.fail(function (response) { |
52
|
|
|
window.location.replace(response); |
53
|
|
|
}) |
54
|
|
|
}, |
55
|
|
|
}); |
56
|
|
|
} |
57
|
|
|
); |
58
|
|
|
|
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.