From e2789470fd569305813c201271e970f7f6fcef66 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Wed, 13 Apr 2022 21:43:58 +0200 Subject: [PATCH] todopago: Keep customer_id short when using UUIDs --- payments/todopago/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/payments/todopago/__init__.py b/payments/todopago/__init__.py index 69a760943..817bc33aa 100644 --- a/payments/todopago/__init__.py +++ b/payments/todopago/__init__.py @@ -52,7 +52,10 @@ def authorize_operation(self, payment: BasePayment) -> Authorization: billing_postcode=payment.billing_postcode, billing_address_1=payment.billing_address_1, billing_address_2=payment.billing_address_2, - customer_id=payment.pk, + # A UUID won't fit into the maximum length of this field. + # It _will_ fit if the dashes are removed. + # For primary keys of other data types, this has no effect. + customer_id=str(payment.pk).replace("-", ""), customer_ip_address=payment.customer_ip_address, items=[ Item(