From abc01b7cee44a3bf39f2874b9a0f787b663c8de1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 24 Oct 2024 16:21:34 +0300 Subject: [PATCH] change to local setup endpoint --- config/config.go | 2 +- internal/handlers/server/accountservice.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 43466c3..0ba88a4 100644 --- a/config/config.go +++ b/config/config.go @@ -11,7 +11,7 @@ var ( // LoadConfig initializes the configuration values after environment variables are loaded. func LoadConfig() { - CreateAccountURL = initializers.GetEnv("CREATE_ACCOUNT_URL", "http://localhost:5003/api/v2/account/create") + CreateAccountURL = initializers.GetEnv("CREATE_ACCOUNT_URL", "http://localhost:5003/api/v2/account/creates") TrackStatusURL = initializers.GetEnv("TRACK_STATUS_URL", "https://custodial.sarafu.africa/api/track/") BalanceURL = initializers.GetEnv("BALANCE_URL", "https://custodial.sarafu.africa/api/account/status/") TrackURL = initializers.GetEnv("TRACK_URL", "http://localhost:5003/api/v2/account/status") diff --git a/internal/handlers/server/accountservice.go b/internal/handlers/server/accountservice.go index 6ae9630..9534520 100644 --- a/internal/handlers/server/accountservice.go +++ b/internal/handlers/server/accountservice.go @@ -14,9 +14,8 @@ import ( ) var ( - okResponse api.OKResponse - errResponse api.ErrResponse - EMPTY_RESPONSE = 0 + okResponse api.OKResponse + errResponse api.ErrResponse ) type AccountServiceInterface interface { @@ -93,7 +92,7 @@ func (as *AccountService) TrackAccountStatus(publicKey string) (*api.OKResponse, } return nil, errors.New(errResponse.Description) } - if len(okResponse.Result) == EMPTY_RESPONSE { + if len(okResponse.Result) == 0 { return nil, errors.New("Empty api result") } return &okResponse, nil @@ -150,6 +149,7 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) { return nil, err } err = json.Unmarshal([]byte(body), &okResponse) + if err != nil { err := json.Unmarshal([]byte(body), &errResponse) if err != nil { @@ -157,7 +157,7 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) { } return nil, errors.New(errResponse.Description) } - if len(okResponse.Result) == EMPTY_RESPONSE { + if len(okResponse.Result) == 0 { return nil, errors.New("Empty api result") } return &okResponse, nil