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)
|
||||
if account_number == own_acc_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(
|
||||
{
|
||||
"sequence": sequence,
|
||||
"date": current_date,
|
||||
"ref": partner_name or "/",
|
||||
"payment_ref": tr.get(
|
||||
"remittanceInformationUnstructured", partner_name
|
||||
),
|
||||
"payment_ref": payment_ref,
|
||||
"unique_import_id": (
|
||||
tr.get("entryReference")
|
||||
or tr.get("transactionId")
|
||||
|
||||
Reference in New Issue
Block a user