Files
CrimsonandGitHub c48bb246b5 feat(Stripe): EN-470 Add balance.available webhooks to Stripe connector (#590)
* Implement Balances Webhooks in Stripe to reduce polling workflows

* Create webhooks on install

* Remove webhook at uninstall time

* Add verifyWebhook function to Stripe

* Pin APIVersion in Stripe Webhook Create call

* Default to root account when receiving balance.update webhook

* Only make call do delete webhooks if webhooks were setup to begin with

* Set up two webhook endpoints - one for connect and one for root account

* Use event.Created to determine balance time in Stripe webhooks

* Start recording root account ID instead of dummy 'root' value

* Create unit test for Stripe create webhooks

* Add tests for Stripe Translate webhook

* Share logic between Stripe balance polling and webhook handle

* Use supported webhooks map

* Update existing stripe webhooks instead of creating new ones at app start time

* Run install sequence for each connector at app start of payments api pods

* Turn of balances periodically for Stripe

* Add nil checks for balance.Available

* Remove potentially sensitive information from error message

* Add migration tool to remove FETCH BALANCES schedules from stripe
2025-11-21 10:25:52 +00:00

40 lines
1005 B
Go

package stripe
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: false,
NextTasks: []models.ConnectorTaskTree{},
},
{
TaskType: models.TASK_FETCH_PAYMENTS,
Name: "fetch_payments",
Periodically: true,
NextTasks: []models.ConnectorTaskTree{},
},
{
TaskType: models.TASK_FETCH_EXTERNAL_ACCOUNTS,
Name: "fetch_recipients",
Periodically: true,
NextTasks: []models.ConnectorTaskTree{},
},
},
},
{
TaskType: models.TASK_CREATE_WEBHOOKS,
Name: "create_webhooks",
Periodically: false,
NextTasks: []models.ConnectorTaskTree{},
},
}
}