-
-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Split Checkout] insufficient_funds decline code breaks checkout #9038
Comments
Server log:
Bugsnag:
|
It's the same for |
It also happens on step 2 (the payment one), if you check the |
@filipefurtad0 |
Yes, I agree @jibees . On Step 2: currently the Stripe form is mocked in test environment, so maybe we can make it to work with puffing-billy. Since there are some issues in integrating it with system tests (cuprite driver), maybe we should go for feature spec, instead? Update/related: see this PR. On Step 3: I'm currently looking at this Overall: We also have this I'm kind of exploring (i.e. rambling) 😄 about these possibilities on this slack thread. |
Notes to myself, cases which failed
|
Case 1, aka. Trying to save a card that trigger any stripe errors on step 2The issue seems to be related to flash.now[:error] ||= I18n.t('split_checkout.errors.global')
render status: :ok, operations: cable_car.
replace("#checkout", partial("split_checkout/checkout")).
replace("#flashes", partial("shared/flashes", locals: { flashes: flash })) the HTML sent by [{"html":"\u003ccheckout class='row' id='checkout'\u003e\n\u003cdiv class='small-12 medium-12 columns'\u003e\n\u003cdiv class='flex'\u003e\n\u003cdiv class='columns three text-center checkout-tab success'\u003e\n\u003cdiv\u003e\n\u003cspan class='checkout-tab-number'\u003e\n1 -\n\u003c/span\u003e\n\u003cspan class='checkout-tab-label'\u003e\n\u003ca href=\"/checkout/details\"\u003eVos informations\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='columns three text-center checkout-tab selected'\u003e\n\u003cdiv\u003e\n\u003cspan class='checkout-tab-number'\u003e\n2 -\n\u003c/span\u003e\n\u003cspan class='checkout-tab-label'\u003e\nMoyen de paiement\n\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='columns three text-center checkout-tab'\u003e\n\u003cdiv\u003e\n\u003cspan class='checkout-tab-number'\u003e\n3 -\n\u003c/span\u003e\n\u003cspan class='checkout-tab-label'\u003e\nRécapitulatif de la commande\n\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv class='checkout-step'\u003e\n\u003cform data-remote=\"true\" action=\"/checkout/payment\" accept-charset=\"UTF-8\" method=\"post\"\u003e\u003cinput type=\"hidden\" name=\"_method\" value=\"put\" /\u003e\u003cinput type=\"hidden\" name=\"authenticity_token\" value=\"x2pjDVBwZ32rhfyCTdnCEbg8jxdw8UrnH8sLWvYtEXUzrgUyK4D76FXjR6RyEG9cwcUJ8YOa5BlbiHJq8-Flvw\" /\u003e\u003cdiv class='medium-6'\u003e\n\u003cdiv class='checkout-substep' data-controller='paymentmethod'\u003e\n\u003cdiv class='checkout-title'\u003e\nMoyen de paiement\n\u003c/div\u003e\n\u003cdiv class='checkout-input checkout-input-radio'\u003e\n\u003cinput id=\"payment_method_1\" name=\"order[payments_attributes][][payment_method_id]\" data-action=\"paymentmethod#selectPaymentMethod\" data-paymentmethod-id=\"paymentmethod1\" data-paymentmethod-target=\"input\" type=\"radio\" value=\"1\" /\u003e\n\u003clabel for=\"payment_method_1\"\u003eCash on collection (Pas de frais supplémentaires)\u003c/label\u003e\n\u003c/div\u003e\n\u003cdiv class='checkout-input checkout-input-radio'\u003e\n\u003cinput id=\"payment_method_12\" name=\"order[payments_attributes][][payment_method_id]\" data-action=\"paymentmethod#selectPaymentMethod\" data-paymentmethod-id=\"paymentmethod12\" data-paymentmethod-target=\"input\" type=\"radio\" value=\"12\" checked=\"checked\" /\u003e\n\u003clabel for=\"payment_method_12\"\u003eStripe (Pas de frais supplémentaires)\u003c/label\u003e\n\u003c/div\u003e\n\n\u003cdiv class='paymentmethod-container' id='paymentmethod1' style='display: none'\u003e\n\u003cdiv class='paymentmethod-description panel'\u003e\nPay on collection!\n\u003c/div\u003e\n\u003cdiv class='paymentmethod-form'\u003e\n\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='paymentmethod-container' id='paymentmethod12' style='display: block'\u003e\n\u003cdiv class='paymentmethod-form'\u003e\n\u003cdiv data-controller='stripe-cards'\u003e\n\u003cdiv class='checkout-input'\u003e\n\u003clabel\u003e\nUtilisez une carte enregistrée\n\u003c/label\u003e\n\u003cselect name=\"existing_card_id\" id=\"existing_card_id\" data-action=\"change-\u0026gt;stripe-cards#onSelectCard\" data-stripe-cards-target=\"select\"\u003e\u003coption value=\"18\"\u003evisa 4242 Exp:10/2022\u003c/option\u003e\n\u003coption value=\"20\"\u003evisa 4242 Exp:02/2024\u003c/option\u003e\n\u003coption value=\"22\"\u003evisa 4242 Exp:12/2044\u003c/option\u003e\n\u003coption value=\"\"\u003eou entrez les détails de votre nouvelle carte ci-dessous\u003c/option\u003e\u003c/select\u003e\n\u003c/div\u003e\n\u003cdiv data-stripe-cards-target='stripeelements'\u003e\n\u003cdiv class='checkout-input'\u003e\n\u003cdiv data-controller='stripe' data-stripe-key='pk_test_yFdIepNxviZOdmGWmhtKR8h5'\u003e\n\u003cdiv class='stripe-card'\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][first_name]\" id=\"order_payments_attributes__source_attributes_first_name\" value=\"Jean-Baptiste\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][last_name]\" id=\"order_payments_attributes__source_attributes_last_name\" value=\"Bellet2\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][month]\" id=\"order_payments_attributes__source_attributes_month\" data-stripe-target=\"expMonth\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][year]\" id=\"order_payments_attributes__source_attributes_year\" data-stripe-target=\"expYear\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][cc_type]\" id=\"order_payments_attributes__source_attributes_cc_type\" data-stripe-target=\"brand\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][last_digits]\" id=\"order_payments_attributes__source_attributes_last_digits\" data-stripe-target=\"last4\" /\u003e\n\u003cinput type=\"hidden\" name=\"order[payments_attributes][][source_attributes][gateway_payment_profile_id]\" id=\"order_payments_attributes__source_attributes_gateway_payment_profile_id\" data-stripe-target=\"pmId\" /\u003e\n\u003cdiv class='card-element' data-stripe-target='cardElement'\u003e\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='error card-errors' data-stripe-target='cardErrors'\u003e\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='checkout-input'\u003e\n\u003cinput type=\"checkbox\" name=\"order[payments_attributes][][source_attributes][save_requested_by_customer]\" id=\"order_payments_attributes__source_attributes_save_requested_by_customer\" value=\"1\" /\u003e\n\u003clabel for=\"save_requested_by_customer\"\u003eEnregistrez votre carte pour vos prochains achats\u003c/label\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class='checkout-substep'\u003e\nVous pourrez vérifier et confirmer votre commande à l\u0026#39;étape suivante.\n\u003c/div\u003e\n\u003cdiv class='checkout-submit'\u003e\n\u003cinput type=\"submit\" name=\"commit\" value=\"Etape suivante - Récapitulatif de commande\" class=\"button primary\" data-disable-with=\"Etape suivante - Récapitulatif de commande\" /\u003e\n\u003ca class='button cancel' href='/checkout/details'\u003e\nRetour à vos coordonnées\n\u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003c/form\u003e\u003c/div\u003e\n\n\u003c/div\u003e\n\u003c/checkout\u003e\n","selector":"#checkout","operation":"replace"},{"html":"\u003cdiv id='flashes'\u003e\n\u003calert class='animate-show' data-controller='flash'\u003e\n\u003cdiv class='alert-box alert' type='error'\u003e\n\u003cspan\u003eLa sauvegarde a échoué, merci de mettre à jour les champs mis en évidence.\u003c/span\u003e\n\u003ca class='small close' data-action='click-\u0026gt;flash#close'\u003e×\u003c/a\u003e\n\u003c/div\u003e\n\u003c/alert\u003e\n\u003c/div\u003e\n","selector":"#flashes","operation":"replace"}] This is maybe related to the fact that before submitting the request to the server, we previously call for I'd invoke for @Matt-Yorkley help for this one. 🙏 Re. after more investigations this.parentForm.submit(); _After more investigations, and asking users on Discord server, we've found the solution! 👏 🎉 _ |
Ok, seems that I failed to resolve:
I'd be happy if @Matt-Yorkley or @mkllnk could have a look at it! 🙏 |
What is happening? Is a new payment method created or is that failing the second time? I would need a bit more time to debug this properly. Maybe later in the week? I'm in the middle of Active Storage. |
If we submit (on step3) a payment with a card error, then we probably should go back on step2 with the flash error, in order to make another round with stripe. I can't make this redirection functional. |
Just as a proof of concept, this works for me: --- a/app/controllers/split_checkout_controller.rb
+++ b/app/controllers/split_checkout_controller.rb
@@ -63,6 +63,9 @@ class SplitCheckoutController < ::BaseController
render operations: cable_car.redirect_to(url: redirect_url)
true
+ rescue
+ render operations: cable_car.redirect_to(url: checkout_step_path(:payment))
+ true
end
def selected_payment_method The replacement with flash would be nicer though. I found another scenario where this fails:
|
Description
Looks related to #8952.
The
insufficient_funds
decline code - say from introducing the card 4000000000009995 on split ckeckout - breaks the checkout flow.Expected Behavior
I think the expected behavior would be to be redirected to
/payment
step.Actual Behaviour
Snail.
Steps to Reproduce
/payment
and introduced the card * 9995/summary
Animated Gif/Screenshot
The text was updated successfully, but these errors were encountered: