Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Parse decimal and datetime to JSON-friendly format

Pacu26b34152e81f3
diff --git a/saleor/checkout/utils.py b/saleor/checkout/utils.py
index 19f1ba17ae..10537c2ef5 100644
--- a/saleor/checkout/utils.py
+++ b/saleor/checkout/utils.py
@@ -893,7 +893,7 @@ def is_fully_paid(cart: Cart):
def ready_to_place_order(cart: Cart, taxes, discounts):
- #FIXME test me
+ # FIXME test me
if cart.is_shipping_required():
if not cart.shipping_method:
return False, pgettext_lazy(
diff --git a/saleor/payment/providers/braintree/__init__.py b/saleor/payment/providers/braintree/__init__.py
index 5a447538af..b96d32c635 100644
--- a/saleor/payment/providers/braintree/__init__.py
+++ b/saleor/payment/providers/braintree/__init__.py
@@ -99,8 +99,8 @@ def extract_gateway_response(braintree_result) -> Dict:
# in the API
gateway_response = {
'currency_iso_code': bt_transaction.currency_iso_code,
- 'amount': bt_transaction.amount,
- 'created_at': bt_transaction.created_at,
+ 'amount': str(bt_transaction.amount), # Decimal type
+ 'created_at': str(bt_transaction.created_at), # datetime type
'credit_card': bt_transaction.credit_card,
'additional_processor_response': bt_transaction.additional_processor_response, # noqa
'gateway_rejection_reason': bt_transaction.gateway_rejection_reason,