npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gat-solutions/top-up

v1.0.1

Published

Đây là một thư viện hỗ trợ gọi API TopUp từ bên thứ 3 (Hiện tại là ViHAT). Thư viện bao gồm 1 service gọi API đi kèm những định nghĩa type dành cho typescript. # Installation ```bash $ npm i @gat-solutions/top-up ``` # Usage ## Khởi tạo service ```typescr

Downloads

2

Readme

Introduction

Đây là một thư viện hỗ trợ gọi API TopUp từ bên thứ 3 (Hiện tại là ViHAT). Thư viện bao gồm 1 service gọi API đi kèm những định nghĩa type dành cho typescript.

Installation

$ npm i @gat-solutions/top-up

Usage

Khởi tạo service

import { TopUpService } from '@gat-solutions/top-up';

const email = '[email protected]';
const password = 'veryStringPassword';

const topUpService = new TopUpService(email, password);

Fields | Description ------------- | ------------- email | Email này được bên thứ 3 cung cấp password | Password được cung cấp kèm theo email

Login

const topUpService = new TopUpService(email, password);

const data = await topUpService.login();

Dữ liệu trả về

{
    "resultCode": "100",
    "data": {
        "token": "MYAWH3P-CE3MWPD-H2F7SVW-91GGHGF",
        "expiry": "2023-08-30T03:46:01.000Z"
    }
}

Get Balance

const topUpService = new TopUpService(email, password);

const data = await topUpService.getBalance();

Dữ liệu trả về

{
    "resultCode": 100,
    "message": "Success",
    "data": {
        "email": "[email protected]",
        "balance": 40000
    }
}

Get all transactions

const topUpService = new TopUpService(email, password);

const dto: GetAllTransactionDto = {
    from: "2023/01/01",
    to: "2023/12/31",
    type: TransactionType.TOP_UP
};

const data = await topUpService.getAllTransactions(dto);

Fields | Description ------------- | ------------- from | Từ ngày theo format (YYYY/MM/DD) to | Đến ngày theo format (YYYY/MM/DD) type | Loại giao dịch: TopUp hoặc CardCode (Mua card)

Dữ liệu trả về

{
    "resultCode": 100,
    "message": "Thành công",
    "data": {
        "logs": [
            {
                "_id": "xxxxxxxxxxxxxxx",
                "requestid": "xxxxxxxxxxxxxxx",
                "typeid": 1,
                "phonenumber": "xxxxxxxxxxxxxxx",
                "requestip": "xxx.xxx.xxx.xx",
                "price": 10000,
                "referenceid": "xxxxxxxxxxxxxxx",
                "result": "true",
                "createDate": "2023-08-28T02:56:25.801Z"
            }
        ]
    }
}

Get detail a transaction

const topUpService = new TopUpService(email, password);

const dto: GetDetailTransactionDto = {
    referenceId: "xxxxxxxxx"
};

const data = await topUpService.getDetailTransaction(dto);

Fields | Description ------------- | ------------- referenceId | Mã mà user truyền lên khi user thực hiện giao dịch

Dữ liệu trả về

{
    "resultCode": 100,
    "message": "Success",
    "logs": [
        {
            "referenceId": "xxxxxxxxx",
            "result": 0
        }
    ]
}

Top Up (nạp tiền điện thoại)

const topUpService = new TopUpService(email, password);

const dto: TopUpDto = {
    phonenumber: "0xxxxxxxxx",
    price: 10000,
    requestId: "random",
    callbackurl: "http://localhost:3000",
    sandbox: Env.SANDBOX
};

const data = await topUpService.topUp(dto);

Fields | Description ------------- | ------------- phonenumber | Số điện thoại cần nạp tiền price | Mệnh giá requestId | Mã user tự tạo và truyền lên (recommend dùng uuid) callbackurl | URL để ViHAT bắn webhook về sandbox | Môi trường: Sandbox hoặc Production

Dữ liệu trả về (Sandbox):

{
    "resultCode": 200,
    "message": "Test OK",
    "userid": "64db55440dcdb000307a1a73"
}

Buy Card (nạp tiền điện thoại)

const topUpService = new TopUpService(email, password);

const dto: BuyCardDto ={
    network: CardNetwork.VINAPHONE,
    price: 10000,
    sandbox: Env.SANDBOX
};

const data = await topUpService.buyCard(dto);

Fields | Description ------------- | ------------- network | Mã nhà mạng price | Mệnh giá sandbox | Môi trường: Sandbox hoặc Production

Dữ liệu trả về (Sandbox):

{
    "resultCode": 200,
    "message": "Test OK"
}