Giter VIP home page Giter VIP logo

eway-rapid-ruby's Introduction

eWAY Rapid Ruby Library

Latest Version on RubyGems Software License Build Status

A Ruby Gem to integrate with eWAY's Rapid Payment API.

Sign up with eWAY at:

For testing, get a free eWAY Partner account: https://www.eway.com.au/developers

Installation

The eWAY Ruby Gem requires Ruby 2.0.0 or better, it also requires the rest-client and json gems.

Add this line to your application's Gemfile:

gem 'eway_rapid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install eway_rapid

Usage

See the eWAY Rapid API Reference for usage details.

A simple Direct payment:

require 'eway_rapid'

api_key = 'Rapid API Key'
password = 'Rapid API Password'
endpoint = 'sandbox'

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
transaction.customer = EwayRapid::Models::Customer.new

card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'Ruby Dev'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '22'
card_details.cvn = '123'
transaction.customer.card_details = card_details

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

if response.transaction_status.status?
 puts "Success! ID: #{response.transaction_status.transaction_id.to_s}"
end

Testing

All tests can be run by first installing all dependencies with bundle install then running bundle exec rake

Change log

Please see CHANGELOG for more information what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

eway-rapid-ruby's People

Contributors

incarnate avatar brocktimus 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.