# bm-airtime-plugin-manager

> BongoLive Airtime plugins manager. Manage lifecycle of the Operators/Billing plugins

Latest version **1.1.4** (published 2026-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install bm-airtime-plugin-manager
pnpm add bm-airtime-plugin-manager
yarn add bm-airtime-plugin-manager
bun add bm-airtime-plugin-manager
```

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2026-06-30 |
| First published | 2023-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 27 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | beemafrica |

## Links

- npm: https://www.npmjs.com/package/bm-airtime-plugin-manager
- Repository: git clone https://salehe-mwanga@bitbucket.org/bongolive/bongolive-airtime-plugins-manager
- npm.io page: https://npm.io/package/bm-airtime-plugin-manager

## Dependencies (6)

- [pino](https://npm.io/package/pino.md) ^5.11.1
- [axios](https://npm.io/package/axios.md) 0.21.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [amqplib](https://npm.io/package/amqplib.md) 0.6.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.12.2

## Recent versions

- 1.1.4 (latest) — 2026-06-30
- 1.1.3 — 2026-06-30
- 1.1.2 — 2026-06-30
- 1.1.1 — 2026-06-29
- 1.0.8 — 2026-06-22
- 1.0.7 — 2026-06-11
- 1.0.6 — 2025-07-22
- 1.0.4 — 2025-07-03
- 1.0.3 — 2025-07-01
- 1.0.1 — 2024-03-28
- 1.0.0 — 2023-08-17

## README

## AIRTIME PLUGIN MANAGER

The plugins manager facilitates communication between MO and internal API through plugins.

### Installation
```bash
# Using npm
npm -i airtime-plugin-manager --save
# Using yarn
yarn add airtime-plugin-manager
```

### Usage

In order for the plugin to be effective, you need to import `PluginManager` and extend either `BasePlugin` or `BaseBillingPlugin` as per your need.

> Extend `BasePlugin` if you need to add new operator.
> Extend `BaseBillingPlugin` if you want to implement new logic for the billing.

#### Example:

##### Configuring the `PluginManager`

```javascript
    // Some where in your application entry e.g. app.js
    const {PluginManager} = require('airtime-plugin-manager');
    const path = require('path');

    // Url pointing to the rabbitmq message.
    const qUrl = 'amq://127.0.0.1';

    // Internal messaging channel
    const topic = 'disbursement';


    new PluginManager()
        // Configuration
        .withConfig(path.join(__dirname, 'config.yaml'))
        // We will eventually remove this (deprecated)
        .useLogger(logger)
        // Define the rabbitmq url
        .rabbitMQUrl(qUrl)
        // Define the queue channel
        .rabbitMQTopic(topic)
        // Define the path where the plugins will be found.
        .pluginsPath(path.join(__dirname, 'plugins'))
        // Spin the plugins manager
        .run();

```

#### Developing the plugins

##### New MO plugin named `my_new_mo.js`

```javascript
   // This plugin is located at <root>/plugins/my_new_mo.js

   const {BasePlugin} = require('airtime-plugin-manager');

   class MyNewMoPlugin extends BasePlugin {
       constructor() {
           super();
       }

       // This is where you perform the transfer.
       doTransfer(amount, msisdn) {
           super.doTransfer(amount, msisdn);
       }
   }
```

##### New MO Billing plugin named `my_new_mo_billing.js`

```javascript
// This plugin is located at <root>/plugins/billing/my_new_mo_billing.js
const {BaseBillingPlugin} = require('airtime-airtime-manager');

class MyNewMoBillingPlugin extends BaseBillingPlugin {

    constructor() {
        super();
    }

    onBlockCredits(args) {
        // Block credits...
    }

    onDebitAccount(args) {
        // Debit Account. Transaction went through
    }

    onCreditAccount(args) {
        // Credit account. Transaction failed.
    }
}
```

### Integrating to your project.

To intergrate the  `airtime-plugin-manager` to your project, you need to specify your configuration in `.yaml` file.

Assume the file named `config.yaml` with the following options

```yaml
new_mo:
    name: my_mo_plugin
    billing: my_mo_billing_plugin
```

That's it!

---
_Source: https://npm.io/package/bm-airtime-plugin-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
