Methods
additionalFees()
Calculate additional fees per user for acquisition
Returns:
fixed number based on the plivoSMS rate and fbAd rate
calcPayFortFees(amount) → {Number}
Calculates the payfort fees used to transfer money from user's CC to
company's bank account
Parameters:
| Name | Type | Description |
|---|---|---|
amount |
Number | The amount in EGP |
Returns:
The payfort fees per amount in EGP
- Type
- Number
calcSavings(packageIndex, price, users, months, currency) → {Object}
Calculates savings for a package per user annually.
Parameters:
| Name | Type | Description |
|---|---|---|
packageIndex |
Number | The package index to multiple to for pricing |
price |
Number | The price already calculated for the package |
users |
Number | The count of users for this package |
months |
Number | The period of periodical payment for user |
currency |
String | Either "USD" or "EGP" |
Returns:
The savings object. ex.
{
packageIndex: 1,
originalPrice: 150,
price: 100,
users: 3,
months: 1,
currency: 'EGP',
saving: 50,
percent: 0.33
}
- Type
- Object
calcTaxes(amount) → {Number}
Calculates the taxes
Parameters:
| Name | Type | Description |
|---|---|---|
amount |
Number | The amount of money to calculate taxes on |
Returns:
The amount of money, with taxes considered ( added )
- Type
- Number
mround(val, to) → {Number}
Round to the nearest
Parameters:
| Name | Type | Description |
|---|---|---|
val |
Number | The original value |
to |
Number | the value to round to |
Returns:
the calculated value
- Type
- Number
price(packageIndex, users, months, roundingBase) → {Object}
Parameters:
| Name | Type | Description |
|---|---|---|
packageIndex |
Number | 0 ( free ) 1 ( basic ) 2 ( advanced ) 3 ( extreme ) each packageIndex has more features than the ones before |
users |
Number | Buying for how many users. must be > 0 |
months |
Number | 1 -to- 12 |
roundingBase |
Number | The priceBase is rounded to 10 and then multiplied by this roundingBase, so that you expect the price to be multiple of say ( 25 ) if the price base is 13 and the rounding base is 2.5. or package is multiple of ( 50 ) if the price base is 14.5 and the roundingBase is 5 .. etc.. |
Returns:
The price information object. ex.
if inputs are
{
name: 'Some Name',
users: 1,
months: 1,
packageIndex: 1,
roundingBase: 2.5
}
result would be
{
"EGP": {
"originalPrice": 600,
"price": 50,
"priceAnnually": 600,
"saving": 0,
"savingPercent": 0,
},
"USD": {
"originalPrice": 36,
"price": 3,
"priceAnnually": 36,
"saving": 0,
"savingPercent": 0,
}
}
- Type
- Object