Code Monkey home page Code Monkey logo

braspag's Introduction

Braspag

Módulo de integração ao Braspag com Node.js

Instalação

npm install braspag

Exemplo completo de como usar

// Callback genérico para mostrar o retorno da bp
var callback = function(err, res){
  if(err){console.log(err);}
  console.log(res);
}

// Inicializar a função com os dados de acesso e o ambiente a ser usado
var bp = require('braspag');

var braspag = new bp({
  env: "sandbox", // production(ambiente de produção), homolog(ambiente de homologação) ou sandbox(ambiente de teste)
  proxy: "http://xyz:3190",
  merchantId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  merchantKey: "XXXXXXXXXDCYWUNFPTSGVRXIWOWDNXXXXXXXXXX"
});

// Criando uma venda simplificada
braspag.create({
  "MerchantOrderId":"2014111703",
  "Customer":{
    "Name":"Comprador Teste"
  },
  "Payment":{
    "Type":"CreditCard",
    "Amount":15700,
    "Provider":"Simulado",
    "Installments":1,
    "CreditCard":{
      "CardNumber":"1234123412341231",
      "Holder":"Teste Holder",
      "ExpirationDate":"12/2021",
      "SecurityCode":"123",
      "Brand":"Visa"
    }
  }
}, callback);

// Consultando uma venda
braspag.consult("c7f0752c-ed27-4f7f-9493-21dcd84ef914", callback);

// Capturando uma venda
braspag.capture("c7f0752c-ed27-4f7f-9493-21dcd84ef914", callback);

// Cancelando uma venda
braspag.cancel("c7f0752c-ed27-4f7f-9493-21dcd84ef914", callback);

braspag's People

Contributors

lohanbodevan avatar rodrigorizandobr avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.