44 lines
1.5 KiB
Go
44 lines
1.5 KiB
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
|
|
orchestrationv2 "github.com/tech/sendico/pkg/proto/payments/orchestration/v2"
|
|
)
|
|
|
|
// Fake implements Client for tests.
|
|
type Fake struct {
|
|
ExecutePaymentFn func(ctx context.Context, req *orchestrationv2.ExecutePaymentRequest) (*orchestrationv2.ExecutePaymentResponse, error)
|
|
GetPaymentFn func(ctx context.Context, req *orchestrationv2.GetPaymentRequest) (*orchestrationv2.GetPaymentResponse, error)
|
|
ListPaymentsFn func(ctx context.Context, req *orchestrationv2.ListPaymentsRequest) (*orchestrationv2.ListPaymentsResponse, error)
|
|
CloseFn func() error
|
|
}
|
|
|
|
func (f *Fake) ExecutePayment(ctx context.Context, req *orchestrationv2.ExecutePaymentRequest) (*orchestrationv2.ExecutePaymentResponse, error) {
|
|
if f.ExecutePaymentFn != nil {
|
|
return f.ExecutePaymentFn(ctx, req)
|
|
}
|
|
return &orchestrationv2.ExecutePaymentResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) GetPayment(ctx context.Context, req *orchestrationv2.GetPaymentRequest) (*orchestrationv2.GetPaymentResponse, error) {
|
|
if f.GetPaymentFn != nil {
|
|
return f.GetPaymentFn(ctx, req)
|
|
}
|
|
return &orchestrationv2.GetPaymentResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) ListPayments(ctx context.Context, req *orchestrationv2.ListPaymentsRequest) (*orchestrationv2.ListPaymentsResponse, error) {
|
|
if f.ListPaymentsFn != nil {
|
|
return f.ListPaymentsFn(ctx, req)
|
|
}
|
|
return &orchestrationv2.ListPaymentsResponse{}, nil
|
|
}
|
|
|
|
func (f *Fake) Close() error {
|
|
if f.CloseFn != nil {
|
|
return f.CloseFn()
|
|
}
|
|
return nil
|
|
}
|