mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Revert SureTax tests to generic ones
This commit is contained in:
@@ -172,7 +172,6 @@ type STTaxItem struct {
|
||||
}
|
||||
|
||||
func SureTaxProcessCdr(cdr *StoredCdr) error {
|
||||
fmt.Printf("SureTaxProcessCdr, cdr: %+v\n", cdr)
|
||||
stCfg := config.CgrConfig().SureTaxCfg()
|
||||
if stCfg == nil {
|
||||
return errors.New("Invalid SureTax configuration")
|
||||
@@ -191,7 +190,7 @@ func SureTaxProcessCdr(cdr *StoredCdr) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("NewSureTaxRequest: %s\n", string(jsnContent))
|
||||
utils.Logger.Debug(fmt.Sprintf("NewSureTaxRequest: %s\n", string(jsnContent)))
|
||||
resp, err := sureTaxClient.Post(stCfg.Url, "application/json", bytes.NewBuffer(jsnContent))
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -199,19 +198,19 @@ func SureTaxProcessCdr(cdr *StoredCdr) error {
|
||||
defer resp.Body.Close()
|
||||
respBody, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
fmt.Printf("Unexpected response body received, error: %s\n", err.Error())
|
||||
utils.Logger.Debug(fmt.Sprintf("Unexpected response body received, error: %s\n", err.Error()))
|
||||
return err
|
||||
}
|
||||
if resp.StatusCode > 299 {
|
||||
fmt.Printf("Unexpected code received: %d\n", resp.StatusCode)
|
||||
utils.Logger.Debug(fmt.Sprintf("Unexpected code received: %d\n", resp.StatusCode))
|
||||
return fmt.Errorf("Unexpected status code received: %d", resp.StatusCode)
|
||||
}
|
||||
fmt.Printf("Received raw answer from SureTax: %s\n", string(respBody))
|
||||
utils.Logger.Debug(fmt.Sprintf("Received raw answer from SureTax: %s\n", string(respBody)))
|
||||
var stResp SureTaxResponse
|
||||
if err := json.Unmarshal(respBody, &stResp); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Received answer from SureTax: %+v\n", stResp)
|
||||
utils.Logger.Debug(fmt.Sprintf("Received answer from SureTax: %+v\n", stResp))
|
||||
if stResp.D.ResponseCode != 9999 {
|
||||
cdr.ExtraInfo = stResp.D.HeaderMessage
|
||||
return nil // No error because the request was processed by SureTax, error will be in the ExtraInfo
|
||||
|
||||
@@ -76,7 +76,6 @@ func TestSTIResetStorDb(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Start CGR Engine
|
||||
func TestSTIStartEngine(t *testing.T) {
|
||||
if !*testSureTax {
|
||||
@@ -86,7 +85,6 @@ func TestSTIStartEngine(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSTIRpcConn(t *testing.T) {
|
||||
@@ -94,7 +92,7 @@ func TestSTIRpcConn(t *testing.T) {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
stiRpc, err = jsonrpc.Dial("tcp", "172.16.254.70:2012") // We connect over JSON so we can also troubleshoot if needed // stiCfg.RPCJSONListen
|
||||
stiRpc, err = jsonrpc.Dial("tcp", stiCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -177,7 +175,6 @@ func TestSTIGetCdrs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestSTIStopCgrEngine(t *testing.T) {
|
||||
if !*testSureTax {
|
||||
return
|
||||
@@ -186,4 +183,3 @@ func TestSTIStopCgrEngine(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user