Files
payments/internal/connectors/engine/activities/plugin_verify_webhook.go
Paul NicolasandGitHub 04517d36e0 fix(connectors): fix webhook idempotency key and tests (#445)
* feat(workflows): handle webhook idempotency in a different way

* feat(adyen): add verify webhook and fix tests

* fix(atlar): ensure plugin functions are tested

* fix(bankingcircle): ensure plugin functions are tested

* feat(column): add verify webhook method and fix tests

* fix(currencycloud): ensure plugin functions are tested

* fix(generic): ensure plugin functions are tested

* feat(mangopay): add verify webhook method and fix tests

* fix(modulr): ensure plugin functions are tested

* fix(moneycorp): ensure plugin functions are tested

* fix(stripe): ensure plugin functions are tested

* feat(wise): add verify webhook method and fix tests

* fix dirty

* fix postgres idempotency key

* fix wrong go libs version

* fix coderabbitai

* webhooks failing verification should stop temporal workflow
2025-05-14 15:27:14 +00:00

40 lines
1.1 KiB
Go

package activities
import (
context "context"
"github.com/formancehq/payments/internal/models"
"go.temporal.io/sdk/workflow"
)
type VerifyWebhookRequest struct {
ConnectorID models.ConnectorID
Req models.VerifyWebhookRequest
}
func (a Activities) PluginVerifyWebhook(ctx context.Context, request VerifyWebhookRequest) (*models.VerifyWebhookResponse, error) {
plugin, err := a.plugins.Get(request.ConnectorID)
if err != nil {
return nil, a.temporalPluginError(ctx, err)
}
resp, err := plugin.VerifyWebhook(ctx, request.Req)
if err != nil {
return nil, a.temporalPluginError(ctx, err)
}
return &resp, nil
}
var PluginVerifyWebhookActivity = Activities{}.PluginVerifyWebhook
func PluginVerifyWebhook(ctx workflow.Context, connectorID models.ConnectorID, request models.VerifyWebhookRequest) (*models.VerifyWebhookResponse, error) {
ret := models.VerifyWebhookResponse{}
if err := executeActivity(ctx, PluginVerifyWebhookActivity, &ret, VerifyWebhookRequest{
ConnectorID: connectorID,
Req: request,
}); err != nil {
return nil, err
}
return &ret, nil
}