Commit Graph

340 Commits

Author SHA1 Message Date
ionutboangiu
62619ba3a5 Replace interface{} with any 2023-06-05 10:55:32 +02:00
ionutboangiu
cb7ea790de Update rpcclient library to latest version
Replace all instances of rpcclient.ClientConnector with birpc.ClientConnector.

Pass context, maxReconnectInterval, delayFunc and birpcClient to rpcclient
constructors.

Remove redundant time.Duration conversions (e.g. time.Duration(1*time.Second)
now becomes time.Second.

Add context where needed (context.Background() for tests, context.TODO()
for places where it should be passed from somewhere else).

Implement that functionality of the SessionSv1.Sleep call, in sessions/sessions
instead of apier/v1.

Make changes in utils/server.go (replacing the old rpc2 library with github.com/cgrates/birpc).

Change the way we register birpc methods for sessions in services, using a helper function
defined in engine/libengine.go.
2023-05-03 10:02:15 +02:00
ionutboangiu
4cd2dc3de8 Revise CDR rerating
The (*CDRServer).processEvent function is now called processEvents and can
be passed an array of CGREvents instead of only one. This was done because
when calling the RateCDRs API we want to first refund all CDRs before
starting to debit again.

The rerate parameter is now no longer hardcoded to true for the RateCDRs API.If
required, the "*rerate" flag must be provided by the caller.

Now, the refundEventCost function returns an additional boolean, that signals
whether the refund occured or didn't.

If the reRate parameter is set to true, also set refund to true.

In case CostDetails is not populated, retrieve it from StorDB if possible
and add it to the CGREvent before converting to CDRs. Set CostDetails back
to nil once the refund goes through.

Remove the refund logic from within the store block.

Now that the refund happens before the debit, revise the expected values for
the "testV1CDRsProcessEventWithRefund" subtest within the
apier/v1/cdrs_it_test.go file.

Add an integration test for the following scenario:
 -create one account with one balance of 1 free minute and rating for the rest.
 -send one CDR of two minutes with ProcessEvent. This should consume 60s out of
the free balance and charge 60s. The SetupTime in the CDR should be 1 hour after
the second CDR.
 -send the second CDR with an usage of 2m. This should be charged entirely.
 -send a RateCDR API call with OrderBy: "SetupTime". This should rerate the two
CDRs from above and change their order of rating.
2023-04-20 20:05:00 +02:00
ionutboangiu
82468c580d Replace deprecated ioutil library, remove redundant statements + small optimizations 2022-12-02 14:24:18 +02:00
andronache
428cd37b8e Replaced header in multiple places 2021-11-01 13:50:23 +02:00
Trial97
0dd7a37f9b Updated EventCost Rounding. Fixes #3018 2021-09-23 11:49:17 +02:00
porosnicuadrian
40596e9b04 Tested cdrs apis for default tenant 2021-07-15 18:42:58 +02:00
Trial97
b1b9a81fc1 Added RoundIncrement to EventCost 2020-10-08 11:16:01 +02:00
Trial97
f18525a1db Updated path for cdre 2020-01-30 10:21:48 +01:00
Trial97
94c29c93d2 Updated CDRExporter 2020-01-28 10:07:34 +01:00
Trial97
60703280a6 Updated typos in cdre 2020-01-21 16:25:50 +02:00
Trial97
ae56de5cf9 Updated tests 2020-01-17 08:28:52 +02:00
Trial97
548f895a87 Updated stordb reload 2020-01-09 12:09:02 +02:00
DanB
a4d11fe776 SessionS.refundSession to add TOR for proper refunds 2020-01-06 19:31:02 +01:00
Trial97
21285b4bbc Removed unused connmanager service 2020-01-06 17:43:54 +02:00
Trial97
edea07e044 Updated AttributeS Context 2019-12-18 17:57:59 +02:00
Trial97
6155b0ad35 Removed unused methods from CDRServer 2019-12-18 17:57:59 +02:00
Dan Christian Bogos
ea5c691e73 Merge pull request #1832 from Trial97/master
Updated gob integration tests
2019-12-18 12:30:28 +01:00
Trial97
1c086ac0e3 Updated gob integration tests 2019-12-18 13:24:35 +02:00
TeoV
73617f2187 Add test for Refund out of CDR 2019-12-18 06:21:21 -05:00
DanB
4970903d3b CDRs.ProcessEvent wth support for *refund flag 2019-12-18 10:16:02 +01:00
Dan Christian Bogos
51177cb144 Merge pull request #1828 from Trial97/master
Updated v1ProcessCDR and V1RateCDR
2019-12-17 19:01:41 +01:00
DanB
a2654f6bf4 CDRs.rateCDR to consider CostDetails as source of cost 2019-12-17 18:57:55 +01:00
Trial97
7e6c8ca61c Updated v1ProcessCDR and V1RateCDR 2019-12-17 17:25:55 +02:00
DanB
c045beecc8 Automatic rerating in case of Usage of SessionCost not matching CDR received 2019-12-17 14:43:37 +01:00
Trial97
1a5c4a4dd2 Updated ConnManager.Call 2019-12-13 16:48:02 +02:00
TeoV
261816f99b Update some config with correct definition for connections 2019-12-12 11:32:59 +02:00
TeoV
2ee574002a Add support for BiRPC in ConnManager 2019-12-12 08:54:42 +02:00
TeoV
95477bcabc Add conncetions from Sessions and CDRs through ConnManager 2019-12-12 08:54:42 +02:00
TeoV
4bd4ae3ee9 Add connections through ConnManager 2019-12-12 08:52:49 +02:00
Trial97
49489be7a2 Updated integration tests 2019-12-11 16:56:54 +02:00
Trial97
bbcfc6de42 Updated integration tests 2019-12-11 08:00:38 +02:00
Trial97
d22151861d Updated integration tests and replaced *none with *remove in attributes 2019-12-11 08:00:38 +02:00
DanB
74ed5e9958 CDRs.processEvent with support for cached CDRIDs 2019-12-09 18:37:01 +01:00
Trial97
4bcafed33f Updated refundEventCost 2019-12-09 18:04:26 +02:00
Trial97
b4fe82c6d7 Updated rpcclient library 2019-12-09 18:04:26 +02:00
DanB
5fc2dc9092 CDRsV1.ProcessEvent with refund for AccountableRequestTypes 2019-12-08 19:44:42 +01:00
Trial97
65c2e9c18c Updated V1RateCDRs 2019-11-28 16:21:55 +02:00
Trial97
345bd5ba39 Updated FlagsWithParams GetBool method 2019-11-25 09:29:28 +01:00
DanB
360a9cc00b SessionS - processEvent function with sync actions 2019-11-22 19:54:16 +01:00
DanB
18999bcbbd CDRs refundCDR method implementation 2019-11-22 19:54:16 +01:00
DanB
4bf4560ef1 EventCost AsRefundIncrements method 2019-11-22 19:54:16 +01:00
Trial97
b110537b54 Added StorDB config reload 2019-11-09 15:55:49 +01:00
Trial97
45ab2f9257 Added connection reload for SessionS 2019-10-28 12:17:15 +01:00
Trial97
88fb9c7926 Added connection reload for RALs 2019-10-28 12:17:15 +01:00
Trial97
d79b26419c Added connection reload for CDR server 2019-10-28 12:17:15 +01:00
Trial97
1f7dc77fc9 Updated CDRs config 2019-10-28 12:17:15 +01:00
Trial97
a08b190a4e Replaced IsSliceMember with SliceHasMember for constant slices 2019-08-08 19:12:47 +02:00
Tripon Alexandru-Ionut
ff9e44b639 Updated EventType and renamed EqualThan to EqualTo 2019-07-09 21:10:37 -10:00
Tripon Alexandru-Ionut
633a11cd69 Updated EvenType in cdrs for ThresholdSv1ProcessEvent 2019-07-04 12:23:54 -10:00