0

I have the following issue, I generate payment module from the website: http://cedcommerce.com/magento-2-module-creator/payment-module

After deploying it and install it on my Magento 2 site, I can see the new payment module in the admin panel and on the checkout page. now I am trying to make a redirect to the secure page of the gateway payment by overriding the method getOrderPlaceRedirectUrl like that: enter image description here

Now I expect that on the checkout page when I select the new payment I will be redirected to the secure page of the gateway payment, but it didn't happen, I am using Magento 2.1.

1
  • This service generates payment module based on deprecated classes. Do not extend AbstractMethod class, more details about payment method implementation you can find on Magento 2 dev docs
    – joni jones
    Jan 26 '17 at 15:52
0

Open Web2/TranzilaMethod/view/frontend/web/template/payment/web2tranzila2.html

Replace button following code:

<button class="action primary checkout"
        type="submit"
        data-bind="click: continueToTranzilaMethod, enable: (getCode() == isChecked())"
        disabled>
    <span data-bind="i18n: 'Place Order'"></span>
</button>

Open Web2/TranzilaMethod/view/frontend/web/js/view/payment/method-renderer/web2tranzila2-method.js

Code should be following:

define(
    [
        'jquery',
        'Magento_Checkout/js/view/payment/default'
    ],
    function ($, Component) {
        'use strict';

        return Component.extend({
            defaults: {
                template: 'Web2_TranzilaMethod/payment/tranzilamethod'
            },

            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            continueToTranzilaMethod: function () {
                this.selectPaymentMethod();
                $.mage.redirect(
                    'https://direct.tranzila.com/ttxwinshop'
                );

                return false;
            }
        });
    }
);

More details check paypal express checkout as a sample

9
  • Thank you for your response, I tried to implement your suggestion in two ways: 1. I just update the current files with the code that you wrote me here, and on the checkout page, I got the error message in the console: continueToTranzilaMethod is not defined, although that the method located in the tranzilamethod-method.js" 2. I generated a new payment module, and make the changes in the files that you wrote me, deploy it and then I get a different error message in the console (in the loading of the checkout page): prntscr.com/e2dtc8 Jan 30 '17 at 20:09
  • while the param should be like that: prntscr.com/e2dvjp,, maybe you have any idea ? Jan 30 '17 at 20:18
  • Could you share web2tranzila2-method.js? Or share your module
    – Sohel Rana
    Jan 31 '17 at 3:00
  • Can you share your checkout_index_index.xml?
    – Sohel Rana
    Jan 31 '17 at 4:54
  • Yes, sure. This is the web2tranzila2-method.js: prntscr.com/e2zu67 and that is the file checkout_index_index.xml: prntscr.com/e2zuuh thanks for your help Feb 1 '17 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.