From 4a4ac241354f16674f4f626fe223c5dd7688e4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ch=C3=A9rifBALDE?= Date: Thu, 13 Oct 2022 21:53:15 +0200 Subject: [PATCH] 13/10/22 - 21h --- ela_factures_mgt.py | 3 +-- strype_payement.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ela_factures_mgt.py b/ela_factures_mgt.py index 7fb5049..115edb1 100644 --- a/ela_factures_mgt.py +++ b/ela_factures_mgt.py @@ -221,8 +221,6 @@ def add_payement_mode(diction): new_data['iban'] = "" new_data['bic'] = "" - - if ("nom_carte" in diction.keys()): if diction['nom_carte']: new_data['nom_carte'] = diction['nom_carte'] @@ -287,6 +285,7 @@ def add_payement_mode(diction): new_stripe_card = {} new_stripe_card['customerid'] = partner_stripe_account_id new_stripe_card['number'] = new_data['num_carte'] + new_stripe_card['name'] = new_data['nom_carte'] new_stripe_card['exp_month'] = str(tmp_tab[0]) new_stripe_card['exp_year'] = str(tmp_tab[1]) new_stripe_card['cvc'] = new_data['cvv_carte'] diff --git a/strype_payement.py b/strype_payement.py index 65f8a38..f282327 100644 --- a/strype_payement.py +++ b/strype_payement.py @@ -138,10 +138,12 @@ def get_customer_payement_cards(diction): type="card", ) - #print(" ### customer_payments = "+str(customer_payments.data)) + print(" ### customer_payments = "+str(customer_payments.data)) + RetObject = [] for val in customer_payments.data : my_card = {} + my_card['nom_carte'] = str(val.billing_details.name) my_card['brand'] = str(val.card.brand) my_card['exp_month'] = str(val.card.exp_month) my_card['exp_year'] = str(val.card.exp_year) @@ -167,13 +169,17 @@ Creation d'une carte de payement def create_update_payment_card(diction): try: - field_list_obligatoire = ['number', 'exp_month', 'exp_year', 'cvc', 'customerid', 'stripe_paymentmethod_id'] + field_list_obligatoire = ['name', 'number', 'exp_month', 'exp_year', 'cvc', 'customerid', 'stripe_paymentmethod_id'] for val in field_list_obligatoire: if val not in diction: mycommon.myprint( str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ") return False, " Impossible de créer el moyen de payement" + name = "" + if ("name" in diction.keys()): + if diction['name']: + name = diction['name'] number = "" if ("number" in diction.keys()): @@ -236,6 +242,9 @@ def create_update_payment_card(diction): "exp_year": int(exp_year), "cvc": cvc, }, + billing_details={ + "name": str(name) + }, ) #print(" new_card = "+str(new_card))