Giter Club home page Giter Club logo

cielo-module's Introduction

cielo-module

Api de integracao com o sistema de pagamento da Cielo desenvolvida em JAVA.

Exemplo de uso para integração buyCielo Page

  public static void main(String[] args) throws ParseException {
        CieloWebServiceImpl service = new CieloWebServiceImpl();
        CieloResponse cieloResponse = service.newTransaction(getTransaction());
      
        System.out.println(ToStringBuilder.reflectionToString(cieloResponse.getTransaction(), ToStringStyle.MULTI_LINE_STYLE));
        System.out.println(cieloResponse.getTransaction().getUrlAuthentication());
  }

  private static CieloTransaction getTransaction() throws ParseException {
        Calendar calendar = DatatypeConverter.parseDateTime("2013-04-09T11:43:37");

        CieloOrder cieloOrder = CieloOrder.build().withNumber("12345")
                    .withAmount(100000l)
                    .withCurrency(Currency.REAL)
                    .withDate(calendar.getTime())
                    .withLang(Language.EN);

        CieloPayment cieloPayment = CieloPayment.build().withCreditCardType(CreditCardType.VISA)
                    .withPlots(3)
                    .withModality(Modality.INSTALLMENTS_BUSINESS_STABLISHMENT);

        CieloTransaction cieloTransaction = CieloTransaction.build().withOrder(cieloOrder)
                    .withPayment(cieloPayment);

        cieloTransaction.setCapture(Boolean.TRUE);

        return cieloTransaction;
 }

A api irá buscar as configurações dentro do arquivo cielo-config.properties dentro do seu resources (src/java/resources) segue as chaves que deve estar no arquivo:

cielo.establishment.number=1001734898 cielo.establishment.key=e84827130b9837473681c2787007da5914d6359947015a5cdb2b8843db0fa832 cielo.url.to.return=http://localhost/back
cielo.url.webservice=https://qasecommerce.cielo.com.br/servicos/ecommwsec.do

Para recuperar uma venda com o TID devolvido na resposta da criação use:

String tid = "10017348980976562003";
//getTransaction().getbEstablishment() - Essa chamada ira recuperar os dados do estabelecimento do arquivo cielo-config.properties.

CieloResponse cieloResponse = service.findTransaction(tid, getTransaction().getbEstablishment());

cielo-module's People

Contributors

mmaico avatar

Watchers

James Cloos avatar Maven Inventing 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.