A library to bill SMS messages according to encoding, escaped characters, etc
npm install sms_bill






``json`
"dependencies": {
"sms_bill": "latest"
}
js
var sms_bill = require('sms_bill');
var result = sms_bill.bill(text, segmentCost, encoding);
`* text: Is a string, the full text of the message to be billed.
* segmentCost: Usually a float. Cost for each segment of the message.
* encoding: Optional. If not present will try to autodetect the encoding and
choose one of
bit7 or ucs2. If present, will bill according to the maximum
number of characters allowed per segment for the chosen encoding.More examples can be found in the tests.
The result object will contain the total cost for the message, the number of segments billed,
the encoding used, the maximum number of characters per segment allowed, and a lot more of
information useful for debugging and tracing.
$3
* bit7: GSM 7bit
* bit8: GSM 8bit
* ucs2: UCS2Developers
This project uses standard npm scripts. Current tasks include:
* test: Runs Mocha tests.
* jsdoc: Runs JSDoc3.
* eslint: Runs ESLint.
* coverage: Runs the tests and then Instanbul to get a coverage report.
* build: This is the default task, and will run all the other tasks.Validating Input and Output
In the schema directory you will
find the JSON Schema definitions.$3
* SMSText
* SMSCost
* SMSEncoding$3
* SMSBillResultRunning an npm task
To run a task, just do:`sh
npm run build
`Contributing
To contribute:
* Make sure you open a concise and short pull request.
* Throw in any needed unit tests to accomodate the new code or the
changes involved.
* Run npm run build` and make sure everything is ok before submitting the pullCheck LICENSE file for more information.