Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
incarnate committed Dec 23, 2015
0 parents commit f09eb83
Show file tree
Hide file tree
Showing 112 changed files with 6,234 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
*.gem
*.rbc
/.config
coverage
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

/.yardoc
/_yardoc/
/doc/
/rdoc/

/.bundle/
/vendor/bundle
/lib/bundler/man/

/Gemfile.lock
.idea
.ruby-version
.ruby-gemset
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2
- jruby-19mode

before_install: gem install bundler -v 1.10.6

sudo: false
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes will be documented in this file

## 1.0.0

- First release
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gemspec
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2015 Web Active Corporation Pty Ltd

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# eWAY Rapid Ruby Library

[![Latest Version on RubyGems][ico-version]][link-rubygems]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]

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

Sign up with eWAY at:
- Australia: https://www.eway.com.au/
- New Zealand: https://eway.io/nz/
- UK: https://eway.io/uk/
- Hong Kong: https://eway.io/hk/
- Malaysia: https://eway.io/my/
- Singapore: https://eway.io/sg/

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

## Installation

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

Add this line to your application's Gemfile:

```ruby
gem 'eway_rapid'
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install eway_rapid
```

## Usage

See the [eWAY Rapid API Reference](https://eway.io/api-v3/?ruby) for usage details.

A simple Direct payment:

```ruby
require 'eway_rapid'

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

client = RapidSDK::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, basic_direct)

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](CHANGELOG.md) for more information what has changed recently.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://img.shields.io/gem/v/eway_rapid.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/eWAYPayment/eway-rapid-ruby/master.svg?style=flat-square

[link-rubygems]: https://rubygems.org/gems/eway_rapid
[link-travis]: https://travis-ci.org/eWAYPayment/eway-rapid-ruby
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'bundler/gem_tasks'
require 'rake/testtask'

task :default => [:test]

Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList[File.join('test', '**', '*test.rb')]
t.verbose = true
end

task :gem do
exec('gem build eway_rapid.gemspec')
end
26 changes: 26 additions & 0 deletions eway_rapid.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'eway_rapid/version'

Gem::Specification.new do |spec|
spec.name = 'eway_rapid'
spec.version = EwayRapid::VERSION
spec.required_ruby_version = '>= 1.9.3'
spec.author = ['eWAY']
spec.summary = 'Ruby gem for eWAY\'s Rapid API'
spec.description = 'Easy online payments with eWAY and the eWAY Rapid Ruby gem.'
spec.homepage = 'https://www.eway.com.au'
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.require_paths = ['lib']

spec.add_dependency 'rest-client', '~> 1.8'
spec.add_dependency 'json', '~> 1.8.3'

spec.add_development_dependency 'bundler', '~> 1.10'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'test-unit'
spec.add_development_dependency 'simplecov'
end
78 changes: 78 additions & 0 deletions lib/eway_rapid.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# eWAY Rapid API Ruby Module
require 'json'
require 'rest-client'
require 'yaml'

require File.join(File.dirname(__FILE__), 'eway_rapid', 'version')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'constants')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'exceptions')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'rapid_logger')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'rapid_client')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'enums')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'models')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'internal_models')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'response_output')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'create_transaction_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_customer_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_transaction_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'refund_response')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'capture_payment_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'capture_payment_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_shared_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_shared_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_customer_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_customer_search_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_customer_search_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_payment_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_payment_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'transaction_search_response')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'customer_to_internal_customer')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_payment_to_trans_status')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_refund_to_trans_status')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_customer_to_customer')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_trans_to_trans')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_address')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_status')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'payment_to_payment_details')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'shipping_details_to_address')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_shipping_address')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_arr_line_item')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_arr_option')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_payment')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'verification_to_verification_result')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'refund_to_direct_refund_req')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_capture_payment')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_create_access_code_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_create_access_code_shared_request')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_direct_payment')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_shared_to_create_cust')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_shared_to_create_trans')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_to_create_cust')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_to_create_trans')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'cancel_authorisation_to_refund')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'capture_payment_to_create_transaction')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_customer_to_query_customer')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_cust')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_trans')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_refund_to_refund_response')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'search_to_query_trans')

require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'rest_process')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'customer_process')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'refund_process')
require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'transaction_process')

module EwayRapid
end
Loading

0 comments on commit f09eb83

Please sign in to comment.