Last active
April 6, 2023 05:29
-
-
Save em230418/eaa1c8229577c2c01410b6ff54873aa3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/payment_bepaid/models/payment_bepaid.py b/payment_bepaid/models/payment_bepaid.py | |
index 771e220..63664bf 100644 | |
--- a/payment_bepaid/models/payment_bepaid.py | |
+++ b/payment_bepaid/models/payment_bepaid.py | |
@@ -51,7 +51,7 @@ class AcquirerBepaid(models.Model): | |
"language": "ru", | |
"customer_fields": { | |
"visible": ["first_name", "last_name"], | |
- "read_only": ["email"], | |
+ "read_only": [], | |
} | |
}, | |
"order": { | |
@@ -64,10 +64,12 @@ class AcquirerBepaid(models.Model): | |
"address": values.get('partner_address'), | |
"country": values.get('partner_country').code or '', | |
"city": values.get('partner_city'), | |
- "email": values.get('partner_email') | |
} | |
} | |
} | |
+ if values.get("partner_email"): | |
+ data["checkout"]["customer"]["email"] = values["partner_email"] | |
+ data["checkout"]["settings"]["customer_field"]["read_only"].append("email") | |
data_json = json.dumps(data) | |
_logger.info(data) | |
id_key = '{}:{}'.format(self.bepaid_id_shop, self.bepaid_security_key) | |
@@ -86,8 +88,10 @@ class AcquirerBepaid(models.Model): | |
} | |
response = requests.request("POST", url, data=data_json, headers=headers) | |
- url = json.loads(response.text) | |
- redirect_url = url.get('checkout').get('redirect_url') | |
+ res = json.loads(response.text) | |
+ if res.get("errors"): | |
+ raise Exception(response.text) | |
+ redirect_url = res.get('checkout').get('redirect_url') | |
self.bepaid_redirect_url = redirect_url | |
def bepaid_get_form_action_url(self): | |
diff --git a/payment_bepaid/static/src/js/payment_bepaid_processing.js b/payment_bepaid/static/src/js/payment_bepaid_processing.js | |
index da5b76c..3c2f5fc 100644 | |
--- a/payment_bepaid/static/src/js/payment_bepaid_processing.js | |
+++ b/payment_bepaid/static/src/js/payment_bepaid_processing.js | |
@@ -52,7 +52,7 @@ odoo.define('payment_bepaid.payment_bepaid_processing', function (require) { | |
} | |
self.startPolling(); | |
- }).guardedCatch(function() { | |
+ }).fail(function() { | |
self.displayContent("payment_bepaid.rpc_error", {}); | |
self.startPolling(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment