mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Rename engine/plugins package to avoid confusion with connector/plugins package * Update instances of plugins to be renamed to connectors * Use Load/Unload for Connectors Manager to avoid confusion with Plugin Registry actions * Add some unit tests for connectors.Manager * Add Config method to Plugin interface * Use validated config instead of raw config for insertion into DB * Update plugin template to include new Config command * Ensure plugin is not nil in workflow unit tests * Small adjustments to e2e test expectations to reflect change in json validation of config * Update codecoverage to exclude new generated files * Guard against nil map in combineConfigs * Update Plugin interface in CONTRIBUTING.md
40 lines
1.1 KiB
Go
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.connectors.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
|
|
}
|