summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
Diffstat (limited to 'addons')
-rw-r--r--addons/payment_stripe/models/payment.py3
-rw-r--r--addons/payment_stripe/static/src/js/payment_form.js3
2 files changed, 6 insertions, 0 deletions
diff --git a/addons/payment_stripe/models/payment.py b/addons/payment_stripe/models/payment.py
index 1cb2adf97c1..39a8a67493e 100644
--- a/addons/payment_stripe/models/payment.py
+++ b/addons/payment_stripe/models/payment.py
@@ -69,6 +69,9 @@ class PaymentAcquirerStripe(models.Model):
"Request data:\n%s\n"
"Response body:\n%s",
url, pprint.pformat(data), resp.text)
+ stripe_error = resp.json().get('error', {}).get('message', '')
+ error_msg = " " + (_("Stripe gave us the following info about the problem: '%s'") % stripe_error)
+ raise ValidationError(error_msg)
return resp.json()
def _create_stripe_session(self, kwargs):
diff --git a/addons/payment_stripe/static/src/js/payment_form.js b/addons/payment_stripe/static/src/js/payment_form.js
index 8671e67e4e9..5ed4200a88c 100644
--- a/addons/payment_stripe/static/src/js/payment_form.js
+++ b/addons/payment_stripe/static/src/js/payment_form.js
@@ -79,6 +79,9 @@ PaymentForm.include({
self.el.submit();
}
}).guardedCatch(function (error) {
+ // We don't want to open the Error dialog since
+ // we already have a container displaying the error
+ error.event.preventDefault();
// if the rpc fails, pretty obvious
self.enableButton(button);
self.displayError(