1.0.0 • Published 3 years ago

juno-api-wrapper v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

Juno API Wrapper

A Wrapper for Juno API

Installation

$ npm install --save juno-api-wrapper

$ yarn add juno-api-wrapper

API

getAccessToken

Returns the oauth token to be used on Juno constructor.

Example

  import { getAccessToken } from 'juno-api-wrapper'

  const token = await getAccessToken(clientId: string, clientSecret: string, isSandbox: boolean)

Juno

Creates a new Juno instance.

Arguments

<options> - JavaScript Object with configuration options
Options
accessToken: string - oauth token, got with getAccessToken method

resourceToken: string - private token, generated on Juno platform

isSandbox: boolean - if you only want to test your API, set to true; default === false

Example

  import { getAccesToken, Juno } from 'juno-api-wrapper'

  const token = await getAccesToken(clientId, clientSecret);

  const options = {
    accessToken: token,
    resourceToken: process.env.TOKEN,
  };

  const juno = new Juno(options);

  // returns a balance object
  // {
  //   balance: number;
  //   withheldBalance: number;
  //   transferableBalance: number;
  // }
  juno.getBalance(): Promise

  // returns a list of available banks
  // { name: string; number: string }[]
  juno.listBanks(): Promise

  // creates a charge
  // receiveis 2 arguments:
  //
  // newCharge = {
  //   description: string;
  //   amount: string;
  //   installments: number;
  //   paymentType: 'BOLETO' | 'CREDIT_CARD';
  // }
  //
  // billing = {
  //   name: string;
  //   document: string; CPF | CNPJ
  //   email: string;
  //   phone: string;
  // }
  //
  // return an array of Charges
  juno.createCharge(newCharge, billing): Promise

  // returns the charges status
  //
  // response = {
  //   amount: number;
  //   payments: {
  //     id: string;
  //     code: number;
  //     status: string;
  //     date: string;
  //     amount: number;
  //     transactionId: string;
  //     failReason: string;
  //   }[];
  // }
  juno.checkChargeStatus(chargeId: string): Promise
1.0.0

3 years ago

0.4.1

3 years ago

0.3.9

3 years ago

0.4.0

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.8

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.2

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago