mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat(*): add tink bank bridge * add tests * fix tink calls * fixes after review * fixes after review again * add const for actor id * fix missing psuID * fix tests * cancel payments instead
33 lines
817 B
Go
33 lines
817 B
Go
package tink
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/formancehq/payments/internal/connectors/plugins/public/tink/client"
|
|
"github.com/formancehq/payments/internal/models"
|
|
)
|
|
|
|
func validateDeleteUserRequest(req models.DeleteUserRequest) error {
|
|
if req.PaymentServiceUser == nil {
|
|
return fmt.Errorf("paymentServiceUser is required: %w", models.ErrInvalidRequest)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (p *Plugin) deleteUser(ctx context.Context, req models.DeleteUserRequest) (models.DeleteUserResponse, error) {
|
|
if err := validateDeleteUserRequest(req); err != nil {
|
|
return models.DeleteUserResponse{}, err
|
|
}
|
|
|
|
err := p.client.DeleteUser(ctx, client.DeleteUserRequest{
|
|
UserID: req.PaymentServiceUser.ID.String(),
|
|
})
|
|
if err != nil {
|
|
return models.DeleteUserResponse{}, err
|
|
}
|
|
|
|
return models.DeleteUserResponse{}, nil
|
|
}
|