updated threshold implementation

This commit is contained in:
gezimbll
2025-06-02 18:40:11 +02:00
committed by Dan Christian Bogos
parent 5444973349
commit 2d94ca89bb
7 changed files with 92 additions and 262 deletions

View File

@@ -256,8 +256,10 @@ func testAccWThdGetAccountAfterDebit(t *testing.T) {
func testAccWThdGetThresholdAfterDebit(t *testing.T) {
var result2 *engine.Threshold
if err := accWThdRpc.Call(context.Background(), utils.ThresholdSv1GetThreshold, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1002"}}, &result2); err == nil || err.Error() != utils.ErrNotFound.Error() {
if err := accWThdRpc.Call(context.Background(), utils.ThresholdSv1GetThreshold, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1002"}}, &result2); err != nil {
t.Error(err)
} else if result2.Hits != 1 {
t.Errorf("expected to have reached MaxHits")
}
}

View File

@@ -300,8 +300,8 @@ func testFraudAuthorizeandProcess1(t *testing.T) {
}
var reply string
if err := fraudRPC.Call(context.Background(), utils.SessionSv1ProcessCDR,
cgrEv, &reply); err == nil || err.Error() != utils.ErrPartiallyExecuted.Error() {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrPartiallyExecuted, err)
cgrEv, &reply); err != nil {
t.Error(err)
}
}
@@ -350,8 +350,8 @@ func testFraudAuthorizeandProcess2(t *testing.T) {
}
var reply string
if err := fraudRPC.Call(context.Background(), utils.SessionSv1ProcessCDR,
cgrEv, &reply); err == nil || err.Error() != utils.ErrPartiallyExecuted.Error() {
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrPartiallyExecuted, err)
cgrEv, &reply); err != nil {
t.Error(err)
}
}