e_way_client 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41dcf6cbd4f4efaeb6ed7d5192a3ae5ebe05219a
4
+ data.tar.gz: 313a0c20df81dc1ca32dc673e9a752a95366b7ed
5
+ SHA512:
6
+ metadata.gz: 76fb5c720604b59135bdbd8b41d031ae71105b505aebbc851913536cfe8b70251d374b3d99e0b2a44150a75032909371ad1f6bf58f16452fed76c5d87a1262c5
7
+ data.tar.gz: 5e66413f38935b7ae90bc597ca16d524d88275ed2c2367837a4dcbd8cf8998482bde210d114672e577aa8c4a26ce3327d1f47b773857322ff90516511f1dd9f2
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /spec/config.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.13.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ ## [0.1.0] - 2016-12-31
8
+ ### Added
9
+ - Initial release
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ramon.tayag@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in e_way_client.gemspec
4
+ gemspec
5
+
6
+ gem "pry-byebug"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Ramon Tayag
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,56 @@
1
+ # EWayClient
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/e_way_client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'e_way_client'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install e_way_client
22
+
23
+ ## Usage
24
+
25
+ You may set global settings in an initializer:
26
+
27
+ ```ruby
28
+ EWayClient.configure do |c|
29
+ c.username = ENV["E_WAY_USERNAME"]
30
+ c.password = ENV["E_WAY_PASSWORD"]
31
+ c.secret = ENV["E_WAY_SECRET"]
32
+ end
33
+ ```
34
+
35
+ Whenever you call `EWayClient.new` it will use the global settings unless you provide it, like `EWayClient.new(password: "password")`
36
+
37
+ See detailed usage examples in `spec/acceptance`.
38
+
39
+ ### Factories
40
+
41
+ To aid development in your apps, you may include FactoryGirl factories of the models by calling `require "e_way_client/factories"`.
42
+
43
+ ## Development
44
+
45
+ - Copy `spec/config.yml.sample` to `spec/config.yml`
46
+ - Replace values with your test credentials
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/imacchiato/e_way_client-ruby). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+
52
+
53
+ ## License
54
+
55
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
56
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "e_way_client"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'e_way_client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "e_way_client"
8
+ spec.version = EWayClient::VERSION
9
+ spec.authors = ["Ramon Tayag"]
10
+ spec.email = ["ramon.tayag@gmail.com"]
11
+
12
+ spec.summary = %q{Ruby wrapper for eWAY's API}
13
+ spec.homepage = "https://github.com/imacchiato/e_way_client-ruby"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "virtus", "~> 1.0"
33
+ spec.add_dependency "api_client_base", "~> 0.2.0"
34
+ spec.add_dependency "soap_client", "~> 0.2.0"
35
+ spec.add_dependency "deep_fetch"
36
+
37
+ spec.add_development_dependency "bundler", "~> 1.13"
38
+ spec.add_development_dependency "rake", "~> 10.0"
39
+ spec.add_development_dependency "rspec", "~> 3.0"
40
+ spec.add_development_dependency "virtus-matchers"
41
+ spec.add_development_dependency "vcr"
42
+ spec.add_development_dependency "webmock"
43
+ end
@@ -0,0 +1,25 @@
1
+ module EWayClient
2
+ class Client
3
+
4
+ include APIClientBase::Client.module(default_opts: :default_opts)
5
+
6
+ include Virtus.model
7
+ attribute :wsdl, String, default: "https://ws.remit.vn/ws.asmx?WSDL"
8
+ attribute :username, String
9
+ attribute :password, String
10
+ attribute :secret, String
11
+
12
+ api_action :query_list_banks
13
+ api_action :query_list_provinces
14
+ api_action :send_transaction
15
+
16
+ private
17
+
18
+ def default_opts
19
+ %i[wsdl username password secret].each_with_object({}) do |attr, hash|
20
+ hash[attr] = send(attr)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :e_way_client_bank, class: "EWayClient::Bank" do
4
+ sequence(:bank_id) {|n| n}
5
+ sequence(:bank_name_eng) {|n| "Eng Bank #{n}"}
6
+ sequence(:bank_name_viet) {|n| "Viet Bank #{n}"}
7
+ response_code "0000"
8
+ end
9
+
10
+ end
@@ -0,0 +1,2 @@
1
+ FACTORIES_DIR = Pathname.new(File.dirname(__FILE__)).join("factories")
2
+ Dir[FACTORIES_DIR.join("*.rb")].each {|f| require f}
@@ -0,0 +1,11 @@
1
+ module EWayClient
2
+ class Bank
3
+
4
+ include Virtus.model
5
+ attribute :bank_id, Integer
6
+ attribute :bank_name_eng, String
7
+ attribute :bank_name_viet, String
8
+ attribute :response_code, String
9
+
10
+ end
11
+ end
@@ -0,0 +1,81 @@
1
+ module EWayClient
2
+ class Province
3
+
4
+ DISTRICT_KEY_FORMAT = /districts\d/
5
+ TIME_KEY_FORMAT = /time\d/
6
+ TYPES = %i[districts time]
7
+ TYPES_COUNT = 5
8
+
9
+ include Virtus.model
10
+ attribute :data, Hash
11
+ attribute :province_id, Integer, lazy: true, default: :default_province_id
12
+ attribute(:province_name_eng, String, {
13
+ lazy: true,
14
+ default: :default_province_name_eng,
15
+ })
16
+ attribute(:province_name_viet, String, {
17
+ lazy: true,
18
+ default: :default_province_name_viet,
19
+ })
20
+ attribute(:response_code, String, {
21
+ lazy: true,
22
+ default: :default_response_code,
23
+ })
24
+ attribute :districts, Array[String], lazy: true, default: :default_districts
25
+ TYPES_COUNT.times do |n|
26
+ count = n+1
27
+ attribute(:"districts#{count}", Array[String], {
28
+ lazy: true,
29
+ default: :"default_districts#{count}",
30
+ })
31
+
32
+ attribute(:"time#{count}", String, {
33
+ lazy: true,
34
+ default: :"default_time#{count}",
35
+ })
36
+ end
37
+
38
+ private
39
+
40
+ def default_province_id
41
+ data[:province_id]
42
+ end
43
+
44
+ def default_response_code
45
+ data[:response_code]
46
+ end
47
+
48
+ def default_province_name_eng
49
+ data[:province_name_eng]
50
+ end
51
+
52
+ def default_province_name_viet
53
+ data[:province_name_viet]
54
+ end
55
+
56
+ def default_districts
57
+ (1..TYPES_COUNT).each_with_object([]) do |n, array|
58
+ array.concat(self.send("districts#{n}"))
59
+ end
60
+ end
61
+
62
+ TYPES_COUNT.times do |n|
63
+ count = n+1
64
+ define_method "default_districts#{count}" do
65
+ districts_str = data[:"districts#{count}"]
66
+ if districts_str.blank?
67
+ []
68
+ else
69
+ districts_str.split(",").map do |district_name|
70
+ district_name.strip.gsub(/\.$/, "")
71
+ end
72
+ end
73
+ end
74
+
75
+ define_method "default_time#{count}" do
76
+ data[:"time#{count}"]
77
+ end
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,10 @@
1
+ module EWayClient
2
+ class BaseRequest
3
+
4
+ include Virtus.model
5
+ attribute :wsdl, String
6
+ attribute :username, String
7
+ attribute :password, String
8
+
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ module EWayClient
2
+ class QueryListBanksRequest < BaseRequest
3
+
4
+ def call
5
+ SOAPClient.(
6
+ wsdl: wsdl,
7
+ action: :query_list_banks,
8
+ message: {
9
+ "USERNAME" => username,
10
+ "PASSWORD" => password,
11
+ },
12
+ )
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module EWayClient
2
+ class QueryListProvincesRequest < BaseRequest
3
+
4
+ def call
5
+ SOAPClient.(
6
+ wsdl: wsdl,
7
+ action: :query_list_provinces,
8
+ message: {
9
+ "USERNAME" => username,
10
+ "PASSWORD" => password,
11
+ },
12
+ )
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,99 @@
1
+ module EWayClient
2
+ class SendTransactionRequest < BaseRequest
3
+
4
+ attribute :agent_code, String
5
+ attribute :username, String
6
+ attribute :password, String
7
+ attribute :transaction_id, String
8
+ attribute :transaction_date, Time
9
+ attribute :degit_code, String
10
+ attribute :transaction_amount, Integer
11
+ attribute :sett_amount, Integer
12
+ attribute :transaction_currency, String
13
+ attribute :sett_currency, String
14
+ attribute :sett_conversion_rate, Float
15
+ attribute :paymentmode, String
16
+ attribute :sender_name, String
17
+ attribute :sender_address, String
18
+ attribute :sender_district, String
19
+ attribute :sender_city, String
20
+ attribute :sender_country, String
21
+ attribute :sender_question, String
22
+ attribute :sender_answer, String
23
+ attribute :receiver_name, String
24
+ attribute :receiver_address, String
25
+ attribute :receiver_wards, String
26
+ attribute :receiver_district, String
27
+ attribute :receiver_city, String
28
+ attribute :receiver_phone, String
29
+ attribute :hours_receive, String
30
+ attribute :bank_id, String
31
+ attribute :bank_account_number, String
32
+ attribute :transaction_message, String
33
+ attribute(:transaction_key, String, {
34
+ lazy: true,
35
+ default: :default_transaction_key,
36
+ })
37
+ attribute :bankbranch_name, String
38
+ attribute :bankbranch_address, String
39
+ attribute :secret, String
40
+
41
+ MESSAGE_ATTRS = %i[
42
+ agent_code
43
+ username
44
+ password
45
+ transaction_id
46
+ transaction_date
47
+ degit_code
48
+ transaction_amount
49
+ sett_amount
50
+ transaction_currency
51
+ sett_currency
52
+ sett_conversion_rate
53
+ paymentmode
54
+ sender_name
55
+ sender_address
56
+ sender_district
57
+ sender_city
58
+ sender_country
59
+ sender_question
60
+ sender_answer
61
+ receiver_name
62
+ receiver_address
63
+ receiver_wards
64
+ receiver_district
65
+ receiver_city
66
+ receiver_phone
67
+ hours_receive
68
+ bank_id
69
+ bank_account_number
70
+ transaction_message
71
+ transaction_key
72
+ bankbranch_name
73
+ bankbranch_address
74
+ ]
75
+
76
+ def call
77
+ SOAPClient.(wsdl: wsdl, action: :send_transaction, message: message)
78
+ end
79
+
80
+ def transaction_date
81
+ return nil if super.nil?
82
+ super.in_time_zone("Bangkok").strftime("%m/%d/%Y %H:%M:%S")
83
+ end
84
+
85
+ private
86
+
87
+ def message
88
+ MESSAGE_ATTRS.each_with_object({}) do |attr, hash|
89
+ hash[attr.to_s.upcase] = send(attr)
90
+ end
91
+ end
92
+
93
+ def default_transaction_key
94
+ joined_str = [transaction_amount, paymentmode, secret].join
95
+ Digest::MD5.hexdigest(joined_str)
96
+ end
97
+
98
+ end
99
+ end
@@ -0,0 +1,8 @@
1
+ module EWayClient
2
+ class BaseResponse
3
+
4
+ include APIClientBase::Response.module
5
+ attribute :success, Boolean, lazy: true, default: :default_success
6
+
7
+ end
8
+ end
@@ -0,0 +1,24 @@
1
+ module EWayClient
2
+ class QueryListBanksResponse < BaseResponse
3
+
4
+ attribute :data, Object, lazy: true, default: :default_data
5
+ attribute :banks, Array, lazy: true, default: :default_banks
6
+
7
+ private
8
+
9
+ def default_data
10
+ raw_response.body.deep_fetch(*%i[
11
+ query_list_banks_response
12
+ query_list_banks_result
13
+ diffgram
14
+ document_element
15
+ query_list_banks
16
+ ])
17
+ end
18
+
19
+ def default_banks
20
+ data.map { |hash| Bank.new(hash) }
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ module EWayClient
2
+ class QueryListProvincesResponse < BaseResponse
3
+
4
+ attribute :data, Object, lazy: true, default: :default_data
5
+ attribute :provinces, Array, lazy: true, default: :default_provinces
6
+
7
+ private
8
+
9
+ def default_data
10
+ raw_response.body.deep_fetch(*%i[
11
+ query_list_provinces_response
12
+ query_list_provinces_result
13
+ diffgram
14
+ document_element
15
+ query_list_provinces
16
+ ])
17
+ end
18
+
19
+ def default_provinces
20
+ data.map { |hash| Province.new(hash) }
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,70 @@
1
+ module EWayClient
2
+ class SendTransactionResponse < BaseResponse
3
+
4
+ SUCCESS_RESPONSE_CODE = "0000"
5
+ ERROR_MESSAGE_MAP = {
6
+ "1001" => "Required Field is Empty",
7
+ "1002" => "Authentication Fail",
8
+ "1003" => "User Is Locked",
9
+ "1004" => "Invalid Parameter",
10
+ "1005" => "New password and confirm new password are not same",
11
+ "1006" => "Field in request data with value not number type",
12
+ "2003" => "Operation unsuccessful",
13
+ "2004" => "Transaction ID does not exist",
14
+ "2005" => "Transaction ID already exists",
15
+ "3001" => "Invalid Payment Mode",
16
+ "3010" => "Bank transfer account number is blank",
17
+ "3020" => "Bank ID is blank",
18
+ "3030" => "Incorrect bank ID",
19
+ "3040" => "Degit code is blank",
20
+ "3050" => "Incorrect province ID",
21
+ "3060" => "Bank branch name is blank",
22
+ "3070" => "Bank branch address is blank",
23
+ "4001" => "Transaction Secure key error",
24
+ "4002" => "The transaction was paid, should not be allowed to edit",
25
+ "5001" => "Receiver name is blank",
26
+ "5002" => "Receiver address is blank",
27
+ "5003" => "Receiver district is blank",
28
+ "5004" => "Receiver city is blank",
29
+ "5005" => "Receiver phone is blank",
30
+ "5006" => "Receiver wards is blank",
31
+ "6001" => "Sender name is blank",
32
+ "6006" => "Sender country is blank",
33
+ }
34
+
35
+ attribute :data, Object, lazy: true, default: :default_data
36
+ attribute(:response_code, String, {
37
+ lazy: true,
38
+ default: :default_response_code,
39
+ })
40
+ attribute(:error_message, String, {
41
+ lazy: true,
42
+ default: :default_error_message,
43
+ })
44
+
45
+ private
46
+
47
+ def default_data
48
+ raw_response.body.deep_fetch(*%i[
49
+ send_transaction_response
50
+ send_transaction_result
51
+ diffgram
52
+ document_element
53
+ send_transaction
54
+ ])
55
+ end
56
+
57
+ def default_success
58
+ response_code == SUCCESS_RESPONSE_CODE
59
+ end
60
+
61
+ def default_response_code
62
+ data[:response_code]
63
+ end
64
+
65
+ def default_error_message
66
+ ERROR_MESSAGE_MAP[response_code]
67
+ end
68
+
69
+ end
70
+ end
@@ -0,0 +1,3 @@
1
+ module EWayClient
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,30 @@
1
+ require "deep_fetch"
2
+ require "active_support/core_ext/hash/indifferent_access"
3
+ require "active_support/time"
4
+ require "api_client_base"
5
+ require "soap_client"
6
+ require "e_way_client/version"
7
+ require "e_way_client/client"
8
+ require "e_way_client/models/bank"
9
+ require "e_way_client/models/province"
10
+ require "e_way_client/requests/base_request"
11
+ require "e_way_client/requests/query_list_banks_request"
12
+ require "e_way_client/requests/query_list_provinces_request"
13
+ require "e_way_client/requests/send_transaction_request"
14
+ require "e_way_client/responses/base_response"
15
+ require "e_way_client/responses/query_list_banks_response"
16
+ require "e_way_client/responses/query_list_provinces_response"
17
+ require "e_way_client/responses/send_transaction_response"
18
+
19
+ module EWayClient
20
+
21
+ include APIClientBase::Base.module
22
+
23
+ with_configuration do
24
+ has :wsdl, classes: String, default: "https://ws.remit.vn/ws.asmx?WSDL"
25
+ has :username, classes: String
26
+ has :password, classes: String
27
+ has :secret, classes: String
28
+ end
29
+
30
+ end
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: e_way_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ramon Tayag
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: virtus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: api_client_base
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: soap_client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: deep_fetch
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.13'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: virtus-matchers
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: vcr
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email:
155
+ - ramon.tayag@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".ruby-version"
163
+ - ".travis.yml"
164
+ - CHANGELOG.md
165
+ - CODE_OF_CONDUCT.md
166
+ - Gemfile
167
+ - LICENSE.txt
168
+ - README.md
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - e_way_client.gemspec
173
+ - lib/e_way_client.rb
174
+ - lib/e_way_client/client.rb
175
+ - lib/e_way_client/factories.rb
176
+ - lib/e_way_client/factories/bank.rb
177
+ - lib/e_way_client/models/bank.rb
178
+ - lib/e_way_client/models/province.rb
179
+ - lib/e_way_client/requests/base_request.rb
180
+ - lib/e_way_client/requests/query_list_banks_request.rb
181
+ - lib/e_way_client/requests/query_list_provinces_request.rb
182
+ - lib/e_way_client/requests/send_transaction_request.rb
183
+ - lib/e_way_client/responses/base_response.rb
184
+ - lib/e_way_client/responses/query_list_banks_response.rb
185
+ - lib/e_way_client/responses/query_list_provinces_response.rb
186
+ - lib/e_way_client/responses/send_transaction_response.rb
187
+ - lib/e_way_client/version.rb
188
+ homepage: https://github.com/imacchiato/e_way_client-ruby
189
+ licenses:
190
+ - MIT
191
+ metadata:
192
+ allowed_push_host: https://rubygems.org
193
+ post_install_message:
194
+ rdoc_options: []
195
+ require_paths:
196
+ - lib
197
+ required_ruby_version: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ required_rubygems_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ requirements: []
208
+ rubyforge_project:
209
+ rubygems_version: 2.5.1
210
+ signing_key:
211
+ specification_version: 4
212
+ summary: Ruby wrapper for eWAY's API
213
+ test_files: []