mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Correct usage when SessionSv1.ProcessEvent for *postpaid and *rated
This commit is contained in:
committed by
Dan Christian Bogos
parent
fc3a29debd
commit
2d8bf200d0
@@ -59,8 +59,8 @@ var (
|
||||
testSSv1ItProcessCDR,
|
||||
testSSv1ItProcessEvent,
|
||||
testSSv1ItCDRsGetCdrs,
|
||||
// testSSv1ItForceUpdateSession,
|
||||
// testSSv1ItDynamicDebit,
|
||||
testSSv1ItForceUpdateSession,
|
||||
testSSv1ItDynamicDebit,
|
||||
testSSv1ItStopCgrEngine,
|
||||
}
|
||||
)
|
||||
@@ -88,6 +88,7 @@ func TestSSv1ItWithPrepaid(t *testing.T) {
|
||||
|
||||
func TestSSv1ItWithPostPaid(t *testing.T) {
|
||||
sSV1RequestType = utils.META_POSTPAID
|
||||
sTestSessionSv1 = append(sTestSessionSv1[:len(sTestSessionSv1)-3], testSSv1ItStopCgrEngine)
|
||||
for _, stest := range sTestSessionSv1 {
|
||||
t.Run(sSV1RequestType, stest)
|
||||
}
|
||||
@@ -95,6 +96,7 @@ func TestSSv1ItWithPostPaid(t *testing.T) {
|
||||
|
||||
func TestSSv1ItWithRated(t *testing.T) {
|
||||
sSV1RequestType = utils.META_RATED
|
||||
sTestSessionSv1 = append(sTestSessionSv1[:len(sTestSessionSv1)-3], testSSv1ItStopCgrEngine)
|
||||
for _, stest := range sTestSessionSv1 {
|
||||
t.Run(sSV1RequestType, stest)
|
||||
}
|
||||
@@ -633,10 +635,6 @@ func testSSv1ItProcessEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
if sSV1RequestType == utils.META_POSTPAID ||
|
||||
sSV1RequestType == utils.META_RATED {
|
||||
eAttrs.CGREvent.Event[utils.Usage] = -1.0
|
||||
}
|
||||
if !reflect.DeepEqual(eAttrs, rply.Attributes) {
|
||||
t.Errorf("expecting: %+v, received: %+v",
|
||||
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes))
|
||||
|
||||
@@ -1500,7 +1500,12 @@ func (sS *SessionS) chargeEvent(tnt string, ev *engine.SafEvent, argDisp *utils.
|
||||
}
|
||||
return
|
||||
}
|
||||
if errEnd := sS.endSession(s, utils.DurationPointer(maxUsage), nil, nil); errEnd != nil {
|
||||
usage := maxUsage
|
||||
if utils.IsSliceMember(utils.PostPaidRatedSlice, ev.GetStringIgnoreErrors(utils.RequestType)) {
|
||||
usage = ev.GetDurationIgnoreErrors(utils.Usage)
|
||||
}
|
||||
//in case of postpaid and rated maxUsage = usage from event
|
||||
if errEnd := sS.endSession(s, utils.DurationPointer(usage), nil, nil); errEnd != nil {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> error when ending charged event: <%s>, err: <%s>",
|
||||
utils.SessionS, cgrID, err.Error()))
|
||||
|
||||
@@ -28,7 +28,8 @@ var (
|
||||
PreRated, CostSource, CostDetails, ExtraInfo, OrderID}
|
||||
CDRCFileFormats = []string{MetaFileCSV, MetaFScsv,
|
||||
MetaKamFlatstore, MetaOsipsFlatstore, MetaPartialCSV, MetaFileFWV, MetaFileXML}
|
||||
MainCDRFieldsMap StringMap
|
||||
PostPaidRatedSlice = []string{META_POSTPAID, META_RATED}
|
||||
MainCDRFieldsMap StringMap
|
||||
|
||||
GitLastLog string // If set, it will be processed as part of versioning
|
||||
PosterTransportContentTypes = map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user