Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/bank-statement-import (17.0) #594

Merged
merged 41 commits into from
Jan 21, 2025

Conversation

bt-admin
Copy link

bt_gitbot

pedrobaeza and others added 30 commits January 19, 2025 22:08
This module provides online bank statements from GoCardless Bank Account
Data, which provides a free API for connecting and getting transactions
for bank accounts.

TT45760

Co-Authored-By: Christopher Ormaza <[email protected]>
Co-Authored-By: Jordi Ballester <[email protected]>
Not all banks provide an entry reference or transaction ID, so we need
to fallback to the Gocardless internal ID for getting the unique ID
in such cases.

TT46640
… company

If the bank account is shared across multiple companies (no assigned company_id),
we can't launch the "Select Bank Account Identifier" wizard, so we fallback
to the journal company for getting the country.

TT43849
…xtraction

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
…rom other provider

Check if there's another provider already linked for the same bank
institution, and if so, reuse it for this bank account, as some banks
don't allow several requisitions from the same source (GoCardless).

TT47944
It turns out that the timeout is for receiving whole answer, so in real
tests, the previous timeout was not enough for getting the answer when
there are some transactions load (like a month).

Let's increase this timeout then to a reasonable amount.
Currently translated at 26.0% (6 of 23 strings)

Translation: bank-statement-import-16.0/bank-statement-import-16.0-account_statement_import_online_gocardless
Translate-URL: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless/es/
Currently translated at 100.0% (23 of 23 strings)

Translation: bank-statement-import-16.0/bank-statement-import-16.0-account_statement_import_online_gocardless
Translate-URL: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless/es/
Currently translated at 100.0% (23 of 23 strings)

Translation: bank-statement-import-16.0/bank-statement-import-16.0-account_statement_import_online_gocardless
Translate-URL: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless/es/
Currently translated at 100.0% (23 of 23 strings)

Translation: bank-statement-import-16.0/bank-statement-import-16.0-account_statement_import_online_gocardless
Translate-URL: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_online_gocardless/es/
… if reusing or not credentials

Some banks only allow one credentials, while others work better with
separate ones, so it's a matter of trying. This commit introduces
a wizard for choosing one method or the other.

TT48828
It is possible that, when making the request to the requisitions endpoint,
the IBAN bank account comes with a lower alphanumeric string.
When comparing with the sanitized bank account (stored with upper) fails.

self.journal_id.bank_account_id.sanitized_acc_number == account_data["iban"]

to

self.journal_id.bank_account_id.sanitized_acc_number == account_data["iban"].upper()

Refactor method _gocardless_finish_requisition to be able to mock the requests made inside and create a unit test.
Refactor requests methods.
…ctoring

After the refactoring in #686, this doesn't work anymore:

- The API URL didn't end in "/", so the join_url doesn't do correctly
  the join.
- There's an infinite loop when getting the headers for getting the
  token.
Some of the API endpoints need it, like token renew. You get if not
405 HTTP code.

It includes also a typo fix in a method name.
@bt-admin bt-admin added the 17.0 label Jan 21, 2025
@bt-admin bt-admin merged commit e27597a into brain-tec:17.0 Jan 21, 2025
4 checks passed
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 60.40000% with 99 lines in your changes missing coverage. Please review.

Project coverage is 86.35%. Comparing base (b92378f) to head (ae4e85a).
Report is 60 commits behind head on 17.0.

Files with missing lines Patch % Lines
...ocardless/models/online_bank_statement_provider.py 50.85% 75 Missing and 11 partials ⚠️
...ement_import_online_gocardless/controllers/main.py 46.66% 8 Missing ⚠️
...wizards/online_bank_statement_provider_existing.py 64.28% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             17.0     #594      +/-   ##
==========================================
- Coverage   88.87%   86.35%   -2.53%     
==========================================
  Files          60       69       +9     
  Lines        2329     2579     +250     
  Branches      276      304      +28     
==========================================
+ Hits         2070     2227     +157     
- Misses        160      245      +85     
- Partials       99      107       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants