Handle redirect case

For some reason the process is now working correctly, the authorization step succeeds and a redirect link is stored in the payment with state pending. The payment state is correctly left at pending. Here we add a check for the redirect path sent by stripe and fail the authorization if there is one (it means the payment would need an extra auth step only available in the frontoffice now and probably through email to customer at some point in the future). For some reason the flash with the authorization failure message is not showing up for the user
This commit is contained in:
Luis Ramos
2020-12-03 00:37:11 +00:00
parent 62715a8060
commit 480dfdf961
2 changed files with 5 additions and 3 deletions

View File

@@ -135,7 +135,9 @@ module Spree
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
@payment.authorize!
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
return if @payment.pending? && @payment.cvv_response_message.nil?
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
end
end
end

View File

@@ -78,8 +78,8 @@ feature '
click_button "Update"
expect(page).to have_link "StripeSCA"
expect(page).to have_content "PROCESSING"
expect(OrderPaymentFinder.new(order.reload).last_payment.state).to eq "processing"
expect(page).to have_content "PENDING"
expect(OrderPaymentFinder.new(order.reload).last_payment.state).to eq "pending"
end
end
end