Retrieve debtor_id knowing businessPartner
This commit is contained in:
parent
0486cbef1d
commit
121fffc703
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
config.py
|
||||
*.JSON
|
||||
*.json
|
||||
cache/*.txt
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
|
|
|
@ -14,9 +14,9 @@ def extract_invoice(document):
|
|||
|
||||
response = requests.request("GET", url, headers=headers, data=payload) #extracts invoice header
|
||||
|
||||
#print(response.text)
|
||||
print(response.text)
|
||||
invoice = json.loads(response.text)
|
||||
#print (invoice['response']['data'][0]['client'])
|
||||
print (invoice['response']['data'][0]['businessPartner'])
|
||||
|
||||
url = ob_api_url+"InvoiceLine?_where=invoice='"+invoice['response']['data'][0]['id']+"'&_noActiveFilter=false"
|
||||
|
||||
|
|
28
retrieve_debtor.py
Normal file
28
retrieve_debtor.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import requests
|
||||
from requests_oauthlib import OAuth2Session
|
||||
import json
|
||||
import sys
|
||||
import webbrowser
|
||||
from config import *
|
||||
from cachehandler import CacheHandler
|
||||
from authhandler import AuthHandler
|
||||
from api import OpenbravoToBanqupAPI
|
||||
|
||||
api = OpenbravoToBanqupAPI(bq_client_id,bq_client_secret)
|
||||
authUrl = api.authHandler.getAuthURL(bq_redirect_uri)
|
||||
print(authUrl)
|
||||
webbrowser.open(authUrl)
|
||||
response = input('paste response: ')
|
||||
token = api.authHandler.retrieveToken(response, redirectUri=bq_redirect_uri)
|
||||
print(token)
|
||||
businessPartner='BCD9D8F839AE46BF8481F20A71EF467C'
|
||||
debtor_list = api.get('debtors?client_id='+banqup_client_id+'&client_debtor_number='+businessPartner,None,None)
|
||||
print(debtor_list)
|
||||
print(debtor_list[0])
|
||||
print(debtor_list[1])
|
||||
print(debtor_list[2])
|
||||
print(debtor_list[2]['results'])
|
||||
print(debtor_list[2]['results'][0])
|
||||
print(debtor_list[2]['results'][0]['id'])
|
||||
print(debtor_list[2]['results'][0]['preferred_channel'])
|
||||
|
Loading…
Reference in a new issue