ussd/internal/testutil/testservice/TestAccountService.go

61 lines
1.7 KiB
Go
Raw Normal View History

2024-10-21 15:47:00 +02:00
package testservice
import (
2024-10-25 08:36:43 +02:00
"context"
2024-10-21 15:47:00 +02:00
"encoding/json"
"time"
"git.grassecon.net/urdt/ussd/internal/models"
2024-10-25 08:36:43 +02:00
"github.com/grassrootseconomics/eth-custodial/pkg/api"
2024-10-30 16:30:55 +01:00
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
2024-10-21 15:47:00 +02:00
)
type TestAccountService struct {
}
2024-10-31 02:28:37 +01:00
func (tas *TestAccountService) CreateAccount(ctx context.Context) (*models.AccountResult, error) {
return &models.AccountResult {
TrackingId: "075ccc86-f6ef-4d33-97d5-e91cfb37aa0d",
PublicKey: "0x623EFAFa8868df4B934dd12a8B26CB3Dd75A7AdD",
2024-10-21 15:47:00 +02:00
}, nil
}
2024-10-31 02:28:37 +01:00
func (tas *TestAccountService) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error) {
balanceResponse := &models.BalanceResult {
Balance: "0.003 CELO",
Nonce: json.Number("0"),
2024-10-21 15:47:00 +02:00
}
return balanceResponse, nil
}
2024-10-31 02:28:37 +01:00
func (tas *TestAccountService) CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResult, error) {
return &models.TrackStatusResult {
CreatedAt: time.Now(),
Status: "SUCCESS",
TransferValue: json.Number("0.5"),
TxHash: "0x123abc456def",
TxType: "transfer",
}, nil
2024-10-21 15:47:00 +02:00
}
2024-10-25 08:36:43 +02:00
func (tas *TestAccountService) TrackAccountStatus(ctx context.Context, publicKey string) (*api.OKResponse, error) {
return &api.OKResponse{
Ok: true,
Description: "Account creation succeeded",
Result: map[string]any{
"active": true,
},
}, nil
}
2024-10-25 17:01:52 +02:00
2024-10-31 02:28:37 +01:00
func (tas *TestAccountService) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
return []dataserviceapi.TokenHoldings {
dataserviceapi.TokenHoldings {
ContractAddress: "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
TokenSymbol: "SRF",
TokenDecimals: "6",
Balance: "2745987",
2024-10-25 17:01:52 +02:00
},
2024-10-31 02:28:37 +01:00
}, nil
2024-10-25 17:01:52 +02:00
}