-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
[16.0][FIX] account_statement_import_online_gocardless: IBAN comparison #686
[16.0][FIX] account_statement_import_online_gocardless: IBAN comparison #686
Conversation
Hi @pedrobaeza could you take a look please? I've seen that you have recently contributed to the same addon. |
Please don't put Can you please expose the problem this is handling? It should be always put on the initial comment, and also on the commit message. |
I am aware, won't happen again, thank you. |
Hi @pedrobaeza is it ok to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please put the same explanation of the main comment in the commit expanded message (third line after a blank line and following)
account_statement_import_online_gocardless/models/online_bank_statement_provider.py
Outdated
Show resolved
Hide resolved
871e9ae
to
eaac361
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for asking for more modifications, but thinking twice, I think we can refactor this better, having only one method:
def _gocardless_request(self, path):
response = requests.get(
f"{GOCARDLESS_ENDPOINT}/path",
headers=self._gocardless_get_headers(),
timeout=REQUESTS_TIMEOUT,
)
if response.status_code == 200:
return json.loads(response.text)
return {}
and calling it with the multiple variants:
self._gorcardless_request(f"requisitions/{self.gocardless_requisition_id}/")
self._gorcardless_request(f"accounts/{account_id}/")
...
My only doubt is the mock for working properly.
I'll take a look thank you, I think it would be possible rewriting the |
This PR has the |
Any news on this? |
Hi, It's in my queue, but currently drowned on more urgent work, I'll try to take a look this week, sorry for the inconvenience. |
eaac361
to
7354077
Compare
Hi @pedrobaeza sorry for the delay, please take a look and tell me what you think. |
account_statement_import_online_gocardless/models/online_bank_statement_provider.py
Outdated
Show resolved
Hide resolved
7354077
to
c89b0ce
Compare
Please squash comments into one. It's better to amend the previous comment than adding one extra. And finally, |
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.
c89b0ce
to
cd01ed0
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring:
/ocabot merge minor
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 747c454. Thanks a lot for contributing to OCA. ❤️ |
…ctoring After the refactoring in OCA#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.
…ctoring After the refactoring in OCA#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.
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()
I did refactor the method
_gocardless_finish_requisition
to be able to mock the requests made inside and create a unit test.