Cleanse JS errors from DOM on Stripe failure

This commit is contained in:
Ryan Murphy
2023-12-02 13:09:34 -05:00
parent f6ba2dc70c
commit b84707edd9
2 changed files with 3 additions and 1 deletions

View File

@@ -43,7 +43,8 @@ angular.module('admin.payments').factory 'Payment', (AdminStripeElements, curren
submit: =>
munged = @preprocess()
PaymentResource.create({order_id: munged.order_id}, munged, (response, headers, status) ->
document.body.innerHTML = Object.values(response).join('')
rawHtml = Object.values(response).join('').replace('[object Object]true', '')
document.body.innerHTML = rawHtml
$window.history.pushState({}, '', "/admin/orders/" + munged.order_id + "/payments")
, (response) ->
StatusMessage.display 'error', t("spree.admin.payments.source_forms.stripe.error_saving_payment")

View File

@@ -62,6 +62,7 @@ describe '
click_button "Update"
expect(page).to have_content "Payments"
expect(page).to have_content "Payment has been successfully created!"
expect(page).not_to have_content "[object Object]true"
order.reload
expect(order.state).to eq "complete"