Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

JS errors on checkout while using stripe.js branch #13

Open
magarence opened this issue Sep 7, 2016 · 1 comment
Open

JS errors on checkout while using stripe.js branch #13

magarence opened this issue Sep 7, 2016 · 1 comment

Comments

@magarence
Copy link

Having troubles while using stripe.js branch - after filling out CC data and placing order, checkout process hangs, there is no order confirmation message (if test CC was valid, it goes through to Stripe, and in Magento backend order is made, complete with transaction), though if an invalid CC was picked (that would return card_declined message), process hangs and in console there are javascript errors:

jquery.js:9666 POST http://dev.dev.com/en/rest/en/V1/carts/mine/payment-information 400 (Bad Request)

error-processor.js:20 Uncaught TypeError: messageContainer.addErrorMessage is not a function

Is stripejs branch compatible with Magento 2.1 ?

@magarence
Copy link
Author

magarence commented Sep 8, 2016

Problem was with line:

placeOrder = placeOrderAction(self.getData(), self.redirectAfterPlaceOrder, self.messageContainer);

when it is changed to

placeOrder = placeOrderAction(self.getData(), self.messageContainer);

error messages work fine, though on no error checkout still hangs, because no redirect on success action was defined.

Fix:

define( [ 'jquery', 'Magento_Payment/js/view/payment/cc-form', 'Magento_Checkout/js/action/place-order', 'Magento_Checkout/js/model/full-screen-loader', **'Magento_Checkout/js/action/redirect-on-success',** 'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Payment/js/model/credit-card-validation/validator', 'stripejs' ]
...

.done(
    function () {
        self.afterPlaceOrder();

        if (self.redirectAfterPlaceOrder) {
            redirectOnSuccessAction.execute();
        }
    }
)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant