# Default: 0 (day)
# MessagesTimeout = 0
+# Defines fee charging rules.
+# 0 - classic rules, allow fee charge even cash is negative;
+# 1 - disallow fee charge if cash value is negative;
+# 2 - disallow fee charge if there is not enought cash (cash < fee).
+# Parameter: optional
+# Value: 0 - 2
+# Default: 0 (classic)
+# FeeChargeType = 0
+
################################################################################
# Store module
# Configure the module that works with the database server
# Default: 0 (day)
# MessagesTimeout = 0
+# Defines fee charging rules.
+# 0 - classic rules, allow fee charge even cash is negative;
+# 1 - disallow fee charge if cash value is negative;
+# 2 - disallow fee charge if there is not enought cash (cash < fee).
+# Parameter: optional
+# Value: 0 - 2
+# Default: 0 (classic)
+# FeeChargeType = 0
+
################################################################################
# Store module
# Configure the module that works with the database server
writeFreeMbTraffCost(false),
showFeeInCash(true),
messageTimeout(0),
+ feeChargeType(0),
modulesSettings(),
storeModuleSettings(),
logger(GetStgLogger())
writeFreeMbTraffCost(false),
showFeeInCash(true),
messageTimeout(0),
+ feeChargeType(0),
modulesSettings(),
storeModuleSettings(),
logger(GetStgLogger())
writeFreeMbTraffCost(rval.writeFreeMbTraffCost),
showFeeInCash(rval.showFeeInCash),
messageTimeout(rval.messageTimeout),
+ feeChargeType(rval.feeChargeType),
modulesSettings(rval.modulesSettings),
storeModuleSettings(rval.storeModuleSettings),
logger(GetStgLogger())
}
}
+ if (strcasecmp(node->getName(), "FeeChargeType") == 0)
+ {
+ if (ParseUnsignedInRange(node->getValue(0), 0, 2, &feeChargeType) != 0)
+ {
+ strError = "Incorrect FeeChargeType value: \'" + string(node->getValue(0)) + "\'";
+ return -1;
+ }
+ }
+
if (strcasecmp(node->getName(), "DirNames") == 0)
{
const DOTCONFDocumentNode * child = node->getChildNode();
const std::string & GetMonitorDir() const { return monitorDir; }
bool GetMonitoring() const { return monitoring; }
unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
+ unsigned GetFeeChargeType() const { return feeChargeType; }
const std::string & GetModulesPath() const { return modulesPath; }
const MODULE_SETTINGS & GetStoreModuleSettings() const
bool writeFreeMbTraffCost;
bool showFeeInCash;
unsigned messageTimeout;
+ unsigned feeChargeType;
std::vector<MODULE_SETTINGS> modulesSettings;
MODULE_SETTINGS storeModuleSettings;
if (passive.ConstData())
return;
-double f = tariff->GetFee() / DaysInCurrentMonth();
+double fee = tariff->GetFee() / DaysInCurrentMonth();
-if (f == 0.0)
+if (fee == 0.0)
return;
double c = cash;
-property.cash.Set(c - f, sysAdmin, login, store, "Subscriber fee charge");
+switch (settings->GetFeeChargeType())
+ {
+ case 0:
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ case 1:
+ if (c > 0)
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ case 2:
+ if (c > fee)
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ }
ResetPassiveTime();
}
//-----------------------------------------------------------------------------
return;
}
}
-double f = tariff->GetFee() * passiveTimePart;
+double fee = tariff->GetFee() * passiveTimePart;
ResetPassiveTime();
-if (f == 0.0)
+if (fee == 0.0)
return;
double c = cash;
login.c_str(),
tariff->GetFee(),
passiveTimePart,
- f);
-property.cash.Set(c - f, sysAdmin, login, store, "Subscriber fee charge");
+ fee);
+switch (settings->GetFeeChargeType())
+ {
+ case 0:
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ case 1:
+ if (c > 0)
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ case 2:
+ if (c > fee)
+ property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge");
+ break;
+ }
}
//-----------------------------------------------------------------------------
void USER_IMPL::SetPrepaidTraff()