Skip to content

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

Test against recorded data

Jakub Draganekaa2d3a60b7d2
diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.py
index a475b2fa5a..501b44cd2f 100644
--- a/saleor/payment/gateways/braintree/__init__.py
+++ b/saleor/payment/gateways/braintree/__init__.py
@@ -291,8 +291,8 @@ def list_client_sources(
def extract_credit_card_data(card):
credit_card = CreditCardInfo(
- exp_year=card.expiration_year,
- exp_month=card.expiration_month,
+ exp_year=int(card.expiration_year),
+ exp_month=int(card.expiration_month),
last4=card.last_4,
name_on_card=card.cardholder_name,
)
diff --git a/tests/gateway/test_braintree.py b/tests/gateway/test_braintree.py
index 0a4b794801..b8704a19e6 100644
--- a/tests/gateway/test_braintree.py
+++ b/tests/gateway/test_braintree.py
@@ -407,10 +407,10 @@ def test_void_incorrect_token(payment_txn_preauth, sandbox_braintree_gateway_con
def test_list_customer_sources(sandbox_braintree_gateway_config):
CUSTOMER_ID = "595109854" # retrieved from sandbox
expected_credit_card = CreditCardInfo(
- last4="1881", exp_year=2020, exp_month=12, name_on_card=""
+ last4="1881", exp_year=2020, exp_month=12, name_on_card=None
)
expected_customer_source = CustomerSource(
- id=CUSTOMER_ID, credit_card_info=expected_credit_card
+ id="d0b52c80b648ae8e5a14eddcaf24d254", credit_card_info=expected_credit_card
)
sources = list_client_sources(sandbox_braintree_gateway_config, CUSTOMER_ID)
- assert len(sources) == 1
+ assert sources == [expected_customer_source]