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
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package activities
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/formancehq/payments/internal/models"
|
|
"go.temporal.io/sdk/workflow"
|
|
)
|
|
|
|
type ReversePayoutRequest struct {
|
|
ConnectorID models.ConnectorID
|
|
Req models.ReversePayoutRequest
|
|
}
|
|
|
|
func (a Activities) PluginReversePayout(ctx context.Context, request ReversePayoutRequest) (*models.ReversePayoutResponse, error) {
|
|
plugin, err := a.connectors.Get(request.ConnectorID)
|
|
if err != nil {
|
|
return nil, a.temporalPluginError(ctx, err)
|
|
}
|
|
|
|
resp, err := plugin.ReversePayout(ctx, request.Req)
|
|
if err != nil {
|
|
return nil, a.temporalPluginError(ctx, err)
|
|
}
|
|
|
|
return &resp, nil
|
|
}
|
|
|
|
var PluginReversePayoutActivity = Activities{}.PluginReversePayout
|
|
|
|
func PluginReversePayout(ctx workflow.Context, connectorID models.ConnectorID, request models.ReversePayoutRequest) (*models.ReversePayoutResponse, error) {
|
|
ret := models.ReversePayoutResponse{}
|
|
if err := executeActivity(ctx, PluginReversePayoutActivity, &ret, ReversePayoutRequest{
|
|
ConnectorID: connectorID,
|
|
Req: request,
|
|
}); err != nil {
|
|
return nil, err
|
|
}
|
|
return &ret, nil
|
|
}
|