paya 0.9.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 +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +1 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/paya.rb +111 -0
- data/lib/paya/base.rb +145 -0
- data/lib/paya/ccd/guaranteed/credit_debit_transaction.rb +87 -0
- data/lib/paya/ccd/guaranteed/debit_transaction.rb +85 -0
- data/lib/paya/ccd/non_guaranteed/credit_debit_transaction.rb +85 -0
- data/lib/paya/ccd/non_guaranteed/debit_transaction.rb +85 -0
- data/lib/paya/certification.rb +22 -0
- data/lib/paya/certification/ccd.rb +50 -0
- data/lib/paya/certification/ppd.rb +52 -0
- data/lib/paya/certification/tel.rb +54 -0
- data/lib/paya/certification/web.rb +52 -0
- data/lib/paya/ppd/guaranteed/credit_debit_transaction.rb +85 -0
- data/lib/paya/ppd/guaranteed/debit_transaction.rb +85 -0
- data/lib/paya/ppd/non_guaranteed/credit_debit_transaction.rb +85 -0
- data/lib/paya/ppd/non_guaranteed/debit_transaction.rb +86 -0
- data/lib/paya/tel/guaranteed/credit_debit_transaction.rb +69 -0
- data/lib/paya/tel/guaranteed/debit_transaction.rb +85 -0
- data/lib/paya/tel/non_guaranteed/credit_debit_transaction.rb +68 -0
- data/lib/paya/tel/non_guaranteed/debit_transaction.rb +85 -0
- data/lib/paya/version.rb +3 -0
- data/lib/paya/web/guaranteed/credit_debit_transaction.rb +68 -0
- data/lib/paya/web/guaranteed/debit_transaction.rb +68 -0
- data/lib/paya/web/non_guaranteed/credit_debit_transaction.rb +68 -0
- data/lib/paya/web/non_guaranteed/debit_transaction.rb +85 -0
- data/paya.gemspec +26 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c2a0d9ed9f341baf25331b897b4563890c467da3
|
4
|
+
data.tar.gz: a6843fed80926cd2dd6f8bf0beeba342b76e6a40
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10e68cc8dadad41ef9cb09c1043ad3ed31c6326ecfa1b3d4324ad867b94ab7397e5c79b2d45b928ac108a14154b52fb67a2fa99d8b64007a5c7eeeea3cd0f35c
|
7
|
+
data.tar.gz: 08c0d35575e9a6eb94d18d0f6afae15fc7c3a97fe79a44dddc701a1e3628956e00c643c0418e02df7b9dc07f7ee7f31c7733ed8fe7e9b219ae9eec01c91529b8
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem 'savon'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Shahzad Tariq
|
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,46 @@
|
|
1
|
+
# Paya
|
2
|
+
This is Ruby / Rails wrapper for Paya (https://paya.com/) based ACH payments. This is third party wrapper and not developed by Paya team. This is developed by reading Paya documentation.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'paya'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install paya
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Generate a new initlizer file paya.rb in config/initializers folder with your paya credentials. To get paya credentials, contact with Paya development team at https://paya.com/developers
|
23
|
+
|
24
|
+
require 'paya'
|
25
|
+
require 'securerandom'
|
26
|
+
|
27
|
+
Paya.user_name = "YOUR_USERNAME"
|
28
|
+
Paya.password = "YOUR_PASSWORD"
|
29
|
+
Paya.production = false
|
30
|
+
|
31
|
+
After that, you can process payment according to your requirements.
|
32
|
+
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
|
+
|
38
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it ( https://github.com/[my-github-username]/paya/fork )
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "paya"
|
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
data/lib/paya.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'savon'
|
2
|
+
require 'paya/base'
|
3
|
+
|
4
|
+
require 'paya/certification'
|
5
|
+
require 'paya/certification/ccd'
|
6
|
+
require 'paya/certification/ppd'
|
7
|
+
require 'paya/certification/tel'
|
8
|
+
require 'paya/certification/web'
|
9
|
+
|
10
|
+
require 'paya/ccd/guaranteed/credit_debit_transaction'
|
11
|
+
require 'paya/ccd/guaranteed/debit_transaction'
|
12
|
+
require 'paya/ccd/non_guaranteed/credit_debit_transaction'
|
13
|
+
require 'paya/ccd/non_guaranteed/debit_transaction'
|
14
|
+
|
15
|
+
require 'paya/ppd/guaranteed/credit_debit_transaction'
|
16
|
+
require 'paya/ppd/guaranteed/debit_transaction'
|
17
|
+
require 'paya/ppd/non_guaranteed/credit_debit_transaction'
|
18
|
+
require 'paya/ppd/non_guaranteed/debit_transaction'
|
19
|
+
|
20
|
+
require 'paya/tel/guaranteed/credit_debit_transaction'
|
21
|
+
require 'paya/tel/guaranteed/debit_transaction'
|
22
|
+
require 'paya/tel/non_guaranteed/credit_debit_transaction'
|
23
|
+
require 'paya/tel/non_guaranteed/debit_transaction'
|
24
|
+
|
25
|
+
require 'paya/web/guaranteed/credit_debit_transaction'
|
26
|
+
require 'paya/web/guaranteed/debit_transaction'
|
27
|
+
require 'paya/web/non_guaranteed/credit_debit_transaction'
|
28
|
+
require 'paya/web/non_guaranteed/debit_transaction'
|
29
|
+
|
30
|
+
|
31
|
+
module Paya
|
32
|
+
CERTITICATION_API_END_POINT = "https://demo.eftchecks.com/webservices/AuthGateway.asmx?WSDL"
|
33
|
+
API_END_POINT = "https://getigateway.eftchecks.com/webservices/authgateway.asmx?WSDL"
|
34
|
+
|
35
|
+
PROCESS_SINGLE_CERTIFICATION_CHECK = <<xml
|
36
|
+
<?xml version="1.0" encoding="utf-8"?>
|
37
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
38
|
+
<soap:Header>
|
39
|
+
<AuthGatewayHeader xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
40
|
+
<UserName>&&&USER_NAME&&&</UserName>
|
41
|
+
<Password>&&&PASSWORD&&&</Password>
|
42
|
+
<TerminalID>&&&TERMINAL_ID&&&</TerminalID>
|
43
|
+
</AuthGatewayHeader>
|
44
|
+
</soap:Header>
|
45
|
+
<soap:Body>
|
46
|
+
<ProcessSingleCertificationCheck xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
47
|
+
<DataPacket>
|
48
|
+
&&&DATA_PACKET&&&
|
49
|
+
</DataPacket>
|
50
|
+
</ProcessSingleCertificationCheck>
|
51
|
+
</soap:Body>
|
52
|
+
</soap:Envelope>
|
53
|
+
xml
|
54
|
+
|
55
|
+
PROCESS_SINGLE_CHECK = <<xml
|
56
|
+
<?xml version="1.0" encoding="utf-8"?>
|
57
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
58
|
+
<soap:Header>
|
59
|
+
<AuthGatewayHeader xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
60
|
+
<UserName>&&&USER_NAME&&&</UserName>
|
61
|
+
<Password>&&&PASSWORD&&&</Password>
|
62
|
+
<TerminalID>&&&TERMINAL_ID&&&</TerminalID>
|
63
|
+
</AuthGatewayHeader>
|
64
|
+
</soap:Header>
|
65
|
+
<soap:Body>
|
66
|
+
<ProcessSingleCheck xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
67
|
+
<DataPacket>
|
68
|
+
&&&DATA_PACKET&&&
|
69
|
+
</DataPacket>
|
70
|
+
</ProcessSingleCheck>
|
71
|
+
</soap:Body>
|
72
|
+
</soap:Envelope>
|
73
|
+
xml
|
74
|
+
|
75
|
+
GET_ARCHIVED_RESPONSE = <<xml
|
76
|
+
<?xml version="1.0" encoding="utf-8"?>
|
77
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
78
|
+
<soap:Header>
|
79
|
+
<AuthGatewayHeader xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
80
|
+
<UserName>&&&USER_NAME&&&</UserName>
|
81
|
+
<Password>&&&PASSWORD&&&</Password>
|
82
|
+
<TerminalID>&&&TERMINAL_ID&&&</TerminalID>
|
83
|
+
</AuthGatewayHeader>
|
84
|
+
</soap:Header>
|
85
|
+
<soap:Body>
|
86
|
+
<GetArchivedResponse xmlns="http://tempuri.org/GETI.eMagnus.WebServices/AuthGateway">
|
87
|
+
<RequestId>
|
88
|
+
&&&REQUEST_ID&&&
|
89
|
+
</RequestId>
|
90
|
+
</GetArchivedResponse>
|
91
|
+
</soap:Body>
|
92
|
+
</soap:Envelope>
|
93
|
+
xml
|
94
|
+
|
95
|
+
class << self
|
96
|
+
attr_accessor :user_name, :password, :production
|
97
|
+
|
98
|
+
def client
|
99
|
+
::Savon.client(wsdl: Paya::API_END_POINT)
|
100
|
+
end
|
101
|
+
|
102
|
+
def certification_client
|
103
|
+
::Savon.client(wsdl: Paya::CERTITICATION_API_END_POINT)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_mode
|
107
|
+
!production
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
data/lib/paya/base.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
module Paya
|
2
|
+
class Base
|
3
|
+
|
4
|
+
def process_payment options, type=:ccd, guaranteed=true, debit_only=true, check_verification=false, identity_verification=false, dl_required=false
|
5
|
+
type = type.to_s.capitalize
|
6
|
+
sub_type = guaranteed ? 'Guaranteed' : 'NonGuaranteed'
|
7
|
+
payment_type = debit_only ? 'DebitTransaction' : 'CreditDebitTransaction'
|
8
|
+
|
9
|
+
handler = "Paya::#{type}::#{sub_type}::#{payment_type}".contantize
|
10
|
+
handler.new options
|
11
|
+
handler.process check_verification, identity_verification, dl_required
|
12
|
+
end
|
13
|
+
|
14
|
+
def process_single_check options={}, terminal_id=nil, identifier='R'
|
15
|
+
Paya.production == true ? process_single_actual_check(options, terminal_id, identifier) : process_single_certification_check(options, terminal_id, identifier)
|
16
|
+
end
|
17
|
+
|
18
|
+
def process_single_check_with_token
|
19
|
+
Paya.production == true ? process_single_actual_check_with_token(options, terminal_id, identifier) : process_single_certification_check_with_token(options, terminal_id, identifier)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_archived_response request_id
|
23
|
+
@terminal_id = terminal_id.to_s
|
24
|
+
xml = Paya::GET_ARCHIVED_RESPONSE.gsub("&&&REQUEST_ID&&&", request_id).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD", Paya.password)
|
25
|
+
response = Paya.client.call(:get_archived_response, xml: xml)
|
26
|
+
response = Hash.from_xml(response.body[:get_archived_response])
|
27
|
+
{request: xml, response: response}
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :archived, :get_archived_response
|
31
|
+
alias_method :get_archived, :get_archived_response
|
32
|
+
alias_method :archived_response, :get_archived_response
|
33
|
+
|
34
|
+
def process_single_actual_check options={}, terminal_id=nil, identifier='R'
|
35
|
+
@terminal_id = terminal_id.to_s
|
36
|
+
@data_packet = data_packet(options, identifier)
|
37
|
+
xml = Paya::PROCESS_SINGLE_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
|
38
|
+
response = Paya.client.call(:process_single_check, xml: xml)
|
39
|
+
response = Hash.from_xml(response.body[:process_single_check_response][:process_single_check_result])
|
40
|
+
{request: xml, response: response}
|
41
|
+
end
|
42
|
+
|
43
|
+
def process_single_certification_check options={}, terminal_id=nil, identifier='R'
|
44
|
+
@terminal_id = terminal_id.to_s
|
45
|
+
@data_packet = data_packet(options, identifier)
|
46
|
+
xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
|
47
|
+
response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
|
48
|
+
response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
|
49
|
+
{request: xml, response: response}
|
50
|
+
end
|
51
|
+
|
52
|
+
def process_single_actual_check_with_token options={}, terminal_id=nil, identifier='R'
|
53
|
+
@terminal_id = terminal_id.to_s
|
54
|
+
@data_packet = data_packet(options, identifier)
|
55
|
+
xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
|
56
|
+
response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
|
57
|
+
response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
|
58
|
+
{request: xml, response: response}
|
59
|
+
end
|
60
|
+
|
61
|
+
def process_single_certification_check_with_token options={}, terminal_id=nil, identifier='R'
|
62
|
+
@terminal_id = terminal_id.to_s
|
63
|
+
@data_packet = data_packet(options, identifier)
|
64
|
+
xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
|
65
|
+
response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
|
66
|
+
response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
|
67
|
+
{request: xml, response: response}
|
68
|
+
end
|
69
|
+
|
70
|
+
def data_packet options={}, identifier
|
71
|
+
identifier = options[:identifier] if options[:identifier].present?
|
72
|
+
xml = <<xml
|
73
|
+
<AUTH_GATEWAY REQUEST_ID="#{options[:request_id]}">
|
74
|
+
<TRANSACTION>
|
75
|
+
<TRANSACTION_ID>#{options[:transaction_id]}</TRANSACTION_ID>
|
76
|
+
<MERCHANT>
|
77
|
+
<TERMINAL_ID>#{@terminal_id}</TERMINAL_ID>
|
78
|
+
</MERCHANT>
|
79
|
+
<PACKET>
|
80
|
+
<IDENTIFIER>#{identifier}</IDENTIFIER>
|
81
|
+
<ACCOUNT>
|
82
|
+
<ROUTING_NUMBER>#{options[:routing_number]}</ROUTING_NUMBER>
|
83
|
+
<ACCOUNT_NUMBER>#{options[:account_number]}</ACCOUNT_NUMBER>
|
84
|
+
#{check_number(options) if options[:check_number].present?}
|
85
|
+
<ACCOUNT_TYPE>#{options[:account_type]}</ACCOUNT_TYPE>
|
86
|
+
</ACCOUNT>
|
87
|
+
<CONSUMER>
|
88
|
+
#{consumer_info(options)}
|
89
|
+
<ADDRESS1>#{options[:address_1]}</ADDRESS1>
|
90
|
+
<ADDRESS2>#{options[:address_2]}</ADDRESS2>
|
91
|
+
<CITY>#{options[:city]}</CITY>
|
92
|
+
<STATE>#{options[:state]}</STATE>
|
93
|
+
<ZIP>#{options[:zip]}</ZIP>
|
94
|
+
<PHONE_NUMBER>#{options[:phone_number]}</PHONE_NUMBER>
|
95
|
+
<DL_STATE>#{options[:dl_state]}</DL_STATE>
|
96
|
+
<DL_NUMBER>#{options[:dl_number]}</DL_NUMBER>
|
97
|
+
<COURTESY_CARD_ID></COURTESY_CARD_ID>
|
98
|
+
#{identity_block options}
|
99
|
+
</CONSUMER>
|
100
|
+
<CHECK>
|
101
|
+
<CHECK_AMOUNT>#{options[:check_amount]}</CHECK_AMOUNT>
|
102
|
+
</CHECK>
|
103
|
+
</PACKET>
|
104
|
+
</TRANSACTION>
|
105
|
+
</AUTH_GATEWAY>
|
106
|
+
xml
|
107
|
+
|
108
|
+
xml.gsub!("<", "<").gsub!(">", ">")
|
109
|
+
end
|
110
|
+
|
111
|
+
def identity_block options
|
112
|
+
if ["12", "13", "16", "17"].include? @terminal_id[2..3]
|
113
|
+
<<xml
|
114
|
+
<IDENTITY>
|
115
|
+
<DOB_YEAR>#{options[:dob_year]}</DOB_YEAR>
|
116
|
+
</IDENTITY>
|
117
|
+
xml
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def consumer_info options
|
122
|
+
options[:company_name].present? ? corporate_consumer(options) : non_corporate_consumer(options)
|
123
|
+
end
|
124
|
+
|
125
|
+
def check_number options
|
126
|
+
<<xml
|
127
|
+
<CHECK_NUMBER>#{options[:check_number]}</CHECK_NUMBER>
|
128
|
+
xml
|
129
|
+
end
|
130
|
+
|
131
|
+
def corporate_consumer options
|
132
|
+
<<xml
|
133
|
+
<COMPANY_NAME>#{options[:company_name]}</COMPANY_NAME>
|
134
|
+
xml
|
135
|
+
end
|
136
|
+
|
137
|
+
def non_corporate_consumer options
|
138
|
+
<<xml
|
139
|
+
<FIRST_NAME>#{options[:first_name]}</FIRST_NAME>
|
140
|
+
<LAST_NAME>#{options[:last_name]}</LAST_NAME>
|
141
|
+
xml
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Paya
|
2
|
+
module Ccd
|
3
|
+
module Guaranteed
|
4
|
+
|
5
|
+
class CreditDebitTransaction < Base
|
6
|
+
attr_accessor :request_id, :transaction_id, :routing_number, :account_number, :account_type, :company_name, :address_1, :address_2, :city, :state, :dl_state, :dl_number, :dob_year, :zip, :phone_number, :check_amount , :identifier
|
7
|
+
|
8
|
+
def initialize options={}
|
9
|
+
@options = options
|
10
|
+
@request_id = options[:request_id]
|
11
|
+
@transaction_id = options[:transaction_id]
|
12
|
+
@routing_number = options[:routing_number]
|
13
|
+
@account_number = options[:account_number]
|
14
|
+
@account_type = options[:account_type]
|
15
|
+
@company_name = options[:company_name]
|
16
|
+
@address_1 = options[:address_1]
|
17
|
+
@address_2 = options[:address_2]
|
18
|
+
@city = options[:city]
|
19
|
+
@state = options[:state]
|
20
|
+
@dl_state = options[:dl_state]
|
21
|
+
@dl_number = options[:dl_number]
|
22
|
+
@dob_year = options[:dob_year]
|
23
|
+
@zip = options[:zip]
|
24
|
+
@phone_number = options[:phone_number]
|
25
|
+
@check_amount = options[:check_amount]
|
26
|
+
@identifier = options[:identifier]
|
27
|
+
end
|
28
|
+
|
29
|
+
def process check_verification=false, identity_verification=false, dl_required=false
|
30
|
+
if check_verification == false and identity_verification == false and dl_required == false
|
31
|
+
check_no_verification_dl_optional
|
32
|
+
elsif check_verification == false and identity_verification == false and dl_required == true
|
33
|
+
check_no_verification_dl_required
|
34
|
+
elsif check_verification == true and identity_verification == true and dl_required == false
|
35
|
+
check_verification_identity_verification_dl_optional
|
36
|
+
elsif check_verification == true and identity_verification == true and dl_required == true
|
37
|
+
check_verification_identity_verification_dl_required
|
38
|
+
elsif check_verification == true and identity_verification == false and dl_required == false
|
39
|
+
check_verification_only_dl_optional
|
40
|
+
elsif check_verification == true and identity_verification == false and dl_required == true
|
41
|
+
check_verification_only_dl_required
|
42
|
+
elsif check_verification == false and identity_verification == true and dl_required == false
|
43
|
+
identity_verification_only_dl_optional
|
44
|
+
elsif check_verification == false and identity_verification == true and dl_required == true
|
45
|
+
identity_verification_only_dl_required
|
46
|
+
else
|
47
|
+
raise "Transaction not supported"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def check_no_verification_dl_optional
|
52
|
+
process_single_check @options, 1910, 'R'
|
53
|
+
end
|
54
|
+
|
55
|
+
def check_no_verification_dl_required
|
56
|
+
process_single_check @options, 1911, 'R'
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_verification_identity_verification_dl_optional
|
60
|
+
process_single_check @options, 1912, 'R'
|
61
|
+
end
|
62
|
+
|
63
|
+
def check_verification_identity_verification_dl_required
|
64
|
+
process_single_check @options, 1913, 'R'
|
65
|
+
end
|
66
|
+
|
67
|
+
def check_verification_only_dl_optional
|
68
|
+
process_single_check @options, 1914, 'R'
|
69
|
+
end
|
70
|
+
|
71
|
+
def check_verification_only_dl_required
|
72
|
+
process_single_check @options, 1915, 'R'
|
73
|
+
end
|
74
|
+
|
75
|
+
def identity_verification_only_dl_optional
|
76
|
+
process_single_check @options, 1916, 'R'
|
77
|
+
end
|
78
|
+
|
79
|
+
def identity_verification_only_dl_required
|
80
|
+
process_single_check @options, 1917, 'R'
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|