ngx-tingg
v0.1.1
Published
An Angular library that abstracts the complexity of using Cellulant's Tingg APIs.
Downloads
4
Maintainers
Readme
ngx-tingg
An Angular library that abstracts the complexity of using Cellulant's Tingg APIs.
*This is still a work in progress
Documentation
API reference: Documentation
Features
- Gracefully handle errors
- Post a charge request
Run on your Project
Install the project
npm i ngx-tingg
Install dependencies
ng add @angular/material
On your app.module.ts
or the component to be used, import the following:
import { NgxTinggModule } from 'ngx-tingg';
@NgModule({
declarations: [
MyComponent
],
imports: [
BrowserModule,
//import this
NgxTinggModule.forRoot(
grant_type: string,
client_id: string,
client_secret: string,
apikey: string,
isProduction: boolean
)
],
Finally on your HTML file,
<tingg-charge-request></tingg-charge-request>
A payment form will be loaded on your view.
Run your app
ng serve
API Reference
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| @Input(): country_code
= KEN
| string
| Country code |
| @Input(): currency_code
= KES
| string
| Currency code |
| @Input(): service_code
= undefined
| string
| Service code |
| @Input(): merchant_transaction_id
= random
| string
| Merchant ID code |
| @Input(): charge_amount
= undefined
| number
| Amount |
| @Input(): charge_msisdn
= undefined
| number
| Phone number |
| @Input(): payment_mode_code
= STK_PUSH
| string
| Payment mode code |
| @Input(): payment_option_code
= SAFKE
| string
| Payment payment_option_code code |
Example
<tingg-charge-request [country_code]="'KEN'" [currency_code]="'KES'" [service_code]="'111'" [merchant_transaction_id]="'11'"></tingg-charge-request>
Running Tests
To run tests, run the following command
ng e2e