Skip to main content
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment methodcustom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {

                console.log(customer);
                console.log(customer.customer);
                console.log(customer_Data);
                var total = quote.getTotals();
                console.log(total);
                console.log(quote.billingAddress);

                return false;
            }

        });
    }
);

after debugging not getting data.

enter image description here

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {

                console.log(customer);
                console.log(customer.customer);
                console.log(customer_Data);
                var total = quote.getTotals();
                console.log(total);
                console.log(quote.billingAddress);

                return false;
            }

        });
    }
);

after debugging not getting data.

enter image description here

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {

                console.log(customer);
                console.log(customer.customer);
                console.log(customer_Data);
                var total = quote.getTotals();
                console.log(total);
                console.log(quote.billingAddress);

                return false;
            }

        });
    }
);

after debugging not getting data.

enter image description here

added 201 characters in body
Source Link
Bojjaiah
  • 3.8k
  • 4
  • 58
  • 122

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customerDatacustomer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            initializedefaults: function () {
                this._super();
template: 'TestVendor_TestPayment/payment/testpayment'
            },

    customer_Data = customerData.get('customer');
      /** Returns send check to info },
*/
            defaultsgetMailingAddress: function() {
                template:return 'TestVendor_TestPayment/window.checkoutConfig.payment/testpayment'.checkmo.mailingAddress;
            },
 
            /** ReturnsisDisplayed:function send() check{

 to info */
            getMailingAddress: functionconsole.log(customer) {;
                return window.checkoutConfig.paymentconsole.checkmolog(customer.mailingAddress;customer);
            },
    console.log(customer_Data);
        isDisplayed:function () {
      var total = quote.getTotals();
       // you can modify your custom logic   console.log(total);
                console.log(customer_Data);consolequote.log('customer_Dat'billingAddress); 

                return false;
            }

        });
    }
);

after debugging not getting data.

enter image description here

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data'
    ],
    function (Component, customerData) {
        'use strict';

        var customer_Data;

        return Component.extend({

            initialize: function () {
                this._super();

                customer_Data = customerData.get('customer');
            },

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },
 
            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {
                // you can modify your custom logic
                console.log(customer_Data);console.log('customer_Dat');
                return false;
            }

        });
    }
);

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (Component, customer, quote, $) {
        'use strict';

        var customer_Data;

        return Component.extend({

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {

                console.log(customer);
                console.log(customer.customer);
                console.log(customer_Data);
                var total = quote.getTotals();
                console.log(total);
                console.log(quote.billingAddress); 

                return false;
            }

        });
    }
);

after debugging not getting data.

enter image description here

added 1239 characters in body
Source Link
Bojjaiah
  • 3.8k
  • 4
  • 58
  • 122

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data'
    ],
    function (Component, customerData) {
        'use strict';

        var customer_Data;

        return Component.extend({

            initialize: function () {
                this._super();

                customer_Data = customerData.get('customer');
            },

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {
                // you can modify your custom logic
                console.log(customer_Data);console.log('customer_Dat');
                return false;
            }

        });
    }
);

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

I have some validations to place order through custom TestPayment method, for this I have to disable/enable the PlaceOrder button and showing some message under my custom payment method section. For this I have created the custom payment method and it is showing and working fine. But I don't know to to validate and showing messages here.

enter image description here

So Could you please suggest me how to showing messages and enable/disable PlaceOrder Button here based on customer Data.

TestVendor/TestPayment/view/frontend/web/js/view/payment/method-renderer/testpayment-method.js

/*browser:true*/
/*global define*/
define(
    [
        'Magento_Checkout/js/view/payment/default',
        'Magento_Customer/js/customer-data'
    ],
    function (Component, customerData) {
        'use strict';

        var customer_Data;

        return Component.extend({

            initialize: function () {
                this._super();

                customer_Data = customerData.get('customer');
            },

            defaults: {
                template: 'TestVendor_TestPayment/payment/testpayment'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            isDisplayed:function () {
                // you can modify your custom logic
                console.log(customer_Data);console.log('customer_Dat');
                return false;
            }

        });
    }
);
Source Link
Bojjaiah
  • 3.8k
  • 4
  • 58
  • 122
Loading