mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* fix(coinbaseprime): avoid refetching payments on every account fetch TASK_FETCH_PAYMENTS was a child of TASK_FETCH_ACCOUNTS, so payments were re-fetched from scratch on every account sync cycle. Moving it to a top-level sibling task makes it run independently on its own schedule instead of being triggered by every account fetch. Backport of fix from PR #657 (fd62842). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(coinbaseprime): fix cursor reset causing full refetch on every cycle Without advanceCursor, when Coinbase returns an empty next_cursor at end-of-pagination the state was reset to an empty cursor, causing the next run to refetch all transactions from the beginning. - Extract paymentsState into shared incrementalState in state.go - Introduce advanceCursor: keep the previous cursor when next_cursor is empty so the pagination marker is never wiped Backport of fix from PR #657 (fd62842). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * test(coinbaseprime): add unit tests for advanceCursor Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
28 lines
655 B
Go
28 lines
655 B
Go
package coinbaseprime
|
|
|
|
import "github.com/formancehq/payments/internal/models"
|
|
|
|
func workflow() models.ConnectorTasksTree {
|
|
return []models.ConnectorTaskTree{
|
|
{
|
|
TaskType: models.TASK_FETCH_ACCOUNTS,
|
|
Name: "fetch_accounts",
|
|
Periodically: true,
|
|
NextTasks: []models.ConnectorTaskTree{
|
|
{
|
|
TaskType: models.TASK_FETCH_BALANCES,
|
|
Name: "fetch_balances",
|
|
Periodically: true,
|
|
NextTasks: []models.ConnectorTaskTree{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
TaskType: models.TASK_FETCH_PAYMENTS,
|
|
Name: "fetch_payments",
|
|
Periodically: true,
|
|
NextTasks: []models.ConnectorTaskTree{},
|
|
},
|
|
}
|
|
}
|