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

asaas-node

v0.0.8

Published

It is an unofficial integreation with asaas.com Rest API

Downloads

20

Readme

ASAAS-NODE

The project is an unofficial wrapper for the ASAAS.com Rest API. The project is using RxJS, so you must know something about.

Getting Started

To-Do

  • [x] Customer API
  • [x] Payments Api
  • [ ] Subscription Billing
  • [x] Notifications

Installing

npm install --save asaas-node

Example

How to use:

const asaas = require('asaas-node');
const api = new asaasAPI('sandbox', YOUR_API_KEY);
/* you can use 'production'
instead of 'sandbox'.
The API_KEI must be from the correct environment.
*/

//Get Customer APIs
const customer = api.customer;

Adding a new customer :

const customerInfo = {
	name: 'Bruce Wayne',
	cpfCnpj: '37132385615',
	email: '[email protected]'
}

customer.new(customerInfo)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);
'customerInfo' is an object with all the props that Asaas accepts.

Deleting a customer:

customer.delete(customerId)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);
'customerId' is a string.

Getting a customer:

customer.get(cusutomerId)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

Updating a customer:

customerId : the id of the customer
customerInfo: the object with the props to update.
customer.update(customerId, customerInfo)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

Getting List.

customerPropsFilters: the object with the filters props.
customer.getList(customerPropsFilter)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

Payments Examples

The same logic is applied

//Get Payments APIs
const payments = api.payments;

The methods:

payments.new(paymentInfo)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

/* If you need create more than one payment, you can pass an Array<paymentInfo>.
All the response will be in the responseArray.
This pipeline will not generate nothing in (err) for bad request, the error will be
in the responseArray.
*/
payments.newBatch(paymentsInfo)
	.subscribe(
		(responseArray) => console.log(responseArray)
		);

payments.newSplit(paymentInfo, splitInfo)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

payments.get(paymentId)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

payments.delete(paymentId)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

payments.getList(filters)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

payments.update(id, params)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

payments.refund(id)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

Notification

	//Get Notification APIs
const notification = api.notification;
notification.get(customerId)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

notification.update(id, params)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);

Accounts

//Get accounts APIs
const accounts = api.accounts;
accounts.new(accountInfo)
	.subscribe(
		(body) => console.log(body),
		(err) => console.log(err)
	);