mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* chore: rename RunNextTasks workflow * feat: added a trimmed down type for connector only containing the id * feat: make runNextTask use connectorIdOnly * feat: added isScheduledForDeletion to plugin interface * feat: add scheduledForDeletion at plugin level * feat: refactor manager.Load to take a connector instead of parts of it * feat: saves the connector's scheduledFOrDeletion into the plugin * feat: use plugin.IsScheduledForDeletion instead of loading connector * fix: make e2e tests less flaky * fix: remove config from most request types * feat: (WIP) remove config from runNextTask * fix: remove unneeded method definitions in each plugin * fix: simplify RunNextFlow as anyway we need to change the parameters * fix: add a workflow compatible with previous version for runNextTasks * fix(EN-577): added back RunSendEvents as a deprecated workflow * fix(EN-577): added back RunUpdatePaymentInitiationFromPayment as a deprecated workflow * fix: fix linting directives * fix: replace old usage with refactored one * fix: added back missing deprecated activities * fix: ensure fetch_next_balance works with v3.0 code * fix: simplify a bit the versionning etc * fix: quick refactor before applying solution elsewhere * fix: add back RunSendEvents and RunNextTask child workflows where necessary for backward compatibility * fix: add back missing activity, seems like it's mandatory? * fix: run payment initiation update as child workflow when necessary * fix: missing activy call in test, refine some todos * fix: lint * fix: ensure we always reload plugins into the manager -- so exposing isScheduledForDeletion * fix: ensure we stop storing clear config in temporal * fix: make store config support plain text config * fix: some comments * fix: change runSendEvent workflow to be match what we had in 3.0 * feat: enable worker versionning to avoid workflow from new version to get executed on old code * fix: lint * fix: revert worker versionning * fix: minor code review comments * fix: add context to Encrypt & Decrypt methods * fix: improve lint, add couple tests * fix: use atomic to handle isScheduledForDeletion * fix: make create_events work on migration * fix: avoid returning channel; just send what is needed in runSendEventAsChildWorkflow and runNextTaskAsChildWorkflow * fix: remove extra call to installWorkflow on start plugin * fix: typo in error log line * fix: simplify errChan initialization * fix: clarify feature flag names
138 lines
5.6 KiB
Go
138 lines
5.6 KiB
Go
package plugins
|
|
|
|
import (
|
|
"context"
|
|
"sync/atomic"
|
|
|
|
"github.com/formancehq/payments/internal/models"
|
|
)
|
|
|
|
type basePlugin struct {
|
|
isScheduledForDeletion atomic.Bool
|
|
}
|
|
|
|
func NewBasePlugin() models.Plugin {
|
|
return &basePlugin{}
|
|
}
|
|
|
|
func (dp *basePlugin) Name() string {
|
|
return "default"
|
|
}
|
|
|
|
func (dp *basePlugin) IsScheduledForDeletion() bool {
|
|
return dp.isScheduledForDeletion.Load()
|
|
}
|
|
|
|
func (dp *basePlugin) ScheduleForDeletion(isScheduledForDeletion bool) {
|
|
dp.isScheduledForDeletion.Store(isScheduledForDeletion)
|
|
}
|
|
|
|
func (dp *basePlugin) Config() models.PluginInternalConfig {
|
|
return struct{}{}
|
|
}
|
|
|
|
func (dp *basePlugin) Install(ctx context.Context, req models.InstallRequest) (models.InstallResponse, error) {
|
|
return models.InstallResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) Uninstall(ctx context.Context, req models.UninstallRequest) (models.UninstallResponse, error) {
|
|
return models.UninstallResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) FetchNextAccounts(ctx context.Context, req models.FetchNextAccountsRequest) (models.FetchNextAccountsResponse, error) {
|
|
return models.FetchNextAccountsResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) FetchNextBalances(ctx context.Context, req models.FetchNextBalancesRequest) (models.FetchNextBalancesResponse, error) {
|
|
return models.FetchNextBalancesResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) FetchNextExternalAccounts(ctx context.Context, req models.FetchNextExternalAccountsRequest) (models.FetchNextExternalAccountsResponse, error) {
|
|
return models.FetchNextExternalAccountsResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) FetchNextPayments(ctx context.Context, req models.FetchNextPaymentsRequest) (models.FetchNextPaymentsResponse, error) {
|
|
return models.FetchNextPaymentsResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) FetchNextOthers(ctx context.Context, req models.FetchNextOthersRequest) (models.FetchNextOthersResponse, error) {
|
|
return models.FetchNextOthersResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreateBankAccount(ctx context.Context, req models.CreateBankAccountRequest) (models.CreateBankAccountResponse, error) {
|
|
return models.CreateBankAccountResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreateTransfer(ctx context.Context, req models.CreateTransferRequest) (models.CreateTransferResponse, error) {
|
|
return models.CreateTransferResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) ReverseTransfer(ctx context.Context, req models.ReverseTransferRequest) (models.ReverseTransferResponse, error) {
|
|
return models.ReverseTransferResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) PollTransferStatus(ctx context.Context, req models.PollTransferStatusRequest) (models.PollTransferStatusResponse, error) {
|
|
return models.PollTransferStatusResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreatePayout(ctx context.Context, req models.CreatePayoutRequest) (models.CreatePayoutResponse, error) {
|
|
return models.CreatePayoutResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) ReversePayout(ctx context.Context, req models.ReversePayoutRequest) (models.ReversePayoutResponse, error) {
|
|
return models.ReversePayoutResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) PollPayoutStatus(ctx context.Context, req models.PollPayoutStatusRequest) (models.PollPayoutStatusResponse, error) {
|
|
return models.PollPayoutStatusResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreateWebhooks(ctx context.Context, req models.CreateWebhooksRequest) (models.CreateWebhooksResponse, error) {
|
|
return models.CreateWebhooksResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) TrimWebhook(ctx context.Context, req models.TrimWebhookRequest) (models.TrimWebhookResponse, error) {
|
|
// Base implementation is to return the webhook as is
|
|
return models.TrimWebhookResponse{
|
|
Webhooks: []models.PSPWebhook{req.Webhook},
|
|
}, nil
|
|
}
|
|
|
|
func (dp *basePlugin) VerifyWebhook(ctx context.Context, req models.VerifyWebhookRequest) (models.VerifyWebhookResponse, error) {
|
|
return models.VerifyWebhookResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) TranslateWebhook(ctx context.Context, req models.TranslateWebhookRequest) (models.TranslateWebhookResponse, error) {
|
|
return models.TranslateWebhookResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreateUser(ctx context.Context, req models.CreateUserRequest) (models.CreateUserResponse, error) {
|
|
return models.CreateUserResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CreateUserLink(ctx context.Context, req models.CreateUserLinkRequest) (models.CreateUserLinkResponse, error) {
|
|
return models.CreateUserLinkResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CompleteUserLink(ctx context.Context, req models.CompleteUserLinkRequest) (models.CompleteUserLinkResponse, error) {
|
|
return models.CompleteUserLinkResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) UpdateUserLink(ctx context.Context, req models.UpdateUserLinkRequest) (models.UpdateUserLinkResponse, error) {
|
|
return models.UpdateUserLinkResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) CompleteUpdateUserLink(ctx context.Context, req models.CompleteUpdateUserLinkRequest) (models.CompleteUpdateUserLinkResponse, error) {
|
|
return models.CompleteUpdateUserLinkResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) DeleteUserConnection(ctx context.Context, req models.DeleteUserConnectionRequest) (models.DeleteUserConnectionResponse, error) {
|
|
return models.DeleteUserConnectionResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
func (dp *basePlugin) DeleteUser(ctx context.Context, req models.DeleteUserRequest) (models.DeleteUserResponse, error) {
|
|
return models.DeleteUserResponse{}, ErrNotImplemented
|
|
}
|
|
|
|
var _ models.Plugin = &basePlugin{}
|