[FIX] account_statement_import_online_paypal : search transaction with a 1 second margin to ensure it is found

This commit is contained in:
Florian da Costa
2024-10-21 15:09:50 +02:00
parent 16f9266b9d
commit 849a7ca1ee

View File

@@ -364,14 +364,15 @@ class OnlineBankStatementProviderPayPal(models.Model):
def _paypal_get_transaction(self, token, transaction_id, timestamp): def _paypal_get_transaction(self, token, transaction_id, timestamp):
self.ensure_one() self.ensure_one()
transaction_date = timestamp.isoformat() + "Z" transaction_date_ini = (timestamp - relativedelta(seconds=1)).isoformat() + "Z"
transaction_date_end = (timestamp + relativedelta(seconds=1)).isoformat() + "Z"
url = ( url = (
(self.api_base or PAYPAL_API_BASE) (self.api_base or PAYPAL_API_BASE)
+ "/v1/reporting/transactions" + "/v1/reporting/transactions"
+ ("?start_date=%s" "&end_date=%s" "&fields=all") + ("?start_date=%s" "&end_date=%s" "&fields=all")
% ( % (
transaction_date, transaction_date_ini,
transaction_date, transaction_date_end,
) )
) )
data = self._paypal_retrieve(url, token) data = self._paypal_retrieve(url, token)