Git Product home page Git Product logo

puntopagos-ruby's Introduction

PuntoPagos

This development is in a very early stage, please use it at your own risk and feel free to improve it and send Pull Requests.

Installation

If your are using a Gemfile add the following line and run the bundle command.

gem "puntopagos"

Create puntopagos.yml to your config folder:

development:
  environment:        "sandbox"
  puntopagos_key:     "YOUR-API-KEY"
  puntopagos_secret:  "YOUR-APP-SECRET"
test:
  environment:        "sandbox"
  puntopagos_key:     "YOUR-API-KEY"
  puntopagos_secret:  "YOUR-APP-SECRET"
production:
  environment:        "production"
  puntopagos_key:     "YOUR-API-KEY"
  puntopagos_secret:  "YOUR-APP-SECRET"

Sample Usage

Create a Transaction and Redirect to process url

  trx_id         = 'UNIQUE-TRACKING-ID' # Number as a string
  amount         = '1000.00'            # Number as a string with two decimals
  payment_method = 'some number'        # Optional parameter (see PuntoPagos documentation)
  req = PuntoPagos::Request.new()
  resp = req.create(trx_id, amount, payment_method)
	if (resp.success?)
	  redirect_to resp.payment_process_url
	end

Verify notification sent by PuntoPagos

  # Action where PuntoPagos it's gonna post
  def action
    notification = PuntoPagos::Notification.new
    # This methods requires the headers as a hash and the params object as a hash
    notification.valid? headers, params
  end

Check status of a transaction

  status = PuntoPagos::Status.new
  status.check token, trx_id, amount
  status.valid?  # if there's an error you can call status.error

Test Data

Gateway Payload Expected Result
Transbank Visa / 4051885600446623 / CVV: 123 / exp: any Success
Transbank Mastercard / 5186059559590568 / CVV: 123 / exp: any Failure

TODO

  • Config testing
  • Response testing
  • Functional testing
  • Documentation

Credits

Ignacio Mella & Gert Findel

Special Thanks

Thanks to dvinales for not suing us.

puntopagos-ruby's People

Contributors

imella avatar gertfindel avatar

Watchers

James Cloos avatar Luis Briones 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.