giact_verification 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +143 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/giact_verification.gemspec +42 -0
- data/lib/giact_verification.rb +67 -0
- data/lib/giact_verification/authenticate.rb +44 -0
- data/lib/giact_verification/configuration.rb +52 -0
- data/lib/giact_verification/decorators/decorate_hash.rb +22 -0
- data/lib/giact_verification/decorators/giact_soap_decorator.rb +32 -0
- data/lib/giact_verification/errors.rb +7 -0
- data/lib/giact_verification/etc/alternative_id_types.yml +10 -0
- data/lib/giact_verification/etc/check_validator_errors.yml +11 -0
- data/lib/giact_verification/etc/customer_validator_errors.yml +35 -0
- data/lib/giact_verification/etc/serviced_countries.yml +2 -0
- data/lib/giact_verification/etc/serviced_states.yml +78 -0
- data/lib/giact_verification/etc/valid_account_types.yml +4 -0
- data/lib/giact_verification/extract_inquiry_result.rb +26 -0
- data/lib/giact_verification/inquiry_template_renderer.rb +26 -0
- data/lib/giact_verification/models/check.rb +33 -0
- data/lib/giact_verification/models/customer.rb +33 -0
- data/lib/giact_verification/models/giact_xml.rb +28 -0
- data/lib/giact_verification/requests/production_requester.rb +28 -0
- data/lib/giact_verification/requests/request_coordinator.rb +30 -0
- data/lib/giact_verification/requests/requester_factory.rb +25 -0
- data/lib/giact_verification/requests/sandbox_requester.rb +28 -0
- data/lib/giact_verification/requests/stubbed_requester.rb +38 -0
- data/lib/giact_verification/requests/support/declined_response.xml +17 -0
- data/lib/giact_verification/requests/support/error_response.xml +19 -0
- data/lib/giact_verification/requests/support/pass_response.xml +20 -0
- data/lib/giact_verification/response.rb +16 -0
- data/lib/giact_verification/response_parser.rb +35 -0
- data/lib/giact_verification/templates/inquiry.xml.erb +146 -0
- data/lib/giact_verification/validators/check_validator.rb +27 -0
- data/lib/giact_verification/validators/customer_validator.rb +77 -0
- data/lib/giact_verification/validators/giact_xml_validator.rb +25 -0
- data/lib/giact_verification/version.rb +3 -0
- data/lib/giact_verification/xml_to_hash.rb +22 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f260ef742040e97d6e4cf6b5276e08b6c2b71aaa99023b87c2b03e538bf3ab5d
|
4
|
+
data.tar.gz: 9b49d4cf89ae5b72afb603cb2c8a7e7c8f8955aea95b40a7aae7bb9bd97919e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4ac0ae48e5a1ad002dad65b1c002893b9225222e0260d7b9c709ac99b9b34f6b7c7c9f354c67610b62eb7e1edb1833d6c617364f4cc19f13dc87cfb21cc3d763
|
7
|
+
data.tar.gz: 8b65fe3b44dc10411013f7337a924a1b7bf4d7207bf40b185422bc5332b0ae254ade1eab29002b83683fefb691deb025931094723b0ed8c5ac14426c56b39629
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 georgewambold@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
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 George Wambold
|
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,143 @@
|
|
1
|
+
# GiactVerification
|
2
|
+
[![Build Status](https://travis-ci.org/georgewambold/giact_verification.svg?branch=master)](https://travis-ci.org/georgewambold/giact_verification)
|
3
|
+
|
4
|
+
**WARNING** This gem only works for **Version 5.8.x** of GIACT's API
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'giact_verification'
|
12
|
+
```
|
13
|
+
|
14
|
+
Or install it yourself as:
|
15
|
+
|
16
|
+
$ gem install giact_verification
|
17
|
+
|
18
|
+
## Configuration
|
19
|
+
To set up your API keys, use the configuration helper like this:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
GiactVerification.configure do |config|
|
23
|
+
config.api_username = 'foo'
|
24
|
+
config.api_password = 'bar'
|
25
|
+
config.giact_endpoint = :production
|
26
|
+
end
|
27
|
+
```
|
28
|
+
`giact_endpoint` options are `:production`, `:sandbox` and `:stubbed`.
|
29
|
+
- `:production` Will send requests to their production endpoint
|
30
|
+
- `:sandbox` Will send requests to their sandbox endpoint
|
31
|
+
- `:stubbed` Will stub requests locally (no network request) and return [one of a series of set responses](#stubbed_responses) based on the last name passed.
|
32
|
+
|
33
|
+
## gAuthenticate
|
34
|
+
`GiactVerification::Authenticate` takes two arguements: a [valid customer](#valid_customer) and a [valid check](#valid_check).
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
GiactVerification::Authenticate.call(
|
38
|
+
customer: {
|
39
|
+
first_name: "Kent"
|
40
|
+
last_name: "Beck"
|
41
|
+
address_line1: "123 Test Dr."
|
42
|
+
city: "Abbotsford"
|
43
|
+
state: "MA"
|
44
|
+
zip_code: "54321"
|
45
|
+
phone_number: "4127982231"
|
46
|
+
tax_id: 9876543210
|
47
|
+
date_of_birth: Date.parse('Mar 6 1961')
|
48
|
+
},
|
49
|
+
check: {
|
50
|
+
routing_number: 123456789
|
51
|
+
account_number: 00012300089
|
52
|
+
}
|
53
|
+
)
|
54
|
+
```
|
55
|
+
|
56
|
+
`GiactVerification::Authenticate.call()` will return a `GiactVerification::Response` object which has the following API:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
response = GiactVerification::Authenticate.call(customer: some_customer, check: some_check)
|
60
|
+
|
61
|
+
response.raw_request
|
62
|
+
#=> The XML string sent to GIACT
|
63
|
+
|
64
|
+
response.raw_response
|
65
|
+
#=> The XML string returned from GIACT
|
66
|
+
|
67
|
+
response.success?
|
68
|
+
#=> A boolean value indicating if the request was successful
|
69
|
+
# `true` indicates GIACT returned valid XML
|
70
|
+
# `false` indicates there was some kind of error. You can then check the raw_response for details.
|
71
|
+
|
72
|
+
response.parsed_response
|
73
|
+
#=> Hash of the data GIACT returned with keys:
|
74
|
+
# If the response was successful the hash will be populated like this:
|
75
|
+
{
|
76
|
+
item_reference_id: String,
|
77
|
+
created_date: DateTime,
|
78
|
+
verification_response: String,
|
79
|
+
account_response_code: String,
|
80
|
+
bank_name: String,
|
81
|
+
account_added_date: DateTime,
|
82
|
+
account_last_updated_date: DateTime,
|
83
|
+
account_closed_date: DateTime,
|
84
|
+
funds_confirmation_result: String,
|
85
|
+
customer_response_code: String
|
86
|
+
}
|
87
|
+
# If the response fails, the hash will be blank.
|
88
|
+
```
|
89
|
+
## <a name="valid_customer">Valid Customer Attributes</a>
|
90
|
+
The following are valid customer fields. Please note that the required fields noted below only represent the bare minimum. Some GIACT services will require additional fields.
|
91
|
+
|
92
|
+
* **name_prefix:** 1-4 characters
|
93
|
+
* **first_name:** 2-40 characters *REQUIRED*
|
94
|
+
* **middle_name:** 1-40 characters
|
95
|
+
* **last_name:** 2-40 characters *REQUIRED*
|
96
|
+
* **name_suffix:** 1-4 characters
|
97
|
+
* **address_line1:** 2-40 characters *REQUIRED*
|
98
|
+
* **address_line2:** 1-40 characters
|
99
|
+
* **city:** 2-25 characters *REQUIRED*
|
100
|
+
* **state:** 2 characters, valid US state or Candian province *REQUIRED*
|
101
|
+
* **zip_code:** 5 or 7 or 10 characters, valid US or Canadian postal code *REQUIRED*
|
102
|
+
* **country:** Either 'US' or 'CA', defaults to 'US'
|
103
|
+
* **phone_number:** 10 numeric characters, can't start with 0, no dashes
|
104
|
+
* **tax_id:** Social security number or business ein *REQUIRED*
|
105
|
+
* **date_of_birth:** Date, DateTime or an object that responds to :strftime *REQUIRED*
|
106
|
+
* **drivers_license_number:** 1-28 numeric characters
|
107
|
+
* **drivers_license_state:** 2 characters, valid US state or Candian province
|
108
|
+
* **email_address:** 1-100 characters
|
109
|
+
* **current_ip_address:** 1-15 characters
|
110
|
+
* **mobile_consent_record_id:** Numeric, unspecified length
|
111
|
+
* **alternative_id_type:** Must be one of the following: 'UsaMilitaryId', 'UsaStateId', 'PassportUsa', 'PassportForeign', 'UsaResidentAlienId', 'StudentId', 'TribalId', 'DlCanada', 'DlMexico', or 'OtherForeignId'
|
112
|
+
* **alternative_id_issuer:** 1-50 characters
|
113
|
+
* **alternative_id_number:** 1-50 numeric characters
|
114
|
+
* **domain:** 1-100 characters
|
115
|
+
|
116
|
+
## <a name="valid_check">Valid Check Attributes</a>
|
117
|
+
The following are valid check fields:
|
118
|
+
|
119
|
+
* **routing_number:** 9 numeric characters *REQUIRED*
|
120
|
+
* **account_number:** 4-17 numeric characters *REQUIRED*
|
121
|
+
* **check_number:** numeric, unspecified length
|
122
|
+
* **check_amount:** float or float-like string (eg. '100.01')
|
123
|
+
* **account_type:** one of the following: 'Checking', 'Savings' or 'Other'
|
124
|
+
|
125
|
+
## <a name="stubbed_responses">Stubbed Responses</a>
|
126
|
+
Using `config.giact_endpoint = :stubbed` will return a set response based on the last name passed in. These responses were built to be used in acceptance/integration tests. The built in responses were copied from the sandbox API and are as follows:
|
127
|
+
1. `last_name: GiactError` Will respond with an errored response (mimicking an error on GIACT's server)
|
128
|
+
2. `last_name: GiactDeclined` Will respond with a declined response
|
129
|
+
3. ANY OTHER LAST NAME Will return a passed response
|
130
|
+
|
131
|
+
The response is stubbed at a HTTP level, you'll still need to pass valid customer and check parameters to pass local validation.
|
132
|
+
|
133
|
+
## Contributing
|
134
|
+
|
135
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/georgewambold/giact_verification. 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.
|
136
|
+
|
137
|
+
## Development
|
138
|
+
|
139
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests.
|
140
|
+
|
141
|
+
## License
|
142
|
+
|
143
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "giact_verification"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'giact_verification/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "giact_verification"
|
8
|
+
spec.version = GiactVerification::VERSION
|
9
|
+
spec.authors = ["George Wambold"]
|
10
|
+
spec.email = ["georgewambold@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A wrapper for GIACT's Verification Services that cleans up their SOAP API"
|
13
|
+
spec.homepage = "https://github.com/georgewambold/giact_verification"
|
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'] = "TODO: Set to 'http://mygemserver.com'"
|
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_runtime_dependency "dry-validation", "~> 0.11.1"
|
33
|
+
spec.add_runtime_dependency "nori", "~> 2.6.0"
|
34
|
+
spec.add_runtime_dependency "nokogiri", "~> 1.8.2"
|
35
|
+
|
36
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
37
|
+
spec.add_development_dependency "rake", "~> 12.3.0"
|
38
|
+
spec.add_development_dependency "webmock", "~> 3.3.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.7.0"
|
40
|
+
spec.add_development_dependency "pry", "~> 0.11.3"
|
41
|
+
spec.add_development_dependency "sinatra", "~> 2.0.0"
|
42
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module GiactVerification
|
2
|
+
|
3
|
+
def self.configuration
|
4
|
+
@configuration ||= GiactVerification::Configuration.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configure
|
8
|
+
yield configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
# This is class level method delegation -- Really unpleasant.
|
12
|
+
class << self
|
13
|
+
require 'forwardable'
|
14
|
+
extend ::Forwardable
|
15
|
+
|
16
|
+
|
17
|
+
def_delegators :configuration,
|
18
|
+
:servicing_country?,
|
19
|
+
:servicing?,
|
20
|
+
:accepts_id_type?,
|
21
|
+
:valid_account_type?,
|
22
|
+
:giact_endpoint
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.ready_for_request?
|
26
|
+
if configuration.invalid?
|
27
|
+
raise ConfigurationError
|
28
|
+
else
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.root
|
34
|
+
File.dirname __dir__
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.config_directory
|
38
|
+
File.join(root, 'lib', 'giact_verification', 'etc')
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.inquiry_template_directory
|
42
|
+
File.join(root, 'lib', 'giact_verification', 'templates', 'inquiry.xml.erb')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
require "giact_verification/authenticate"
|
47
|
+
require "giact_verification/configuration"
|
48
|
+
require "giact_verification/decorators/decorate_hash"
|
49
|
+
require "giact_verification/decorators/giact_soap_decorator"
|
50
|
+
require "giact_verification/extract_inquiry_result"
|
51
|
+
require "giact_verification/errors"
|
52
|
+
require "giact_verification/inquiry_template_renderer"
|
53
|
+
require "giact_verification/models/check"
|
54
|
+
require "giact_verification/models/customer"
|
55
|
+
require "giact_verification/models/giact_xml"
|
56
|
+
require "giact_verification/requests/request_coordinator"
|
57
|
+
require "giact_verification/requests/requester_factory"
|
58
|
+
require "giact_verification/requests/production_requester"
|
59
|
+
require "giact_verification/requests/sandbox_requester"
|
60
|
+
require "giact_verification/requests/stubbed_requester"
|
61
|
+
require "giact_verification/response"
|
62
|
+
require "giact_verification/response_parser"
|
63
|
+
require "giact_verification/version"
|
64
|
+
require "giact_verification/validators/customer_validator"
|
65
|
+
require "giact_verification/validators/check_validator"
|
66
|
+
require "giact_verification/validators/giact_xml_validator"
|
67
|
+
require "giact_verification/xml_to_hash"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module GiactVerification
|
2
|
+
class Authenticate
|
3
|
+
|
4
|
+
def self.call(args)
|
5
|
+
new(args).call
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(args)
|
9
|
+
GiactVerification.ready_for_request?
|
10
|
+
|
11
|
+
@customer = GiactVerification::Customer.new(attributes: args.fetch(:customer, {}))
|
12
|
+
@check = GiactVerification::Check.new(attributes: args.fetch(:check, {}))
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
if customer.invalid? || check.invalid?
|
17
|
+
raise GiactVerification::ArgumentError, param_errors
|
18
|
+
end
|
19
|
+
|
20
|
+
RequestCoordinator.call(body: request_body)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
attr_reader :customer, :check
|
25
|
+
|
26
|
+
def request_body
|
27
|
+
@request_body ||= GiactVerification::InquiryTemplateRenderer.call(substitutions: substitutions)
|
28
|
+
end
|
29
|
+
|
30
|
+
def substitutions
|
31
|
+
{
|
32
|
+
g_authenticate_enabled: true,
|
33
|
+
check: check.decorate_for_xml,
|
34
|
+
customer: customer.decorate_for_xml,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def param_errors
|
39
|
+
(customer.errors.merge(check.errors)).map do |k,v|
|
40
|
+
"#{k}: #{v}\n"
|
41
|
+
end.join('')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|