Coder Social home page Coder Social logo

js-gas-library-asaas-integration's Introduction

[Library for Google Apps Script] Asaas Payment Integration

Integrate with a handful Payment API to manage payments workflows. This library allows to CRUD on the customers endpoint and then use the payments and installments endpoints to manage payments requests.

TBD:

  • Installments
  • Refunds
  • Money Received
  • Service Logger
  • ERRORS

Using the Library

There are two ways to import the library to your project:

  • Set in your script project dashboard
  • Add the configuration into your appsscript.json
  1. Script Id:
1LFQVmSJVu-3QhsZIKo-cp_i39uRDxrFkZ63fUwpMdQeyVR0ulCs4ZJfF
  1. Add the latest version: for example, 6
  2. Use the identifier AsaasIntegration

These actions will update your appsscript.json.

Or, you can update it directly adding to the dependencies object:

"dependencies": {
    "libraries": [
      {
        "userSymbol": "AsaasIntegration",
        "version": "6",
        "libraryId": "1LFQVmSJVu-3QhsZIKo-cp_i39uRDxrFkZ63fUwpMdQeyVR0ulCs4ZJfF"
      }
    ]
}

The script runs in the timezone Etc/GMT.

Asaas

Configuring the API Key

For each API call pass the configuration parameters:

const config = {
  isProduction: true, // or false for SANDBOX
  apiKey: ASAAS_API_KEY,
};

Endpoints

Customers

Methods:

  • CustomerCreate(customer, config)
  • CustomerRead(id, config)
  • CustomerUpdate(id, customer, config)
  • CustomerRemove(id, config)

The id is the returned by the CustomerCreate method.

The customer object is given by:

const customer = {
  name: "fullname",
  email: "email",
  mobilePhone: "cellphone",
  cpfCnpj: "documentId",
  postalCode: "postalCode",
  addressNumber: "s/n",
  notificationDisabled: true,
  emailEnabledForProvider: false,
  smsEnabledForProvider: false,
  emailEnabledForCustomer: false,
  smsEnabledForCustomer: false,
  phoneCallEnabledForCustomer: false,
  foreignCustomer: false,
};

where the following parameters are set as default values:

{
  addressNumber: "s/n",
  notificationDisabled: true,
  emailEnabledForProvider: false,
  smsEnabledForProvider: false,
  emailEnabledForCustomer: false,
  smsEnabledForCustomer: false,
  phoneCallEnabledForCustomer: false,
  foreignCustomer: false,
}

Payments

Methods:

  • PaymentCreate(payment, config)
  • PaymentRead(id, config)
  • PaymentUpdate(id, payment, config)
  • PaymentRemove(id, config)

The id is the returned by the PaymentCreate method.

Utilities:

  • PaymentGetBarCode(id, config)
  • PaymentGetPixCode(id, config)

The payment object is given by:

const payment = {
  customer: "customerId",
  dueDate: "2023-01-01",
  value: 300,
  description: "Put a description here.",
  billingType: "UNDEFINED",
  postalService: false,
};

where the following parameters are set as default values:

{
  billingType: "UNDEFINED",
  postalService: false,
}

Installments

TBD.

Logging

TBD.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.