read payment info from xml
This commit is contained in:
parent
29f963f9a8
commit
cf98fdf2ad
2 changed files with 65 additions and 0 deletions
58
document.py
58
document.py
|
@ -466,6 +466,64 @@ class Incoming(metaclass=PoolMeta):
|
||||||
if lines_data:
|
if lines_data:
|
||||||
self.parsed_data['lines_data'] = lines_data
|
self.parsed_data['lines_data'] = lines_data
|
||||||
|
|
||||||
|
# payment data
|
||||||
|
xpath_payment = xpath_suppl_chain + [
|
||||||
|
'ram:ApplicableHeaderTradeSettlement']
|
||||||
|
self.parsed_data['payment'] = {}
|
||||||
|
self.parsed_data['payment']['reference'] = self._readxml_getvalue(
|
||||||
|
xmltree, xpath_payment + ['ram:PaymentReference'])
|
||||||
|
self.parsed_data['payment']['currency'] = self._readxml_getvalue(
|
||||||
|
xmltree, xpath_payment + ['ram:InvoiceCurrencyCode'])
|
||||||
|
|
||||||
|
# num bank accounts
|
||||||
|
xpath_bankaccounts = xpath_payment + [
|
||||||
|
'ram:SpecifiedTradeSettlementPaymentMeans']
|
||||||
|
num_bank = len(xmltree.xpath(
|
||||||
|
self._readxml_xpath(xpath_bankaccounts), namespaces=xmltree.nsmap))
|
||||||
|
bank_accounts = []
|
||||||
|
for x in range(num_bank):
|
||||||
|
bank_account = {
|
||||||
|
'info': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts + [x + 1, 'ram:Information']),
|
||||||
|
'type': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts + [x + 1, 'ram:TypeCode']),
|
||||||
|
# debitor
|
||||||
|
'debitor_iban': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:PayerPartyDebtorFinancialAccount',
|
||||||
|
'ram:IBANID']),
|
||||||
|
# creditor
|
||||||
|
'creditor_iban': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:PayeePartyCreditorFinancialAccount',
|
||||||
|
'ram:IBANID']),
|
||||||
|
'creditor_name': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:PayeePartyCreditorFinancialAccount',
|
||||||
|
'ram:AccountName']),
|
||||||
|
# financial card
|
||||||
|
'card_id': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:ApplicableTradeSettlementFinancialCard',
|
||||||
|
'ram:ID']),
|
||||||
|
'card_holder_name': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:ApplicableTradeSettlementFinancialCard',
|
||||||
|
'ram:CardholderName']),
|
||||||
|
# bank name
|
||||||
|
'institution': self._readxml_getvalue(
|
||||||
|
xmltree, xpath_bankaccounts +
|
||||||
|
[x + 1, 'ram:PayeeSpecifiedCreditorFinancialInstitution',
|
||||||
|
'ram:BICID']),
|
||||||
|
}
|
||||||
|
|
||||||
|
# add to list of bank accounts, skip empty values
|
||||||
|
bank_accounts.append({
|
||||||
|
x: bank_account[x]
|
||||||
|
for x in bank_account.keys()
|
||||||
|
if bank_account[x]})
|
||||||
|
if bank_accounts:
|
||||||
|
self.parsed_data['payment']['bank'] = bank_accounts
|
||||||
|
|
||||||
def _readxml_getinvoiceline(self, invoice, line_data):
|
def _readxml_getinvoiceline(self, invoice, line_data):
|
||||||
""" create invoice line in memory
|
""" create invoice line in memory
|
||||||
|
|
|
@ -194,6 +194,13 @@
|
||||||
<ram:IBANID>DE02300209000106531065</ram:IBANID>
|
<ram:IBANID>DE02300209000106531065</ram:IBANID>
|
||||||
<ram:AccountName>mbs</ram:AccountName>
|
<ram:AccountName>mbs</ram:AccountName>
|
||||||
</ram:PayeePartyCreditorFinancialAccount>
|
</ram:PayeePartyCreditorFinancialAccount>
|
||||||
|
<ram:PayerPartyDebtorFinancialAccount>
|
||||||
|
<ram:IBANID>DE02300209000106531065</ram:IBANID>
|
||||||
|
</ram:PayerPartyDebtorFinancialAccount>
|
||||||
|
<ram:ApplicableTradeSettlementFinancialCard>
|
||||||
|
<ram:ID>DE02300209000106531065</ram:ID>
|
||||||
|
<ram:CardholderName>Card Holder</ram:CardholderName>
|
||||||
|
</ram:ApplicableTradeSettlementFinancialCard>
|
||||||
<ram:PayeeSpecifiedCreditorFinancialInstitution>
|
<ram:PayeeSpecifiedCreditorFinancialInstitution>
|
||||||
<ram:BICID>WELADED1PMB</ram:BICID>
|
<ram:BICID>WELADED1PMB</ram:BICID>
|
||||||
</ram:PayeeSpecifiedCreditorFinancialInstitution>
|
</ram:PayeeSpecifiedCreditorFinancialInstitution>
|
||||||
|
|
Loading…
Reference in a new issue