diff --git a/ela_factures_mgt.py b/ela_factures_mgt.py index 4437c6d..7fb5049 100644 --- a/ela_factures_mgt.py +++ b/ela_factures_mgt.py @@ -433,8 +433,12 @@ def get_payement_mode(diction): ) localStatus, payment_cards = Stripe.get_customer_payement_cards(tmp_diction) + val_tmp = {} for tmp in payment_cards: - RetObject_stripe.append(JSONEncoder().encode(tmp)) + # RetObject.append(JSONEncoder().encode(user)) + val_tmp = tmp + RetObject_stripe.append(val_tmp) + #RetObject_stripe.append(JSONEncoder().encode(tmp)) print(" #### mode de payement via stripe = "+str(RetObject_stripe)) @@ -446,7 +450,8 @@ def get_payement_mode(diction): user['stripe_paymentmethod_id'] = stripe_paymentmethod_id RetObject.append(JSONEncoder().encode(user)) - return True, RetObject + + return True, RetObject_stripe except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() @@ -527,12 +532,15 @@ def createOrder(diction): # Recuperation des données client new_data['client_recid'] = user_recid coll_part_account = MYSY_GV.dbname['partnair_account'] - part_account = coll_part_account.find({'recid':user_recid, 'active':'1'}) - if (part_account.count() <= 0): + + # print(" myquery pr demo_account = " + str(myquery)) + tmp_count = coll_part_account.count_documents({'recid':user_recid, 'active':'1'}) + if (tmp_count <= 0): mycommon.myprint( str(inspect.stack()[0][3]) + "Aucune donnée client, Impossible de créer la commande ") return False, "Aucune donnée client, Impossible de créer la commande ", None + part_account = coll_part_account.find({'recid':user_recid, 'active':'1'}) if ("invoice_nom" in part_account[0].keys()): if part_account[0]['invoice_nom']: @@ -615,7 +623,7 @@ def createOrder(diction): total_ttc_float = mycommon.tryFloat(str(new_data['total_ttc'])) #print("str(new_data['total_ttc']) === " + str(total_ttc_float)) - if (part_account.count() <= 0 and total_ttc_float > 0): + if (tmp_count <= 0 and total_ttc_float > 0): mycommon.myprint( str(inspect.stack()[0][3]) + " Aucune donnée de payement, Impossible de créer la commande ") return False, " Aucune donnée de payement,, Impossible de créer la commande ", None