Commit Graph

229 Commits

Author SHA1 Message Date
gezimbll
d04cf1df44 updated negative balance to not give warning when AllowNegative set to true 2025-02-28 11:52:12 +01:00
ionutboangiu
d6c5ddf08e Remove unused debitUnits and debitMoney funcs
They seem to have been replaced by the more generic debit
2024-04-08 13:15:41 +02:00
ionutboangiu
31842bf3f5 Add possibility to set/overwrite balance Factors through API
Constructor looks inside the params' balance map for the Factors key.
It expects either a string representing a JSON serialized map or the
map itself.

BalanceFilter Clone function has been updated to set a deep copy of
the original Factors map instead of a shallow one.

BalanceFilter getter function for Factors now returns nil instead of
an empty map. It's slightly more memory efficient and assignment to
this map will not be attempted, so it's panic proof.

BalanceFilter.ModifyBalance now updates Factors only if the key is
found in the request params' Balance map. Setting Factors to null is also
possible as long as the Factors key exists and is set to null.

Note: only *set_balance can overwrite the Factors map, all the others
can only set it if the balance does exist prior to sending the request.

Update balance integration tests.
2024-04-08 13:15:41 +02:00
ionutboangiu
9c004b069d Ignore factors equal to 1 when creating EventCost 2024-04-01 20:48:57 +03:00
ionutboangiu
a7ca167039 Add BalanceFactor value to Increments
For both the Increment and ChargingIncrement types.
2024-04-01 20:48:57 +03:00
ionutboangiu
cc72aa92d9 Slightly optimize debit for balances with non-nil Factor
Factor will be computed only once at the start of the function, instead
of doing it on every Increments iteration.

'amount' variable will be updated and rounded only when the computed
balances factor is different from its default value (1).
2024-04-01 20:48:57 +03:00
ionutboangiu
bd4aa99458 Refactor balance's Factor field name with its plural form
Stored balances previous to this commit, that had a non-nil Factors map, will
now have Factors nil due to field name mismatch.
2024-04-01 19:58:04 +03:00
ionutboangiu
45066b2d2f Rename Factor field to Factors in BalanceSummaries 2024-04-01 19:58:04 +03:00
ionutboangiu
6d61fd479d Add Factor map and Weight to BalanceSummaries
Added additional tests + updated old ones.
2024-04-01 19:58:04 +03:00
ionutboangiu
5ac08799e1 Update *remove actions to support multiple balance types at once 2024-03-12 18:11:34 +01:00
ionutboangiu
28e53cecc9 Add requests_cache_key field to radagent cfg 2024-03-07 17:20:23 +01:00
ionutboangiu
3269393141 Retrieve BalanceFactorID from Event
It will be added to CallDescriptor in ExtraFields.

Ensure CDR ExtraFields are passed to CallDescriptor before
sending it to RALs.

Ensure Clone function of CallDescriptor also clones the
ExtraFields map.
2024-03-04 09:49:15 +01:00
ionutboangiu
d182d6f601 Revise behaviour of balance factor
Now it multiplies instead of dividing.
2024-02-06 10:06:30 +01:00
ionutboangiu
050af6032c Include DestinationIDs and Factor when cloning balances
This fixes an issue where, if data_db is of type *internal, the Factor value is lost
on GetAccount
2024-01-29 09:57:49 +01:00
ionutboangiu
5c96ecf27e Update balance factor to depend on category
Updated unit tests to reflect that also.
2024-01-25 18:41:17 +01:00
ionutboangiu
b76d61281c Implement new *transfer_balance action
Added possibility to mock datamanager account functions.

Fixed typo in SubtractValue function name.

Added unit & integration tests.
2024-01-15 16:15:18 +01:00
ionutboangiu
6c16ff320f Replace interface{} with any 2023-05-31 10:23:12 +02:00
Trial97
df5adc6c96 Updated account interface 2021-11-28 10:25:32 +01:00
Trial97
61b823443d Finished adding all fieldAsInterface methods 2021-11-28 10:25:32 +01:00
Trial97
a1e0a34600 Started removing structmatcher 2021-10-12 16:49:01 +03:00
Trial97
c182ca65f5 Updated balance debit 2021-09-28 12:17:04 +02:00
Trial97
2a6f2c140a Updated account threshold test 2021-07-19 15:37:19 +02:00
Trial97
7e7657b30d Updated account update threshold trigger 2021-07-19 15:37:19 +02:00
ionutboangiu
64a2c63084 Fix SaveDirtyBalances func in engine/balances.go 2021-05-07 20:12:04 +02:00
Trial97
c13a5cf790 Finished implementing the DataNode as a replacement 2021-03-26 13:46:25 +01:00
andronache
32c234a6c7 In CGREvent changed Opts in APIOpts 2021-03-23 14:35:11 +01:00
Trial97
9047fab68c Updated EventCost FieldAsInterface function. Fixes #2743 2021-03-19 18:30:48 +01:00
Trial97
f2c9ca3530 Fixed typo in license header 2021-03-10 16:22:37 +01:00
TeoV
ae146640f4 Start merging CGREventWithOpts with CGREvent 2021-01-14 10:30:35 +01:00
andronache
1d0a814e42 Changed consts in utils 2021-01-11 10:57:44 +01:00
andronache
4ff3b9242d Consts in utils 2021-01-07 18:15:35 +01:00
andronache
1470267727 Modified consts in utils 2021-01-07 18:15:35 +01:00
Trial97
e56d86de98 Updated all Destinations caching to datamanager 2020-12-04 18:44:27 +01:00
TeoV
e3c10dc6da Rename from InitialValue to Initial 2020-10-27 16:46:08 +01:00
TeoV
4707e02091 Add IntialValue in Balances from AccountSummary 2020-10-27 16:46:08 +01:00
TeoV
1d99855364 Merbe PublishBalance in PublishAccount action 2020-10-23 10:56:44 +02:00
TeoV
18c4d1f94b Start update event from RALs to ThresholdS and StatS 2020-10-23 10:56:44 +02:00
Trial97
61d2b4e922 Added *eventType to opts for process threhold 2020-10-09 14:27:48 +02:00
Trial97
d606a60eab Finished replacing ArgDispatcher with Opts 2020-07-30 11:17:57 +02:00
Trial97
11dac21b88 Starting replacing ArgDispatcher with Opts 2020-07-30 11:17:57 +02:00
TeoV
9c9e35857f Rename from Rate to RGRate 2020-06-11 16:49:21 +02:00
Trial97
13e813f848 Fixed agents unit tests 2020-05-07 11:17:41 +02:00
Trial97
ff5f5f2d21 Added FieldAsInterface for EventCost 2020-02-05 16:00:32 +01:00
Trial97
f18525a1db Updated path for cdre 2020-01-30 10:21:48 +01:00
Trial97
e5c97a94ab Renamed META_DEFAULT to MetaDefault 2019-12-13 15:04:34 +02:00
TeoV
2ee574002a Add support for BiRPC in ConnManager 2019-12-12 08:54:42 +02:00
TeoV
4bd4ae3ee9 Add connections through ConnManager 2019-12-12 08:52:49 +02:00
DanB
4bf4560ef1 EventCost AsRefundIncrements method 2019-11-22 19:54:16 +01:00
TeoV
af1cfc64c8 Implement Replication for all Set Methods 2019-11-20 19:48:14 +01:00
adragusin
9aa79f1417 Added test for Balance.IsExpiredAt 2019-11-20 11:01:25 +01:00