All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
92 lines
3.5 KiB
Go
92 lines
3.5 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
|
|
ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1"
|
|
)
|
|
|
|
// Fake implements Client for tests.
|
|
type Fake struct {
|
|
CreateAccountFn func(ctx context.Context, req *ledgerv1.CreateAccountRequest) (*ledgerv1.CreateAccountResponse, error)
|
|
ListAccountsFn func(ctx context.Context, req *ledgerv1.ListAccountsRequest) (*ledgerv1.ListAccountsResponse, error)
|
|
PostCreditWithChargesFn func(ctx context.Context, req *ledgerv1.PostCreditRequest) (*ledgerv1.PostResponse, error)
|
|
PostDebitWithChargesFn func(ctx context.Context, req *ledgerv1.PostDebitRequest) (*ledgerv1.PostResponse, error)
|
|
TransferInternalFn func(ctx context.Context, req *ledgerv1.TransferRequest) (*ledgerv1.PostResponse, error)
|
|
ApplyFXWithChargesFn func(ctx context.Context, req *ledgerv1.FXRequest) (*ledgerv1.PostResponse, error)
|
|
GetBalanceFn func(ctx context.Context, req *ledgerv1.GetBalanceRequest) (*ledgerv1.BalanceResponse, error)
|
|
GetJournalEntryFn func(ctx context.Context, req *ledgerv1.GetEntryRequest) (*ledgerv1.JournalEntryResponse, error)
|
|
GetStatementFn func(ctx context.Context, req *ledgerv1.GetStatementRequest) (*ledgerv1.StatementResponse, error)
|
|
CloseFn func() error
|
|
}
|
|
|
|
func (f *Fake) CreateAccount(ctx context.Context, req *ledgerv1.CreateAccountRequest) (*ledgerv1.CreateAccountResponse, error) {
|
|
if f.CreateAccountFn != nil {
|
|
return f.CreateAccountFn(ctx, req)
|
|
}
|
|
return &ledgerv1.CreateAccountResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) ListAccounts(ctx context.Context, req *ledgerv1.ListAccountsRequest) (*ledgerv1.ListAccountsResponse, error) {
|
|
if f.ListAccountsFn != nil {
|
|
return f.ListAccountsFn(ctx, req)
|
|
}
|
|
return &ledgerv1.ListAccountsResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) PostCreditWithCharges(ctx context.Context, req *ledgerv1.PostCreditRequest) (*ledgerv1.PostResponse, error) {
|
|
if f.PostCreditWithChargesFn != nil {
|
|
return f.PostCreditWithChargesFn(ctx, req)
|
|
}
|
|
return &ledgerv1.PostResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) PostDebitWithCharges(ctx context.Context, req *ledgerv1.PostDebitRequest) (*ledgerv1.PostResponse, error) {
|
|
if f.PostDebitWithChargesFn != nil {
|
|
return f.PostDebitWithChargesFn(ctx, req)
|
|
}
|
|
return &ledgerv1.PostResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) TransferInternal(ctx context.Context, req *ledgerv1.TransferRequest) (*ledgerv1.PostResponse, error) {
|
|
if f.TransferInternalFn != nil {
|
|
return f.TransferInternalFn(ctx, req)
|
|
}
|
|
return &ledgerv1.PostResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) ApplyFXWithCharges(ctx context.Context, req *ledgerv1.FXRequest) (*ledgerv1.PostResponse, error) {
|
|
if f.ApplyFXWithChargesFn != nil {
|
|
return f.ApplyFXWithChargesFn(ctx, req)
|
|
}
|
|
return &ledgerv1.PostResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) GetBalance(ctx context.Context, req *ledgerv1.GetBalanceRequest) (*ledgerv1.BalanceResponse, error) {
|
|
if f.GetBalanceFn != nil {
|
|
return f.GetBalanceFn(ctx, req)
|
|
}
|
|
return &ledgerv1.BalanceResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) GetJournalEntry(ctx context.Context, req *ledgerv1.GetEntryRequest) (*ledgerv1.JournalEntryResponse, error) {
|
|
if f.GetJournalEntryFn != nil {
|
|
return f.GetJournalEntryFn(ctx, req)
|
|
}
|
|
return &ledgerv1.JournalEntryResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) GetStatement(ctx context.Context, req *ledgerv1.GetStatementRequest) (*ledgerv1.StatementResponse, error) {
|
|
if f.GetStatementFn != nil {
|
|
return f.GetStatementFn(ctx, req)
|
|
}
|
|
return &ledgerv1.StatementResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) Close() error {
|
|
if f.CloseFn != nil {
|
|
return f.CloseFn()
|
|
}
|
|
return nil
|
|
}
|