Skip to content

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

Add util for calling gateway list source method

Jakub Draganekbf0242aa0a19
diff --git a/saleor/payment/utils.py b/saleor/payment/utils.py
index f47ddf1160..7f65a881a8 100644
--- a/saleor/payment/utils.py
+++ b/saleor/payment/utils.py
@@ -248,6 +248,12 @@ def gateway_get_client_token(gateway_name: str, token_config: TokenConfig = None
return gateway.get_client_token(config=gateway_config, token_config=token_config)
+def gateway_list_client_sources(gateway_name: str, customer_id: str):
+ """Lists all stored customer sources for customer with ID"""
+ gateway, gateway_config = get_payment_gateway(gateway_name)
+ return gateway.list_client_sources(config=gateway_config, customer_id=customer_id)
+
+
def clean_capture(payment: Payment, amount: Decimal):
"""Check if payment can be captured."""
if amount <= 0: