update test account service

This commit is contained in:
Carlosokumu 2024-10-25 09:36:43 +03:00
parent 2b34b3a75c
commit a3be98c514
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -1,31 +1,29 @@
package testservice package testservice
import ( import (
"context"
"encoding/json" "encoding/json"
"time" "time"
"git.grassecon.net/urdt/ussd/internal/models" "git.grassecon.net/urdt/ussd/internal/models"
"github.com/grassrootseconomics/eth-custodial/pkg/api"
) )
type TestAccountService struct { type TestAccountService struct {
} }
func (tas *TestAccountService) CreateAccount() (*models.AccountResponse, error) { func (tas *TestAccountService) CreateAccount(ctx context.Context) (*api.OKResponse, error) {
return &models.AccountResponse{ return &api.OKResponse{
Ok: true, Ok: true,
Result: struct { Description: "Account creation succeeded",
CustodialId json.Number `json:"custodialId"` Result: map[string]any{
PublicKey string `json:"publicKey"` "trackingId": "075ccc86-f6ef-4d33-97d5-e91cfb37aa0d",
TrackingId string `json:"trackingId"` "publicKey": "0x623EFAFa8868df4B934dd12a8B26CB3Dd75A7AdD",
}{
CustodialId: json.Number("182"),
PublicKey: "0x48ADca309b5085852207FAaf2816eD72B52F527C",
TrackingId: "28ebe84d-b925-472c-87ae-bbdfa1fb97be",
}, },
}, nil }, nil
} }
func (tas *TestAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) { func (tas *TestAccountService) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResponse, error) {
balanceResponse := &models.BalanceResponse{ balanceResponse := &models.BalanceResponse{
Ok: true, Ok: true,
Result: struct { Result: struct {
@ -40,7 +38,7 @@ func (tas *TestAccountService) CheckBalance(publicKey string) (*models.BalanceRe
return balanceResponse, nil return balanceResponse, nil
} }
func (tas *TestAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) { func (tas *TestAccountService) CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResponse, error) {
trackResponse := &models.TrackStatusResponse{ trackResponse := &models.TrackStatusResponse{
Ok: true, Ok: true,
Result: struct { Result: struct {
@ -63,3 +61,13 @@ func (tas *TestAccountService) CheckAccountStatus(trackingId string) (*models.Tr
} }
return trackResponse, nil return trackResponse, nil
} }
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
}