Passed
Pull Request — master (#16)
by
unknown
03:27
created

paylater.js ➔ ... ➔ Component.extend.getTitle   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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) {
0 ignored issues
show
Unused Code introduced by
The parameter priceUtils is not used and could be removed.

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.

Loading history...
Unused Code introduced by
The parameter totals is not used and could be removed.

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.

Loading history...
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