From fe8b8f46aafe58dd7a06f6c06403c99b6b873e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DURR?= Date: Fri, 6 Jan 2023 20:02:45 +0100 Subject: [PATCH] Fix 3DSv2 implementation (#542) * Fixed wrong HMAC signature generation * Fix xml du panier Co-authored-by: Julien Constant --- counter/models.py | 2 +- eboutic/models.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/counter/models.py b/counter/models.py index cfbc437e..ea8c2338 100644 --- a/counter/models.py +++ b/counter/models.py @@ -181,7 +181,7 @@ class BillingInfo(models.Model): if self.address_2: data["Address"]["Address2"] = self.address_2 xml = dict2xml(data, wrap="Billing", newlines=False) - return '\n' + xml + return '' + xml def __str__(self): return f"{self.first_name} {self.last_name}" diff --git a/eboutic/models.py b/eboutic/models.py index ced2821c..0c5c7dc7 100644 --- a/eboutic/models.py +++ b/eboutic/models.py @@ -199,9 +199,12 @@ class Basket(models.Model): ("PBX_TYPECARTE", "CB"), ("PBX_TIME", datetime.now().replace(microsecond=0).isoformat("T")), ] - cart = {"shoppingcart": {"total": min(self.items.count(), 99)}} - cart = dict2xml(cart, newlines=False) - cart = '' + cart + cart = { + "shoppingcart": {"total": {"totalQuantity": min(self.items.count(), 99)}} + } + cart = '' + dict2xml( + cart, newlines=False + ) data += [ ("PBX_SHOPPINGCART", html.escape(cart)), ("PBX_BILLING", html.escape(customer.billing_infos.to_3dsv2_xml())),