Skip to content

Latest commit

 

History

History
571 lines (470 loc) · 16.1 KB

README.md

File metadata and controls

571 lines (470 loc) · 16.1 KB

CoinForBarter NodeJs Library

CoinForBarter Nodejs Library - Integrate and Manage cryptocurrency payments for goods and services

License, MIT npm, coinforbarter-node yarn, coinforbarter-node

Table of Contents


About


This is a NodeJs package for implementing CoinForBarter.

Getting Started


These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. See references for links to dashboard and API documentation.

Installation


$ npm install coinforbarter-node

# or
$ yarn add coinforbarter-node

Usage


const CoinForBarter = require('coinforbarter-node');

const publicKey = 'xxxxxxxxxxxxx';
const privateKey = 'xxxxxxxxxxxxx';
const secretHash = 'xxxxxxxxxxxxx';
const coinforbarter = new CoinForBarter(publicKey, privateKey, secretHash);

# An example to get all customers
const customers = coinforbarter.Customer.findAll();

Services and Methods


  1. Customer

This method handles all customers related to your account. The methods exposed by this service are listed below. See customer object properties

  • findAll

This method gets the list of all customers.

const query = {};
const getAllCustomers = async () => { 
      return await coinforbarter.Customer.findAll(query);
}

See list of query parameters

  • findOne

This method gets a particular customer by id.

const query = {};
const customerId = '';
const getCustomer = async (customerId) => { 
      return await coinforbarter.Customer.findOne(customerId);
}

See list of query parameters

  • create

This method creates a customer.

const params = {};
const createCustomer = async (params) => { 
      return await coinforbarter.Customer.create(params);
}

See customer parameters

  • update

This method updates a customer.

const params = {};
const updateCustomer = async (params) => { 
      return await coinforbarter.Customer.update(params);
}

See customer update parameters

  1. BankAccount

This method handles all bank account related to your account. The methods exposed by this service are listed below. See bank account object properties

  • getBankAccountName

const query = {};
const getBankAccountName = async () => { 
      return await coinforbarter.BankAccount.getBankAccountName(query);
}

See list of query parameters

  • create

const parms = {};
const createBankAccount = async (parms) => { 
      return await coinforbarter.BankAccount.create(parms);
}

See list of query parameters

  • findAll

This method gets the list of all bank accounts.

const query = {};
const getAllBankAccounts = async () => { 
      return await coinforbarter.BankAccount.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const bankAccountId = '';
const getBankAccount = async (bankAccountId) => { 
      return await coinforbarter.BankAccount.findOne(bankAccountId);
}

See list of query parameters

  • makePrimary

const parms = {};
const bankAccountId = '';
const makePrimary = async (bankAccountId) => { 
      return await coinforbarter.BankAccount.makePrimary(bankAccountId);
}

See list of query parameters

  • getBanks

const query = {};
const countryCode = '';
const getBank = async (countryCode) => { 
      return await coinforbarter.BankAccount.getBanks(countryCode);
}

See list of query parameters

  1. Payment

This method handles all payments related to your account. The methods exposed by this service are listed below. See payment object properties

  • findOne

const query = {};
const paymentId = '';
const getPayment = async (paymentId) => { 
      return await coinforbarter.Payment.findOne(paymentId);
}

See list of query parameters

  • create

const params = {};
const createPayment = async (params) => { 
      return await coinforbarter.Payment.create(params);
}

See list of query parameters

  • setCurrency

const params = {};
const setCurrency = async (params) => { 
      return await coinforbarter.Payment.setCurrency(params);
}

See list of query parameters

  • lockCurrency

const paymentId = '';
const lockCurrency = async (paymentId) => { 
      return await coinforbarter.Payment.lockCurrency(paymentId);
}

See list of query parameters

  • getPaymentUpdates

const query = {};
const getAllBankAccount = async () => { 
      return await coinforbarter.Payment.getPaymentUpdates(query);
}

See list of query parameters

  • cancel

const query = {};
const paymentId = async () => { 
      return await coinforbarter.Payment.cancel(query);
}

See list of query parameters

  1. PaymentPlan

  • findAll

const query = {};
const getAllPaymentPlan = async () => { 
      return await coinforbarter.PaymentPlan.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const getPaymentPlan = async () => { 
      return await coinforbarter.PaymentPlan.findOne(query);
}

See list of query parameters

  • create

const params = {};
const createPaymentPlan = async () => { 
      return await coinforbarter.PaymentPlan.create(params);
}

See list of query parameters

  • update

const params = {};
const updatePaymentPlan = async (params) => { 
      return await coinforbarter.PaymentPlan.update(params);
}

See list of query parameters

  1. PaymentPlanSubscriber

  • create

const params = {};
const createPaymentPlanSubscriber = async () => { 
      return await coinforbarter.PaymentPlanSubscriber.create(query);
}

See list of query parameters

  • findOne

const query = {};
const paymentPlanSubscriberId = '';
const getPaymentPlanSubscriber = async (paymentPlanSubscriberId) => { 
      return await coinforbarter.PaymentPlanSubscriber.findOne(paymentPlanSubscriberId);
}

See list of query parameters

  • findAll

const query = {};
const getAllPaymentPlanSubscriber = async () => { 
      return await coinforbarter.PaymentPlanSubscriber.findAll(query);
}

See list of query parameters

  • remove

const paymentPlanSubscriberId = '';
const removePaymentPlanSubscriber = async () => { 
      return await coinforbarter.PaymentPlanSubscriber.remove(paymentPlanSubscriberId);
}

See list of query parameters

  1. Payout

  • findAll

const query = {};
const getAllPayout = async () => { 
      return await coinforbarter.Payout.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const payOutId = '';
const getPayout = async (payOutId) => { 
      return await coinforbarter.Payout.findOne(payOutId);
}

See list of query parameters

  1. Transaction

  • findAll

const query = {};
const getAllTransactions = async () => { 
      return await coinforbarter.Transaction.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const transactionId = '';
const getTransaction = async (transactionId) => { 
      return await coinforbarter.Transaction.findOne(transactionId);
}

See list of query parameters

  • verify

const transactionId = '';
const verifyTransaction = async (transactionId) => { 
      return await coinforbarter.Transaction.verify(transactionId);
}

See list of query parameters

  • events

const query = {};
const getEvent = async () => { 
      return await coinforbarter.Transaction.events(query);
}

See list of query parameters

  • getFee

const transactionId = {};
const getfeeForTransaction = async (transactionId) => { 
      return await coinforbarter.Transaction.getFee(transactionId);
}

See list of query parameters

  • webhook

const transactionId = {};
const transaction = async (transactionId) => { 
      return await coinforbarter.Transaction.webhook(transactionId);
}

See list of query parameters

  1. Transfer

  • findAll

const query = {};
const getAllTransfer = async () => { 
      return await coinforbarter.Transfer.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const transferId = '';
const getTransfer = async (transferId) => { 
      return await coinforbarter.Transfer.findOne(transferId);
}

See list of query parameters

  • create

const params = {};
const createTransfer = async (params) => { 
      return await coinforbarter.Transfer.findAll(params);
}

See list of query parameters

  • getFee

const query = {};
const getFeeForTransfer = async () => { 
      return await coinforbarter.Transfer.getFee(query);
}

See list of query parameters

  1. WalletAddress

  • create

const params = {};
const createWalletAddress = async (params) => { 
      return await coinforbarter.WalletAddress.create(params);
}

See list of query parameters

  • findAll

const query = {};
const getAllWalletAddress = async () => { 
      return await coinforbarter.WalletAddress.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const walletId = '';
const getWalletAddress = async (walletId) => { 
      return await coinforbarter.WalletAddress.findOne(walletId);
}

See list of query parameters

  • makePrimary

const query = {};
const walletAddressId = '';
const makeWalletAddressPrimary = async (walletAddressId) => { 
      return await coinforbarter.WalletAddress.makePrimary(walletAddressId);
}

See list of query parameters

  1. Wallet

  • findAll

const query = {};
const getAllWallet = async () => { 
      return await coinforbarter.Wallet.findAll(query);
}

See list of query parameters

  • findOne

const query = {};
const walletId = '';
const getWallet = async (walletId) => { 
      return await coinforbarter.Wallet.findOne(walletId);
}

See list of query parameters

  • create

const params = {};
const createWallet = async (params) => { 
      return await coinforbarter.Wallet.create(params);
}

See list of query parameters

  • delete

const query = {};
const deleteWallet = async () => { 
      return await coinforbarter.Wallet.delete(query);
}

See list of query parameters

  1. Misc

  • getCountries

const query = {};
const getCountriesMisc = async () => { 
      return await coinforbarter.Misc.getCountries(query);
}

See list of query parameters

  • getBalance

const query = {};
const getBalanceMisc = async () => { 
      return await coinforbarter.Misc.getBalance(query);
}

See list of query parameters

  • getCurrencies

const query = {};
const getCurrenciesMisc = async () => { 
      return await coinforbarter.Misc.getCurrencies(query);
}

See list of query parameters

This SDK can be used closely with the official API Reference. All services and methods can be called this way

const customers = c4b.Customer.findAll();

i.e

 c4b:{
    [service]:method
 }

# I will do more on documenting each method till i can complete it 😂

Built Using


  • Typescript

CoinForBarter API References

Stay in Touch

Contributions are open, meta properties are not being returned yet by this SDK. You can send me an email via [email protected]