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

ecopay

v1.1.0

Published

SDK for EcoPay Payment Platform

Downloads

17

Readme

ecopay

Integrate this ecopay SDK to make payment with EcoPay gateway

Install

npm install ecopay

Payment transaction

Create payment transaction:

import { EcoPaySDK } from 'ecopay';

const ecopayIns = new EcoPaySDK({
  // config parameters
});

const sampleData: IInitTransactionRequiredData & IInitTransactionExtraData = {
  // your data here
};

ecopayIns.initTransaction(sampleData); // Promise<ICommonResponseData>

Check status of transaction

// other import like above
...
ecopayIns.checkTransaction("<merchant_order_id>");  // Promise<ICommonResponseData>

Tokenization transaction

Initialize Tokenization from EcoPaySDK or separate Tokenization class:

import { EcoPaySDK } from 'ecopay';
...
const token = new EcoPaySDK.Tokenization({
    // config parameters
});

or

import { TokenizationSDK } from 'ecopay';
...
const token = new TokenizationSDK({
    // config parameters
});

Methods

EcoPaySDK

| Signature | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- | | EcoPaySDK(config: IInitSdkConfig) | Init SDK | | initTransaction(params: IInitTransactionRequiredData & IInitTransactionExtraData) | Create payment transaction | | checkTransaction(params: string) | Check status of payment transaction | | getSupportBanks(params: IGetSupportBanks) | Get list of supported banks |

TokenizationSDK

* These methods can be called directly on EcoPaySDK instance for short. Example: ecopaySDKInstance.initTokenization,... | Signature | Description | | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | | TokenizationSDK(params: IInitSdkConfig) | Init SDK | | initTokenization(params: IInitTokenizationData) | Create tokenization transaction | | updateTokenzation(id: string, params: IUpdateTokenizationData) | Update tokenization information | | getTokenizations(params: IGetTokenization, id?: string) | Get a list of tokenizations if id is omitted, otherwise get a detail of tokenization with id |

Return type

All the above methods have return data of type of Promise<ICommonResponseData>

Interface

(*) required

IInitSdkConfig

EcoPaySDK init params

| Field | Type | Description | | ------------ | ------ | ------------------- | | secretKey | string | Merchant secret key | | merchantCode | string | Merchant code |

IInitTransactionRequiredData

Required parameters when creating payment transaction

| Field | Type | Description | | --------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | platform(*) | string | Device platform. Value one of: 'web', 'mobile' or "desktop" | | payment_channel(*) | string | Payment channel: - 'atm': atm payment - 'qrcode': qrcode payment - 'eco_merchant' or 'eco_consumer': payment through app eco merchant or consumer - 'installment': convert to installment - 'all': select later | | merchant_order_id(*) | string | Unique order ID | | amount(*) | number | Amount of transaction | | description(*) | string | Description of transaction | | redirect_url(*) | string | Url to notify transaction result to merchant | | currency(*) | string | Curreny. 'VND' supported only | | store_label(*) | string | Store label | | store_code(*) | string | Store code | | terminal_label(*) | string | Terminal label | | terminal_code(*) | string | Terminal code |

IInitTransactionExtraData

Other optional parameters for creating payment transaction

| Field | Type | Description | | ---------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | purpose_of_transaction | string | Purpose of transaction. Required when payment channel is qrcode | | bank_type | string | Bank type. Value: - 'domestic': Payment with domestic bank accounts - 'international': Payment with international card such as VISA, MasterCard, JCB,... Required when payment channel is qrcode or atm | | bank_code | string | Bank code. Required when payment channel is qrcode | | payment_type | string | Payment type. Default is '05' | | installment_info | IInstallmentInfo | Goods info when payment channel is installment. More detail below |

IInstallmentInfo

Installment info

| Field | Type | Description | | ------------ | ---------- | ----------------- | | products(*) | IProduct[] | Array of products |

IProduct

Installment products info

| Field | Type | Description | | -------------- | ------ | ----------------------------------------- | | code(*) | string | Code of product. Example: 'LAPTOP01' | | name(*) | string | Name of product. Example: 'Laptop Gaming' | | category(*) | string | Array of products. Example: 'LAPTOP' | | quantity(*) | number | Quantity | | unit_price(*) | number | Price of a single product |

IGetSupportBanks

| Field | Type | Description | | --------------- | ------- | ------------------------------------------- | | disabled_paging | boolean | Pagination or not. Default false | | page_size | number | Page size. Default: 20 | | code | string | Bank code | | partner_code | string | Partner code | | sort | string | Sort field. Example: 'created_at' | | status | string | Status: 'active' or 'inactive' | | type | string | Type of bank: 'domestic' or 'international' |

IInitTokenizationData

| Field | Type | Description | | -------------------- | ------ | ----------------------------------------------- | | merchant_user_id(*) | string | Merchant user id | | redirect_url(*) | string | Redirect url to merchant | | description(*) | string | Description | | bank_type(*) | string | Bank type. Value: 'domestic' or 'international' | | platform(*) | string | Device platform | | bank_code | string | Bank code | | store_code | string | Store code | | merchant_transid | string | Merchant transaction id to create tokenization |

IUpdateTokenizationData

| Field | Type | Description | | -------------------- | ------ | ----------------------------------------------- | | merchant_user_id(*) | string | Merchant user id when create tokenization | | bank_type(*) | string | Bank type. Value: 'domestic' or 'international' | | status(*) | string | Tokenization status |

IGetTokenization

| Field | Type | Description | | -------------------- | ------ | ----------------------------------------------- | | merchant_user_id(*) | string | User id | | bank_type(*) | string | Bank type. Value: 'domestic' or 'international' | | status | string | Tokenization status | | pageSize | number | Page size | | currentPage | string | Current page to get data. Default 1 |

ICommonResponseData

| Field | Type | Description | | --------------- | --------------- | --------------------------------------------------------------- | | result_code(*) | string | Result code. Example: '010200' | | message_key(*) | string | Result message key. Example: 'SUCCESS', 'FAILED', 'UNKNOWN',... | | message(*) | string | Detail result message | | data | Array or Object | Data return | | signature | string | Checksum of data. Use this to validate integrity of field data |

Fields of data when init payment transaction or tokenization successfully:

| Field | Type | Description | | ---------------- | ------ | -------------------------------- | | payment_url(*) | string | Payment url | | transid(*) | string | Transaction id in EcoPay system | | status(*) | string | Transaction status | | expired_at(*) | string | Time when transaction is expired | | expired_time(*) | number | Time duration until expired_at |