menu-voucherlist #101
@ -25,7 +25,7 @@ type AccountServiceInterface interface {
|
|||||||
CreateAccount(ctx context.Context) (*api.OKResponse, error)
|
CreateAccount(ctx context.Context) (*api.OKResponse, error)
|
||||||
CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResponse, error)
|
CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResponse, error)
|
||||||
TrackAccountStatus(ctx context.Context, publicKey string) (*api.OKResponse, 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 {
|
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
|
// FetchVouchers retrieves the token holdings for a given public key from the custodial holdings API endpoint
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - publicKey: The public key associated with the account.
|
// - 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")
|
file, err := os.Open("sample_tokens.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -245,7 +245,7 @@ func (tas *TestAccountService) CheckAccountStatus(ctx context.Context, trackingI
|
|||||||
return trackResponse, nil
|
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{
|
return &models.VoucherHoldingResponse{
|
||||||
Ok: true,
|
Ok: true,
|
||||||
Result: struct {
|
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
|
// 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 {
|
if err != nil {
|
||||||
return res, 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
|
// 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 {
|
if err != nil {
|
||||||
return res, 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)
|
args := m.Called(publicKey)
|
||||||
return args.Get(0).(*models.VoucherHoldingResponse), args.Error(1)
|
return args.Get(0).(*models.VoucherHoldingResponse), args.Error(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user