telepay_http

style: very good analysis pub package License: MIT

TelePay client for Dart language, to easily process cryptocurrency payments using classic http client http.

Getting Started

Check the full example here.

Install

Add to dependencies on pubspec.yaml:

dependencies:
    telepay_http: <version>

Make Your First Request

The first thing is to create an instance of TelePayHttp for later use, which receives two parameters, your API private key and an instance of http client.

  final telepay = TelePayHttp(secretApiKey: 'your_secret_api_key', http: http);

๐Ÿšจ WARNING ๐Ÿšจ Your secretApiKey is confidential and meant to be used by you. Anyone who has your project key can access your merchant. Please, do not share it or commit it in your code.

Methods

getMe

Get the current merchant info.

final me = await telepay.getMe();
getAssets

Get all the assets suported by TelePay.

final assets = await telepay.getAssets();
getBalance

Get the balance of the all your wallets.

final balance = await telepay.getBalance();
getInvoices

Get all the invoices the your merchant.

final invoices = await telepay.getInvoices();
createInvoice

Creates an invoice, associated to your merchant.

final invoiceCreate = await telepay.createInvoice(
    const CreateInvoice(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 3.5,
    ),
);
getInvoice

Get a specific invoice etails, by invoice number.

final invoice = await telepay.getInvoice('YYXZT1U7Q2P8');
cancelInvoice

Cancel invoice, by its number.

final invoiceCancel = await telepay.cancelInvoice('FNGUA7LR6B');
deleteInvoice

Delete invoice, by its number.

final isDelete = await telepay.deleteInvoice('FNGUA7LR6BYYY');
transfer

Create a tranferent between internal wallets, thsi is a off-chain operation

final transfer = await telepay.transfer(
    const CreateTransfer(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 3.5,
        username: 'yeikel16',
    ),
);
getWithdrawMinimum

Get minimum fee for a specific asset for withdraw.

final withdrawMin =
    await telepay.getWithdrawMinimum('TON', 'TON', 'testnet');
getWithdrawFee

Get estimated withdraw fee, composed of blockchain fee and processing fee.

final withdrawFee = await telepay.getWithdrawFee(
    const CreateWithdraw(
        asset: 'TON',
        blockchain: 'TON',
        network: 'testnet',
        amount: 5.2,
        toAddress: 'EQAwEl_ExMqFJIjfitPRPTdV_B9KTgHG-YognX6iKRWHdpX1',
    ),
);

Running Tests ๐Ÿงช

To run all unit tests use the following command:

dart test --coverage="/coveraga" --test-randomize-ordering-seed random

To view the generated coverage report you can use coverde.

# Filter the tested files.
coverde filter -f \.g\.dart

# Generate Coverage Report and open in browser.
coverde report -l

Bugs or Requests

If you want to report a problem or would like to add a new feature, feel free to open an issue on GitHub. Pull requests are also welcome.

Libraries

telepay_http