eway_rapid 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.travis.yml +11 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE.md +21 -0
  7. data/README.md +96 -0
  8. data/Rakefile +14 -0
  9. data/eway_rapid.gemspec +26 -0
  10. data/lib/eway_rapid.rb +78 -0
  11. data/lib/eway_rapid/constants.rb +126 -0
  12. data/lib/eway_rapid/entities/cancel_authorisation_request.rb +9 -0
  13. data/lib/eway_rapid/entities/cancel_authorisation_response.rb +34 -0
  14. data/lib/eway_rapid/entities/capture_payment_request.rb +11 -0
  15. data/lib/eway_rapid/entities/capture_payment_response.rb +34 -0
  16. data/lib/eway_rapid/entities/create_access_code_request.rb +35 -0
  17. data/lib/eway_rapid/entities/create_access_code_response.rb +128 -0
  18. data/lib/eway_rapid/entities/create_access_code_shared_request.rb +53 -0
  19. data/lib/eway_rapid/entities/create_access_code_shared_response.rb +40 -0
  20. data/lib/eway_rapid/entities/create_customer_response.rb +8 -0
  21. data/lib/eway_rapid/entities/direct_customer_search_request.rb +9 -0
  22. data/lib/eway_rapid/entities/direct_customer_search_response.rb +23 -0
  23. data/lib/eway_rapid/entities/direct_payment_request.rb +29 -0
  24. data/lib/eway_rapid/entities/direct_payment_response.rb +58 -0
  25. data/lib/eway_rapid/entities/direct_refund_request.rb +26 -0
  26. data/lib/eway_rapid/entities/direct_refund_response.rb +44 -0
  27. data/lib/eway_rapid/entities/transaction_search_response.rb +23 -0
  28. data/lib/eway_rapid/exceptions.rb +51 -0
  29. data/lib/eway_rapid/message/convert/customer_to_internal_customer.rb +70 -0
  30. data/lib/eway_rapid/message/convert/direct_payment_to_trans_status.rb +47 -0
  31. data/lib/eway_rapid/message/convert/direct_refund_to_trans_status.rb +33 -0
  32. data/lib/eway_rapid/message/convert/internal_customer_to_customer.rb +41 -0
  33. data/lib/eway_rapid/message/convert/internal_trans_to_trans.rb +62 -0
  34. data/lib/eway_rapid/message/convert/internal_transaction_to_address.rb +27 -0
  35. data/lib/eway_rapid/message/convert/internal_transaction_to_status.rb +55 -0
  36. data/lib/eway_rapid/message/convert/payment_to_payment_details.rb +25 -0
  37. data/lib/eway_rapid/message/convert/request/refund_to_direct_refund_req.rb +41 -0
  38. data/lib/eway_rapid/message/convert/request/transaction_to_capture_payment.rb +28 -0
  39. data/lib/eway_rapid/message/convert/request/transaction_to_create_access_code_request.rb +58 -0
  40. data/lib/eway_rapid/message/convert/request/transaction_to_create_access_code_shared_request.rb +54 -0
  41. data/lib/eway_rapid/message/convert/request/transaction_to_direct_payment.rb +45 -0
  42. data/lib/eway_rapid/message/convert/response/access_code_shared_to_create_cust.rb +23 -0
  43. data/lib/eway_rapid/message/convert/response/access_code_shared_to_create_trans.rb +28 -0
  44. data/lib/eway_rapid/message/convert/response/access_code_to_create_cust.rb +24 -0
  45. data/lib/eway_rapid/message/convert/response/access_code_to_create_trans.rb +27 -0
  46. data/lib/eway_rapid/message/convert/response/cancel_authorisation_to_refund.rb +37 -0
  47. data/lib/eway_rapid/message/convert/response/capture_payment_to_create_transaction.rb +43 -0
  48. data/lib/eway_rapid/message/convert/response/direct_customer_to_query_customer.rb +55 -0
  49. data/lib/eway_rapid/message/convert/response/direct_payment_to_create_cust.rb +23 -0
  50. data/lib/eway_rapid/message/convert/response/direct_payment_to_create_trans.rb +32 -0
  51. data/lib/eway_rapid/message/convert/response/direct_refund_to_refund_response.rb +28 -0
  52. data/lib/eway_rapid/message/convert/response/search_to_query_trans.rb +30 -0
  53. data/lib/eway_rapid/message/convert/shipping_details_to_address.rb +35 -0
  54. data/lib/eway_rapid/message/convert/transaction_shipping_address.rb +37 -0
  55. data/lib/eway_rapid/message/convert/transaction_to_arr_line_item.rb +14 -0
  56. data/lib/eway_rapid/message/convert/transaction_to_arr_option.rb +25 -0
  57. data/lib/eway_rapid/message/convert/transaction_to_payment.rb +29 -0
  58. data/lib/eway_rapid/message/convert/verification_to_verification_result.rb +33 -0
  59. data/lib/eway_rapid/message/process/customer_process.rb +255 -0
  60. data/lib/eway_rapid/message/process/refund_process.rb +76 -0
  61. data/lib/eway_rapid/message/process/rest_process.rb +87 -0
  62. data/lib/eway_rapid/message/process/transaction_process.rb +139 -0
  63. data/lib/eway_rapid/models/enums.rb +126 -0
  64. data/lib/eway_rapid/models/internal_models.rb +431 -0
  65. data/lib/eway_rapid/models/models.rb +334 -0
  66. data/lib/eway_rapid/output/create_transaction_response.rb +24 -0
  67. data/lib/eway_rapid/output/query_customer_response.rb +25 -0
  68. data/lib/eway_rapid/output/query_transaction_response.rb +16 -0
  69. data/lib/eway_rapid/output/refund_response.rb +9 -0
  70. data/lib/eway_rapid/output/response_output.rb +14 -0
  71. data/lib/eway_rapid/rapid_client.rb +444 -0
  72. data/lib/eway_rapid/rapid_logger.rb +40 -0
  73. data/lib/eway_rapid/resources/err_code_resource_en.yml +237 -0
  74. data/lib/eway_rapid/resources/rapid-api.yml +4 -0
  75. data/lib/eway_rapid/version.rb +3 -0
  76. metadata +201 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 478acbee46e2da78654b8f5247e3c52e0b27c573
4
+ data.tar.gz: dd78e049b7ab567023388bf66ba32939a6db06b0
5
+ SHA512:
6
+ metadata.gz: 8fd579db7ef9c8b9e038323ce2c5870f25df693905e29d9fcff9a47874b0ffae3848a2cde2533447eaab5d435001642f33dd9aa3b7d44624444e0d35bc29ebd9
7
+ data.tar.gz: 8e7d254edee4fab2b0fc36b9c7bf30160ed97ad7bf7ebe6bf6a336387eb3582428147bb5c8703752bbbe5cb7dbcb838ec5b87249853b743275d753f0e173aef2
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ coverage
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ /.yardoc
14
+ /_yardoc/
15
+ /doc/
16
+ /rdoc/
17
+
18
+ /.bundle/
19
+ /vendor/bundle
20
+ /lib/bundler/man/
21
+
22
+ /Gemfile.lock
23
+ .idea
24
+ .ruby-version
25
+ .ruby-gemset
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - jruby-19mode
8
+
9
+ before_install: gem install bundler -v 1.10.6
10
+
11
+ sudo: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes will be documented in this file
4
+
5
+ ## 1.0.0
6
+
7
+ - First release
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Web Active Corporation Pty Ltd
4
+
5
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ > of this software and associated documentation files (the "Software"), to deal
7
+ > in the Software without restriction, including without limitation the rights
8
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ > copies of the Software, and to permit persons to whom the Software is
10
+ > furnished to do so, subject to the following conditions:
11
+ >
12
+ > The above copyright notice and this permission notice shall be included in
13
+ > all copies or substantial portions of the Software.
14
+ >
15
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ > THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # eWAY Rapid Ruby Library
2
+
3
+ [![Latest Version on RubyGems][ico-version]][link-rubygems]
4
+ [![Software License][ico-license]](LICENSE.md)
5
+ [![Build Status][ico-travis]][link-travis]
6
+
7
+ A Ruby Gem to integrate with eWAY's Rapid Payment API.
8
+
9
+ Sign up with eWAY at:
10
+ - Australia: https://www.eway.com.au/
11
+ - New Zealand: https://eway.io/nz/
12
+ - UK: https://eway.io/uk/
13
+ - Hong Kong: https://eway.io/hk/
14
+ - Malaysia: https://eway.io/my/
15
+ - Singapore: https://eway.io/sg/
16
+
17
+ For testing, get a free eWAY Partner account: https://www.eway.com.au/developers
18
+
19
+ ## Installation
20
+
21
+ The eWAY Ruby Gem requires Ruby 1.9.3 or better, it also requires the rest-client and json gems.
22
+
23
+ Add this line to your application's Gemfile:
24
+
25
+ ```ruby
26
+ gem 'eway_rapid'
27
+ ```
28
+
29
+ And then execute:
30
+
31
+ ```
32
+ $ bundle
33
+ ```
34
+
35
+ Or install it yourself as:
36
+
37
+ ```
38
+ $ gem install eway_rapid
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ See the [eWAY Rapid API Reference](https://eway.io/api-v3/?ruby) for usage details.
44
+
45
+ A simple Direct payment:
46
+
47
+ ```ruby
48
+ require 'eway_rapid'
49
+
50
+ api_key = 'Rapid API Key'
51
+ password = 'Rapid API Password'
52
+ endpoint = 'sandbox'
53
+
54
+ client = RapidSDK::RapidClient.new(api_key, password, endpoint)
55
+
56
+ transaction = EwayRapid::Models::Transaction.new
57
+ transaction.customer = EwayRapid::Models::Customer.new
58
+
59
+ card_details = EwayRapid::Models::CardDetails.new
60
+ card_details.name = 'Ruby Dev'
61
+ card_details.number = '4444333322221111'
62
+ card_details.expiry_month = '05'
63
+ card_details.expiry_year = '22'
64
+ card_details.cvn = '123'
65
+ transaction.customer.card_details = card_details
66
+
67
+ payment_details = EwayRapid::Models::PaymentDetails.new
68
+ payment_details.total_amount = 1000
69
+ transaction.payment_details = payment_details
70
+ transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE
71
+
72
+ response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, basic_direct)
73
+
74
+ if response.transaction_status.status?
75
+ puts "Success! ID: #{response.transaction_status.transaction_id.to_s}"
76
+ end
77
+ ```
78
+
79
+ ## Testing
80
+
81
+ All tests can be run by first installing all dependencies with `bundle install` then running `bundle exec rake`
82
+
83
+ ## Change log
84
+
85
+ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
86
+
87
+ ## License
88
+
89
+ The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
90
+
91
+ [ico-version]: https://img.shields.io/gem/v/eway-rapid.svg?style=flat-square
92
+ [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
93
+ [ico-travis]: https://img.shields.io/travis/eWAYPayment/eway-rapid-ruby/master.svg?style=flat-square
94
+
95
+ [link-rubygems]: https://rubygems.org/gems/eway-rapid
96
+ [link-travis]: https://travis-ci.org/eWAYPayment/eway-rapid-ruby
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ task :default => [:test]
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'test'
8
+ t.test_files = FileList[File.join('test', '**', '*test.rb')]
9
+ t.verbose = true
10
+ end
11
+
12
+ task :gem do
13
+ exec('gem build eway_rapid.gemspec')
14
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'eway_rapid/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'eway_rapid'
8
+ spec.version = EwayRapid::VERSION
9
+ spec.required_ruby_version = '>= 1.9.3'
10
+ spec.author = ['eWAY']
11
+ spec.summary = 'Ruby gem for eWAY\'s Rapid API'
12
+ spec.description = 'Easy online payments with eWAY and the eWAY Rapid Ruby gem.'
13
+ spec.homepage = 'https://www.eway.com.au'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'rest-client', '~> 1.8'
20
+ spec.add_dependency 'json', '~> 1.8.3'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.10'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'test-unit'
25
+ spec.add_development_dependency 'simplecov'
26
+ end
data/lib/eway_rapid.rb ADDED
@@ -0,0 +1,78 @@
1
+ # eWAY Rapid API Ruby Module
2
+ require 'json'
3
+ require 'rest-client'
4
+ require 'yaml'
5
+
6
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'version')
7
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'constants')
8
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'exceptions')
9
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'rapid_logger')
10
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'rapid_client')
11
+
12
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'enums')
13
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'models')
14
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'models', 'internal_models')
15
+
16
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'response_output')
17
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'create_transaction_response')
18
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_customer_response')
19
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'query_transaction_response')
20
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'output', 'refund_response')
21
+
22
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_request')
23
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'cancel_authorisation_response')
24
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'capture_payment_request')
25
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'capture_payment_response')
26
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_request')
27
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_response')
28
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_shared_request')
29
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_access_code_shared_response')
30
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'create_customer_response')
31
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_customer_search_request')
32
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_customer_search_response')
33
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_payment_request')
34
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_payment_response')
35
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_request')
36
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'direct_refund_response')
37
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'entities', 'transaction_search_response')
38
+
39
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'customer_to_internal_customer')
40
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_payment_to_trans_status')
41
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'direct_refund_to_trans_status')
42
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_customer_to_customer')
43
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_trans_to_trans')
44
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_address')
45
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'internal_transaction_to_status')
46
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'payment_to_payment_details')
47
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'shipping_details_to_address')
48
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_shipping_address')
49
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_arr_line_item')
50
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_arr_option')
51
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'transaction_to_payment')
52
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'verification_to_verification_result')
53
+
54
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'refund_to_direct_refund_req')
55
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_capture_payment')
56
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_create_access_code_request')
57
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_create_access_code_shared_request')
58
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'request', 'transaction_to_direct_payment')
59
+
60
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_shared_to_create_cust')
61
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_shared_to_create_trans')
62
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_to_create_cust')
63
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'access_code_to_create_trans')
64
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'cancel_authorisation_to_refund')
65
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'capture_payment_to_create_transaction')
66
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_customer_to_query_customer')
67
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_cust')
68
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_payment_to_create_trans')
69
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'direct_refund_to_refund_response')
70
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'convert', 'response', 'search_to_query_trans')
71
+
72
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'rest_process')
73
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'customer_process')
74
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'refund_process')
75
+ require File.join(File.dirname(__FILE__), 'eway_rapid', 'message', 'process', 'transaction_process')
76
+
77
+ module EwayRapid
78
+ end
@@ -0,0 +1,126 @@
1
+ module EwayRapid
2
+ module Constants
3
+ EMAIL = 'Email'
4
+ PHONE = 'Phone'
5
+ VALUE = 'Value'
6
+ TOTAL_AMOUNT = 'TotalAmount'
7
+ INVOICE_NUMBER = 'InvoiceNumber'
8
+ INVOICE_DESCRIPTION = 'InvoiceDescription'
9
+ INVOICE_REFERENCE = 'InvoiceReference'
10
+ CURRENCY_CODE = 'CurrencyCode'
11
+ ORIGINAL_TRANSACTION_ID = 'TransactionID'
12
+ FIRST_NAME = 'FirstName'
13
+ LAST_NAME = 'LastName'
14
+ STREET1 = 'Street1'
15
+ STREET2 = 'Street2'
16
+ CITY = 'City'
17
+ STATE = 'State'
18
+ COUNTRY = 'Country'
19
+ POSTAL_CODE = 'PostalCode'
20
+ FAX = 'Fax'
21
+ SHIPPING_METHOD = 'ShippingMethod'
22
+ CVN = 'CVN'
23
+ MOBILE = 'Mobile'
24
+ ADDRESS = 'Address'
25
+ SKU = 'SKU'
26
+ DESCRIPTION = 'Description'
27
+ QUANTITY = 'Quantity'
28
+ UNIT_COST = 'UnitCost'
29
+ TAX = 'Tax'
30
+ TOTAL = 'Total'
31
+ TOKEN_CUSTOMER_ID = 'TokenCustomerID'
32
+ REFERENCE = 'Reference'
33
+ TITLE = 'Title'
34
+ COMPANY_NAME = 'CompanyName'
35
+ JOB_DESCRIPTION = 'JobDescription'
36
+ COMMENTS = 'Comments'
37
+ URL = 'Url'
38
+ CARD_NUMBER = 'CardNumber'
39
+ CARD_START_MONTH = 'CardStartMonth'
40
+ CARD_START_YEAR = 'CardStartYear'
41
+ CARD_ISSUE_NUMBER = 'CardIssueNumber'
42
+ CARD_NAME = 'CardName'
43
+ CARD_EXPIRY_MONTH = 'CardExpiryMonth'
44
+ CARD_EXPIRY_YEAR = 'CardExpiryYear'
45
+ IS_ACTIVE = 'IsActive'
46
+ CARD_DETAILS = 'CardDetails'
47
+ CUSTOMER_DEVICE_IP = 'CustomerIP'
48
+ NAME = 'Name'
49
+ NUMBER = 'Number'
50
+ EXPIRY_MONTH = 'ExpiryMonth'
51
+ EXPIRY_YEAR = 'ExpiryYear'
52
+ START_MONTH = 'StartMonth'
53
+ START_YEAR = 'StartYear'
54
+ ISSUE_NUMBER = 'IssueNumber'
55
+ CUSTOMER_NOTE = 'CustomerNote'
56
+ AUTHORISATION_CODE = 'AuthorisationCode'
57
+ RESPONSE_CODE = 'ResponseCode'
58
+ RESPONSE_MESSAGE = 'ResponseMessage'
59
+ TRANSACTION_ID = 'TransactionID'
60
+ TRANSACTION_STATUS = 'TransactionStatus'
61
+ BEAGLE_SCORE = 'BeagleScore'
62
+ OPTIONS = 'Options'
63
+ VERIFICATION = 'Verification'
64
+ CUSTOMER = 'Customer'
65
+ SHIPPING_ADDRESS = 'ShippingAddress'
66
+ BEAGLE_VERIFICATION = 'BeagleVerification'
67
+ ERRORS = 'errors'
68
+ CUSTOMERS = 'Customers'
69
+ PAYMENT = 'Payment'
70
+ REQUEST_TRANSACTION_ID = 'TransactionId'
71
+ ITEMS = 'Items'
72
+ REDIRECT_URL = 'RedirectUrl'
73
+ METHOD = 'Method'
74
+ DEVICE_ID = 'DeviceID'
75
+ CHECKOUT_PAYMENT = 'CheckoutPayment'
76
+ CHECKOUT_URL = 'CheckoutUrl'
77
+ TRANSACTION_TYPE = 'TransactionType'
78
+ PARTNER_ID = 'PartnerID'
79
+ TRANSACTIONS = 'Transactions'
80
+ ERRORS_CAPITALIZED = 'Errors'
81
+ REFUND = 'Refund'
82
+ LINE_ITEMS = 'LineItems'
83
+ TRANSACTION_CAPTURED = 'TransactionCaptured'
84
+ FRAUD_ACTION = 'FraudAction'
85
+ ACCESS_CODE = 'AccessCode'
86
+ FORM_ACTION_URL = 'FormActionURL'
87
+ SHARED_PAYMENT_URL = 'SharedPaymentUrl'
88
+ COMPLETE_CHECKOUT_URL = 'CompleteCheckoutURL'
89
+ CANCEL_URL = 'CancelUrl'
90
+ LOGO_URL = 'LogoUrl'
91
+ HEADER_TEXT = 'HeaderText'
92
+ LANGUAGE = 'Language'
93
+ CUSTOMER_READ_ONLY = 'CustomerReadOnly'
94
+ CUSTOMER_VIEW = 'CustomView'
95
+ VERIFY_CUSTOMER_PHONE = 'VerifyCustomerPhone'
96
+ VERIFY_CUSTOMER_EMAIL = 'VerifyCustomerEmail'
97
+ JSON_SUFFIX = '.json'
98
+ LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE = 'S9990'
99
+ API_KEY_INVALID_ERROR_CODE = 'S9991'
100
+ COMMUNICATION_FAILURE_ERROR_CODE = 'S9992'
101
+ AUTHENTICATION_FAILURE_ERROR_CODE = 'S9993'
102
+ INTERNAL_RAPID_API_ERROR_CODE = 'S9995'
103
+ INTERNAL_RAPID_SERVER_ERROR_CODE = 'S9996'
104
+ ERROR_CODE_RESOURCE_EN = 'err_code_resource_en.yml'
105
+ RAPID_API_RESOURCE = 'rapid-api.yml'
106
+ RAPID_SDK_USER_AGENT_PARAM = 'rapid.sdk.user.agent'
107
+ GLOBAL_RAPID_PRODUCTION_REST_URL_PARAM = 'global.rapid.rest.production.url'
108
+ GLOBAL_RAPID_SANDBOX_REST_URL_PARAM = 'global.rapid.rest.sandbox.url'
109
+ RAPID_ENDPOINT_SANDBOX = 'Sandbox'
110
+ RAPID_ENDPOINT_PRODUCTION = 'Production'
111
+ DIRECT_PAYMENT_METHOD_NAME = 'DirectPayment'
112
+ RESPONSIVE_SHARED_METHOD_NAME = 'CreateAccessCodeShared'
113
+ TRANSPARENT_REDIRECT_METHOD_NAME = 'CreateAccessCode'
114
+ DIRECT_REFUND_METHOD_NAME = 'DirectRefund'
115
+ CANCEL_AUTHORISATION_METHOD_NAME = 'CancelAuthorisation'
116
+ CREATE_TOKEN_CUSTOMER_METHOD = 'CreateTokenCustomer'
117
+ UPDATE_TOKEN_CUSTOMER_METHOD = 'UpdateTokenCustomer'
118
+ CANCEL_AUTHORISATION_METHOD = 'CancelAuthorisation'
119
+ TRANSACTION_METHOD = 'Transaction'
120
+ DIRECT_CUSTOMER_SEARCH_METHOD = 'DirectCustomerSearch'
121
+ TRANSACTION_QUERY_WITH_INVOICE_NUM_METHOD = 'InvoiceNumber'
122
+ TRANSACTION_QUERY_WITH_INVOICE_REF_METHOD = 'InvoiceRef'
123
+ REFUND_SUB_PATH_METHOD = 'Refund'
124
+ CAPTURE_PAYMENT_METHOD = 'CapturePayment'
125
+ end
126
+ end
@@ -0,0 +1,9 @@
1
+ module EwayRapid
2
+ class CancelAuthorisationRequest
3
+ attr_accessor :transaction_id
4
+
5
+ def to_json(options={})
6
+ { Constants::REQUEST_TRANSACTION_ID => transaction_id }.to_json
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ module EwayRapid
2
+ class CancelAuthorisationResponse
3
+ attr_accessor :response_code
4
+ attr_accessor :response_message
5
+ attr_accessor :transaction_id
6
+ attr_accessor :transaction_status
7
+ attr_accessor :errors
8
+
9
+ alias_method :transaction_status?, :transaction_status
10
+
11
+ def to_json(options={})
12
+ { Constants::RESPONSE_CODE => response_code,
13
+ Constants::RESPONSE_MESSAGE => response_message,
14
+ Constants::TRANSACTION_ID => transaction_id,
15
+ Constants::TRANSACTION_STATUS => transaction_status,
16
+ Constants::ERRORS => errors }.to_json
17
+ end
18
+
19
+ def self.from_json(json)
20
+ hash = JSON.parse(json)
21
+ from_hash(hash)
22
+ end
23
+
24
+ def self.from_hash(hash)
25
+ cancel_authorisation_response = CancelAuthorisationResponse.new
26
+ cancel_authorisation_response.response_code = hash[Constants::RESPONSE_CODE]
27
+ cancel_authorisation_response.response_message = hash[Constants::RESPONSE_MESSAGE]
28
+ cancel_authorisation_response.transaction_id = hash[Constants::TRANSACTION_ID]
29
+ cancel_authorisation_response.transaction_status = hash[Constants::TRANSACTION_STATUS]
30
+ cancel_authorisation_response.errors = hash[Constants::ERRORS_CAPITALIZED]
31
+ cancel_authorisation_response
32
+ end
33
+ end
34
+ end