X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=api%2Fmarket_config.go;h=d5f05d9743df29c178d3eddd325003e3588697a3;hb=73bad1e9ec3c0981151ead328b8f955c70f07429;hp=c7e2e15428b181eb46f48260e852935dea2b0e6b;hpb=4495b984d3e60874281f37cdb2dbe2cf1c3874ab;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/api/market_config.go b/api/market_config.go index c7e2e15..d5f05d9 100644 --- a/api/market_config.go +++ b/api/market_config.go @@ -80,7 +80,7 @@ func (q TestMarketCredentialsQuery) Run() (interface{}, *Error) { } resultErr := CallExternalService(fmt.Sprintf("'%s' TestCredentials", q.In.Market), EXTERNAL_SERVICE_TIMEOUT_SECONDS*time.Second, func() error { - err := Poloniex.TestCredentials(config.Config["key"], config.Config["secret"]) + err := Poloniex.TestCredentials(config.Config["key"], config.Config["secret"], EXTERNAL_SERVICE_TIMEOUT_SECONDS) if utils.ErrIs(err, markets.InvalidCredentials) { return &Error{InvalidMarketCredentials, "wrong market credentials", fmt.Errorf("wrong '%v' market credentials", q.In.Market)} @@ -105,6 +105,8 @@ func (q TestMarketCredentialsQuery) Run() (interface{}, *Error) { return nil, NewInternalError(resultErr) } else if resultErr != nil { return nil, NewInternalError(resultErr) + } else if resultErr == nil { + newStatus = db.MarketConfigEnabled } if newStatus != config.Status { @@ -152,7 +154,7 @@ func (q UpdateMarketConfigQuery) Run() (interface{}, *Error) { } resultErr := CallExternalService(fmt.Sprintf("'%s' TestCredentials", q.In.Market), EXTERNAL_SERVICE_TIMEOUT_SECONDS*time.Second, func() error { - err := Poloniex.TestCredentials(marketConfig.Config["key"], marketConfig.Config["secret"]) + err := Poloniex.TestCredentials(marketConfig.Config["key"], marketConfig.Config["secret"], EXTERNAL_SERVICE_TIMEOUT_SECONDS) if utils.ErrIs(err, markets.InvalidCredentials) { return &Error{InvalidMarketCredentials, "wrong market credentials", fmt.Errorf("wrong '%v' market credentials", q.In.Market)}