api-structs #117
@ -11,7 +11,7 @@ var (
|
|||||||
|
|
||||||
// LoadConfig initializes the configuration values after environment variables are loaded.
|
// LoadConfig initializes the configuration values after environment variables are loaded.
|
||||||
func LoadConfig() {
|
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/")
|
TrackStatusURL = initializers.GetEnv("TRACK_STATUS_URL", "https://custodial.sarafu.africa/api/track/")
|
||||||
BalanceURL = initializers.GetEnv("BALANCE_URL", "https://custodial.sarafu.africa/api/account/status/")
|
BalanceURL = initializers.GetEnv("BALANCE_URL", "https://custodial.sarafu.africa/api/account/status/")
|
||||||
TrackURL = initializers.GetEnv("TRACK_URL", "http://localhost:5003/api/v2/account/status")
|
TrackURL = initializers.GetEnv("TRACK_URL", "http://localhost:5003/api/v2/account/status")
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
var (
|
var (
|
||||||
okResponse api.OKResponse
|
okResponse api.OKResponse
|
||||||
errResponse api.ErrResponse
|
errResponse api.ErrResponse
|
||||||
EMPTY_RESPONSE = 0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AccountServiceInterface interface {
|
type AccountServiceInterface interface {
|
||||||
@ -93,7 +92,7 @@ func (as *AccountService) TrackAccountStatus(publicKey string) (*api.OKResponse,
|
|||||||
}
|
}
|
||||||
return nil, errors.New(errResponse.Description)
|
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 nil, errors.New("Empty api result")
|
||||||
}
|
}
|
||||||
return &okResponse, nil
|
return &okResponse, nil
|
||||||
@ -150,6 +149,7 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = json.Unmarshal([]byte(body), &okResponse)
|
err = json.Unmarshal([]byte(body), &okResponse)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := json.Unmarshal([]byte(body), &errResponse)
|
err := json.Unmarshal([]byte(body), &errResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -157,7 +157,7 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) {
|
|||||||
}
|
}
|
||||||
return nil, errors.New(errResponse.Description)
|
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 nil, errors.New("Empty api result")
|
||||||
}
|
}
|
||||||
return &okResponse, nil
|
return &okResponse, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user