Skip to content

Commit

Permalink
Fix fetching customer_id for anonymous user
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubDraganek committed Sep 19, 2019
1 parent 08a4caf commit b373e37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions saleor/payment/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ def gateway_postprocess(transaction, payment):
def fetch_customer_id(user, gateway):
"""Retrieve users customer_id stored for desired gateway."""
key = prepare_namespace_name(gateway)
gateway_config = user.get_private_meta(
namespace=GATEWAYS_META_NAMESPACE, client=key
)
gateway_config = {}
if hasattr(user, "get_private_meta"):
gateway_config = user.get_private_meta(
namespace=GATEWAYS_META_NAMESPACE, client=key
)
return gateway_config.get("customer_id", None)


Expand Down

0 comments on commit b373e37

Please sign in to comment.