menu-voucherlist #101
@ -25,7 +25,7 @@ type AccountServiceInterface interface {
|
||||
CreateAccount(ctx context.Context) (*api.OKResponse, error)
|
||||
CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResponse, error)
|
||||
TrackAccountStatus(ctx context.Context, publicKey string) (*api.OKResponse, error)
|
||||
FetchVouchers(publicKey string) (*models.VoucherHoldingResponse, error)
|
||||
FetchVouchers(ctx context.Context, publicKey string) (*models.VoucherHoldingResponse, error)
|
||||
}
|
||||
|
||||
type AccountService struct {
|
||||
@ -174,7 +174,7 @@ func (as *AccountService) CreateAccount(ctx context.Context) (*api.OKResponse, e
|
||||
// FetchVouchers retrieves the token holdings for a given public key from the custodial holdings API endpoint
|
||||
// Parameters:
|
||||
// - publicKey: The public key associated with the account.
|
||||
func (as *AccountService) FetchVouchers(publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
func (as *AccountService) FetchVouchers(ctx context.Context, publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
file, err := os.Open("sample_tokens.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -245,7 +245,7 @@ func (tas *TestAccountService) CheckAccountStatus(ctx context.Context, trackingI
|
||||
return trackResponse, nil
|
||||
}
|
||||
|
||||
func (tas *TestAccountService) FetchVouchers(publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
func (tas *TestAccountService) FetchVouchers(ctx context.Context, publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
return &models.VoucherHoldingResponse{
|
||||
Ok: true,
|
||||
Result: struct {
|
||||
|
@ -1035,7 +1035,7 @@ func (h *Handlers) SetDefaultVoucher(ctx context.Context, sym string, input []by
|
||||
}
|
||||
|
||||
// Fetch vouchers from the API using the public key
|
||||
vouchersResp, err := h.accountService.FetchVouchers(string(publicKey))
|
||||
vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey))
|
||||
if err != nil {
|
||||
return res, nil
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ func (h *Handlers) CheckVouchers(ctx context.Context, sym string, input []byte)
|
||||
}
|
||||
|
||||
// Fetch vouchers from the API using the public key
|
||||
vouchersResp, err := h.accountService.FetchVouchers(string(publicKey))
|
||||
vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey))
|
||||
if err != nil {
|
||||
return res, nil
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func (m *MockAccountService) TrackAccountStatus(ctx context.Context,publicKey st
|
||||
}
|
||||
|
||||
|
||||
func (m *MockAccountService) FetchVouchers(publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
func (m *MockAccountService) FetchVouchers(ctx context.Context, publicKey string) (*models.VoucherHoldingResponse, error) {
|
||||
args := m.Called(publicKey)
|
||||
return args.Get(0).(*models.VoucherHoldingResponse), args.Error(1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user