Logo Lanfrica

syscli/oneclickdz-node

Domaine:

digital infrastructure

Type de record:

software
Créateur:
sys
Hôte:
Typed Node client for the OneClickDZ API: mobile, internet, gift card, and Navio payment recharges in Algeria. # oneclickdz A typed client for the OneClickDZ API. It covers the recharges every Algerian integration ends up writing by hand: mobile top-ups for Mobilis, Djezzy, and Ooredoo, ADSL and 4G internet cards, gift cards, and Navio payment links. Two things set it apart. The recharge endpoints are asynchronous, so you send an order and then poll until it settles; this client runs that loop for you and hands back a fully typed, settled result. And the card codes a recharge delivers come back wrapped so they stay out of your logs until you ask for them. It is meant for servers. Your access token grants account and balance access, so it must never reach the browser. Published as `@syscli/oneclickdz`. It needs Node 18 or newer, uses the global `fetch`, and ships no runtime dependencies. ## Install ```sh npm install @syscli/oneclickdz ``` ## Quick start ```ts import { OneClickDZ } from "@syscli/oneclickdz"; const oneclick = new OneClickDZ({ key: process.env.ONECLICKDZ_API_KEY!, }); // Confirm the key and see which environment it belongs to. const { username, apiKey } = await oneclick.validate(); console.log(username, apiKey.type); // "boutique-batna", "SANDBOX" // Send a Djezzy top-up and wait for it to settle. const topup = await oneclick.mobile.sendAndWait({ plan_code: "PREPAID_DJEZZY", MSSIDN: "0778037340", amount: 500, }); console.log(topup.status); // "FULFILLED" ``` ## Keys and environments Every key is either sandbox or production. Sandbox runs the full flow without touching real balance, so build against it first. Read the environment off the key with `validate()` before a deploy goes live: ```ts const { apiKey } = await oneclick.validate(); if (apiKey.type !== "PRODUCTION") { throw new Error("Refusing to start with a sandbox key in production."); } ``` The token goes over the wire as the `X-Access-Token` header. After five failed auth attempts the API blocks your IP for fifteen minutes, so cache a working key rather than guessing. ## Sending and wait …