mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] account_statement_import_online_gocardless: Payment reference extraction
Since one week ago, banks like Sabadell is sending the information in the JSON list `remittanceInformationUnstructuredArray` instead of `remittanceInformationUnstructured`. Thus, we need to parse both for finding the proper element. For the rest that are using the previous one, there's no change. TT47491
This commit is contained in:
committed by
Enric Tobella
parent
9159285be9
commit
b7323eab6b
@@ -306,14 +306,18 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
).get("iban", False)
|
).get("iban", False)
|
||||||
if account_number == own_acc_number:
|
if account_number == own_acc_number:
|
||||||
account_number = False # Discard own bank account number
|
account_number = False # Discard own bank account number
|
||||||
|
if "remittanceInformationUnstructured" in tr:
|
||||||
|
payment_ref = tr["remittanceInformationUnstructured"]
|
||||||
|
elif "remittanceInformationUnstructuredArray" in tr:
|
||||||
|
payment_ref = " ".join(tr["remittanceInformationUnstructuredArray"])
|
||||||
|
else:
|
||||||
|
payment_ref = partner_name
|
||||||
res.append(
|
res.append(
|
||||||
{
|
{
|
||||||
"sequence": sequence,
|
"sequence": sequence,
|
||||||
"date": current_date,
|
"date": current_date,
|
||||||
"ref": partner_name or "/",
|
"ref": partner_name or "/",
|
||||||
"payment_ref": tr.get(
|
"payment_ref": payment_ref,
|
||||||
"remittanceInformationUnstructured", partner_name
|
|
||||||
),
|
|
||||||
"unique_import_id": (
|
"unique_import_id": (
|
||||||
tr.get("entryReference")
|
tr.get("entryReference")
|
||||||
or tr.get("transactionId")
|
or tr.get("transactionId")
|
||||||
|
|||||||
Reference in New Issue
Block a user