Catch missing business partner in Banqup portal and present correct message

This commit is contained in:
Enrique Barcelli 2023-06-25 01:57:20 +08:00
parent 00c4c3ca9c
commit f2c1aba75a
Signed by: kikobar
GPG key ID: 006C13A68E25D3B7

View file

@ -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']