Maintainers
This module is maintained by the OCA.
- + + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
diff --git a/account_payment_plaid/models/plaid_interface.py b/account_payment_plaid/models/plaid_interface.py index 24430bc5551..8b54d95dccb 100644 --- a/account_payment_plaid/models/plaid_interface.py +++ b/account_payment_plaid/models/plaid_interface.py @@ -31,8 +31,11 @@ from plaid.model.transfer_create_request import TransferCreateRequest from plaid.model.transfer_event_sync_request import TransferEventSyncRequest from plaid.model.transfer_failure import TransferFailure + from plaid.model.transfer_get_request import TransferGetRequest from plaid.model.transfer_network import TransferNetwork from plaid.model.transfer_type import TransferType + + except (ImportError, IOError) as err: _logger.debug(err) @@ -130,14 +133,37 @@ def _transfer( return response.to_dict()["transfer"] def _sync_transfer_events(self, client): - request = TransferEventSyncRequest(after_id=4, count=25) + request = TransferEventSyncRequest(after_id=0, count=25) + events = [] try: response = client.transfer_event_sync(request) + events.extend(response.to_dict()["transfer_events"]) except plaid.ApiException as e: raise ValidationError( _("Error syncing transfer events: %s") % e.body ) from e - return response.to_dict()["transfer_events"] + + has_more = response.to_dict().get("has_more", False) + while has_more: + request = TransferEventSyncRequest(after_id=len(events), count=25) + try: + response = client.transfer_event_sync(request) + has_more = response.to_dict().get("has_more", False) + except plaid.ApiException as e: + raise ValidationError( + _("Error syncing transfer events: %s") % e.body + ) from e + events.extend(response.to_dict()["transfer_events"]) + return events + + def _get_transfer(self, client, transfer_id): + request = TransferGetRequest(transfer_id=transfer_id) + + try: + response = client.transfer_get(request) + except plaid.ApiException as e: + raise ValidationError(_("Error getting transfer: %s") % e.body) from e + return response.to_dict() ############################ # Sandbox Transfer Methods # diff --git a/account_payment_plaid/models/plaid_transfer.py b/account_payment_plaid/models/plaid_transfer.py index e347af7ec4d..e8d492b35af 100644 --- a/account_payment_plaid/models/plaid_transfer.py +++ b/account_payment_plaid/models/plaid_transfer.py @@ -71,6 +71,7 @@ def cron_sync_transfer_events(self): transfer_ids = self.search( [("name", "in", events), ("state", "!=", "settled")] ) + if transfer_ids: transfer_ids.write({"state": event_type}) if event_type == "settled": diff --git a/account_payment_plaid/models/res_company.py b/account_payment_plaid/models/res_company.py index 15e9cd2ea94..d1614c09fd6 100644 --- a/account_payment_plaid/models/res_company.py +++ b/account_payment_plaid/models/res_company.py @@ -12,7 +12,6 @@ class ResCompany(models.Model): ("sand", _("Sandbox")), ("prod", _("Production")), ], - default="sand", ) plaid_access_token = fields.Char(string="Access Token") diff --git a/account_payment_plaid/models/res_config_settings.py b/account_payment_plaid/models/res_config_settings.py index 7fe89303ff2..7a00480dacb 100644 --- a/account_payment_plaid/models/res_config_settings.py +++ b/account_payment_plaid/models/res_config_settings.py @@ -17,21 +17,17 @@ class ResConfigSettings(models.TransientModel): readonly=False, related="company_id.plaid_client_id", string="Client ID", - config_parameter="plaid_connector.plaid_client_id", ) plaid_secret = fields.Char( string="Secret", readonly=False, related="company_id.plaid_secret", - config_parameter="plaid_connector.plaid_secret", ) plaid_host = fields.Selection( string="Host", readonly=False, - default="sand", related="company_id.plaid_host", - config_parameter="plaid_connector.plaid_host", ) plaid_access_token = fields.Char( diff --git a/account_payment_plaid/static/description/index.html b/account_payment_plaid/static/description/index.html index 0e5c8b883e8..8f90a50bf8a 100644 --- a/account_payment_plaid/static/description/index.html +++ b/account_payment_plaid/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -440,7 +441,9 @@
This module is maintained by the OCA.
- + + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.