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