Fix 3DSv2 implementation (#542)

* Fixed wrong HMAC signature generation

* Fix xml du panier

Co-authored-by: Julien Constant <julienconstant190@gmail.com>
This commit is contained in:
Théo DURR 2023-01-06 20:02:45 +01:00 committed by GitHub
parent 7079761ffe
commit fe8b8f46aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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 '<?xml version="1.0" encoding="UTF-8" ?>\n' + xml
return '<?xml version="1.0" encoding="UTF-8" ?>' + xml
def __str__(self):
return f"{self.first_name} {self.last_name}"

View File

@ -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 = '<?xml version="1.0" encoding="UTF-8" ?>' + cart
cart = {
"shoppingcart": {"total": {"totalQuantity": min(self.items.count(), 99)}}
}
cart = '<?xml version="1.0" encoding="UTF-8" ?>' + dict2xml(
cart, newlines=False
)
data += [
("PBX_SHOPPINGCART", html.escape(cart)),
("PBX_BILLING", html.escape(customer.billing_infos.to_3dsv2_xml())),