From f2c1aba75a11a1992ac0e9b452641ccb269f023c Mon Sep 17 00:00:00 2001 From: Enrique Barcelli Date: Sun, 25 Jun 2023 01:57:20 +0800 Subject: [PATCH] Catch missing business partner in Banqup portal and present correct message --- extract_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extract_invoice.py b/extract_invoice.py index 26a964e..67c7be5 100644 --- a/extract_invoice.py +++ b/extract_invoice.py @@ -36,6 +36,12 @@ def extract_invoice(document): businessPartner=invoice['response']['data'][0]['businessPartner'] debtor_list = api.get('debtors?client_id='+banqup_client_id+'&client_debtor_number='+businessPartner,None,None) #print(debtor_list) + if not debtor_list[2]['results']: + print('***********************') + print('The business partner '+businessPartner+' is not registered in the Banqup portal for the customer '+invoice['response']['data'][0]['businessPartner$_identifier']) + print('Please complete the registration in Banqup and try again.') + print('***********************') + return debtor_id = debtor_list[2]['results'][0]['id'] preferred_channel = debtor_list[2]['results'][0]['preferred_channel']