paya 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/CODE_OF_CONDUCT.md +13 -0
  4. data/Gemfile +1 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +46 -0
  7. data/Rakefile +1 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/lib/paya.rb +111 -0
  11. data/lib/paya/base.rb +145 -0
  12. data/lib/paya/ccd/guaranteed/credit_debit_transaction.rb +87 -0
  13. data/lib/paya/ccd/guaranteed/debit_transaction.rb +85 -0
  14. data/lib/paya/ccd/non_guaranteed/credit_debit_transaction.rb +85 -0
  15. data/lib/paya/ccd/non_guaranteed/debit_transaction.rb +85 -0
  16. data/lib/paya/certification.rb +22 -0
  17. data/lib/paya/certification/ccd.rb +50 -0
  18. data/lib/paya/certification/ppd.rb +52 -0
  19. data/lib/paya/certification/tel.rb +54 -0
  20. data/lib/paya/certification/web.rb +52 -0
  21. data/lib/paya/ppd/guaranteed/credit_debit_transaction.rb +85 -0
  22. data/lib/paya/ppd/guaranteed/debit_transaction.rb +85 -0
  23. data/lib/paya/ppd/non_guaranteed/credit_debit_transaction.rb +85 -0
  24. data/lib/paya/ppd/non_guaranteed/debit_transaction.rb +86 -0
  25. data/lib/paya/tel/guaranteed/credit_debit_transaction.rb +69 -0
  26. data/lib/paya/tel/guaranteed/debit_transaction.rb +85 -0
  27. data/lib/paya/tel/non_guaranteed/credit_debit_transaction.rb +68 -0
  28. data/lib/paya/tel/non_guaranteed/debit_transaction.rb +85 -0
  29. data/lib/paya/version.rb +3 -0
  30. data/lib/paya/web/guaranteed/credit_debit_transaction.rb +68 -0
  31. data/lib/paya/web/guaranteed/debit_transaction.rb +68 -0
  32. data/lib/paya/web/non_guaranteed/credit_debit_transaction.rb +68 -0
  33. data/lib/paya/web/non_guaranteed/debit_transaction.rb +85 -0
  34. data/paya.gemspec +26 -0
  35. metadata +121 -0
@@ -0,0 +1,85 @@
1
+ module Paya
2
+ module Ccd
3
+ module Guaranteed
4
+ class DebitTransaction < Base
5
+ 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
6
+
7
+ def initialize options={}
8
+ @options = options
9
+ @request_id = options[:request_id]
10
+ @transaction_id = options[:transaction_id]
11
+ @routing_number = options[:routing_number]
12
+ @account_number = options[:account_number]
13
+ @account_type = options[:account_type]
14
+ @company_name = options[:company_name]
15
+ @address_1 = options[:address_1]
16
+ @address_2 = options[:address_2]
17
+ @city = options[:city]
18
+ @state = options[:state]
19
+ @dl_state = options[:dl_state]
20
+ @dl_number = options[:dl_number]
21
+ @dob_year = options[:dob_year]
22
+ @zip = options[:zip]
23
+ @phone_number = options[:phone_number]
24
+ @check_amount = options[:check_amount]
25
+ @identifier = options[:identifier]
26
+ end
27
+
28
+ def process check_verification=false, identity_verification=false, dl_required=false
29
+ if check_verification == false and identity_verification == false and dl_required == false
30
+ check_no_verification_dl_optional
31
+ elsif check_verification == false and identity_verification == false and dl_required == true
32
+ check_no_verification_dl_required
33
+ elsif check_verification == true and identity_verification == true and dl_required == false
34
+ check_verification_identity_verification_dl_optional
35
+ elsif check_verification == true and identity_verification == true and dl_required == true
36
+ check_verification_identity_verification_dl_required
37
+ elsif check_verification == true and identity_verification == false and dl_required == false
38
+ check_verification_only_dl_optional
39
+ elsif check_verification == true and identity_verification == false and dl_required == true
40
+ check_verification_only_dl_required
41
+ elsif check_verification == false and identity_verification == true and dl_required == false
42
+ identity_verification_only_dl_optional
43
+ elsif check_verification == false and identity_verification == true and dl_required == true
44
+ identity_verification_only_dl_required
45
+ else
46
+ raise "Transaction not supported"
47
+ end
48
+ end
49
+
50
+ def check_no_verification_dl_optional
51
+ process_single_check @options, 1710, 'R'
52
+ end
53
+
54
+ def check_no_verification_dl_required
55
+ process_single_check @options, 1711, 'R'
56
+ end
57
+
58
+ def check_verification_identity_verification_dl_optional
59
+ process_single_check @options, 1712, 'R'
60
+ end
61
+
62
+ def check_verification_identity_verification_dl_required
63
+ process_single_check @options, 1713, 'R'
64
+ end
65
+
66
+ def check_verification_only_dl_optional
67
+ process_single_check @options, 1714, 'R'
68
+ end
69
+
70
+ def check_verification_only_dl_required
71
+ process_single_check @options, 1715, 'R'
72
+ end
73
+
74
+ def identity_verification_only_dl_optional
75
+ process_single_check @options, 1716, 'R'
76
+ end
77
+
78
+ def identity_verification_only_dl_required
79
+ process_single_check @options, 1717, 'R'
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,85 @@
1
+ module Paya
2
+ module Ccd
3
+ module NonGuaranteed
4
+ class CreditDebitTransaction < Base
5
+ 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
6
+
7
+ def initialize options={}
8
+ @options = options
9
+ @request_id = options[:request_id]
10
+ @transaction_id = options[:transaction_id]
11
+ @routing_number = options[:routing_number]
12
+ @account_number = options[:account_number]
13
+ @account_type = options[:account_type]
14
+ @company_name = options[:company_name]
15
+ @address_1 = options[:address_1]
16
+ @address_2 = options[:address_2]
17
+ @city = options[:city]
18
+ @state = options[:state]
19
+ @dl_state = options[:dl_state]
20
+ @dl_number = options[:dl_number]
21
+ @dob_year = options[:dob_year]
22
+ @zip = options[:zip]
23
+ @phone_number = options[:phone_number]
24
+ @check_amount = options[:check_amount]
25
+ @identifier = options[:identifier]
26
+ end
27
+
28
+ def process check_verification=false, identity_verification=false, dl_required=false
29
+ if check_verification == false and identity_verification == false and dl_required == false
30
+ check_no_verification_dl_optional
31
+ elsif check_verification == false and identity_verification == false and dl_required == true
32
+ check_no_verification_dl_required
33
+ elsif check_verification == true and identity_verification == true and dl_required == false
34
+ check_verification_identity_verification_dl_optional
35
+ elsif check_verification == true and identity_verification == true and dl_required == true
36
+ check_verification_identity_verification_dl_required
37
+ elsif check_verification == true and identity_verification == false and dl_required == false
38
+ check_verification_only_dl_optional
39
+ elsif check_verification == true and identity_verification == false and dl_required == true
40
+ check_verification_only_dl_required
41
+ elsif check_verification == false and identity_verification == true and dl_required == false
42
+ identity_verification_only_dl_optional
43
+ elsif check_verification == false and identity_verification == true and dl_required == true
44
+ identity_verification_only_dl_required
45
+ else
46
+ raise "Transaction not supported"
47
+ end
48
+ end
49
+
50
+ def check_no_verification_dl_optional
51
+ process_single_check @options, 2910, 'R'
52
+ end
53
+
54
+ def check_no_verification_dl_required
55
+ process_single_check @options, 2911, 'R'
56
+ end
57
+
58
+ def check_verification_identity_verification_dl_optional
59
+ process_single_check @options, 2912, 'R'
60
+ end
61
+
62
+ def check_verification_identity_verification_dl_required
63
+ process_single_check @options, 2913, 'R'
64
+ end
65
+
66
+ def check_verification_only_dl_optional
67
+ process_single_check @options, 2914, 'R'
68
+ end
69
+
70
+ def check_verification_only_dl_required
71
+ process_single_check @options, 2915, 'R'
72
+ end
73
+
74
+ def identity_verification_only_dl_optional
75
+ process_single_check @options, 2916, 'R'
76
+ end
77
+
78
+ def identity_verification_only_dl_required
79
+ process_single_check @options, 2917, 'R'
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,85 @@
1
+ module Paya
2
+ module Ccd
3
+ module NonGuaranteed
4
+ class DebitTransaction < Base
5
+ 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
6
+
7
+ def initialize options={}
8
+ @options = options
9
+ @request_id = options[:request_id]
10
+ @transaction_id = options[:transaction_id]
11
+ @routing_number = options[:routing_number]
12
+ @account_number = options[:account_number]
13
+ @account_type = options[:account_type]
14
+ @company_name = options[:company_name]
15
+ @address_1 = options[:address_1]
16
+ @address_2 = options[:address_2]
17
+ @city = options[:city]
18
+ @state = options[:state]
19
+ @dl_state = options[:dl_state]
20
+ @dl_number = options[:dl_number]
21
+ @dob_year = options[:dob_year]
22
+ @zip = options[:zip]
23
+ @phone_number = options[:phone_number]
24
+ @check_amount = options[:check_amount]
25
+ @identifier = options[:identifier]
26
+ end
27
+
28
+ def process check_verification=false, identity_verification=false, dl_required=false
29
+ if check_verification == false and identity_verification == false and dl_required == false
30
+ check_no_verification_dl_optional
31
+ elsif check_verification == false and identity_verification == false and dl_required == true
32
+ check_no_verification_dl_required
33
+ elsif check_verification == true and identity_verification == true and dl_required == false
34
+ check_verification_identity_verification_dl_optional
35
+ elsif check_verification == true and identity_verification == true and dl_required == true
36
+ check_verification_identity_verification_dl_required
37
+ elsif check_verification == true and identity_verification == false and dl_required == false
38
+ check_verification_only_dl_optional
39
+ elsif check_verification == true and identity_verification == false and dl_required == true
40
+ check_verification_only_dl_required
41
+ elsif check_verification == false and identity_verification == true and dl_required == false
42
+ identity_verification_only_dl_optional
43
+ elsif check_verification == false and identity_verification == true and dl_required == true
44
+ identity_verification_only_dl_required
45
+ else
46
+ raise "Transaction not supported"
47
+ end
48
+ end
49
+
50
+ def check_no_verification_dl_optional
51
+ process_single_check @options, 2710, 'R'
52
+ end
53
+
54
+ def check_no_verification_dl_required
55
+ process_single_check @options, 2711, 'R'
56
+ end
57
+
58
+ def check_verification_identity_verification_dl_optional
59
+ process_single_check @options, 2712, 'R'
60
+ end
61
+
62
+ def check_verification_identity_verification_dl_required
63
+ process_single_check @options, 2713, 'R'
64
+ end
65
+
66
+ def check_verification_only_dl_optional
67
+ process_single_check @options, 2714, 'R'
68
+ end
69
+
70
+ def check_verification_only_dl_required
71
+ process_single_check @options, 2715, 'R'
72
+ end
73
+
74
+ def identity_verification_only_dl_optional
75
+ process_single_check @options, 2716, 'R'
76
+ end
77
+
78
+ def identity_verification_only_dl_required
79
+ process_single_check @options, 2717, 'R'
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,22 @@
1
+ module Paya
2
+ module Certification
3
+
4
+ class << self
5
+ def request
6
+ response = {}
7
+ ppd_certification = Paya::Certification::Ppd.new
8
+ response[:ppd] = ppd_certification.script
9
+
10
+ ccd_certification = Paya::Certification::Ccd.new
11
+ response[:ccd] = ccd_certification.script
12
+
13
+ web_certification = Paya::Certification::Web.new
14
+ response[:web] = web_certification.script
15
+
16
+ tel_certification = Paya::Certification::Tel.new
17
+ response[:tel] = tel_certification.script
18
+ response
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,50 @@
1
+ module Paya
2
+ module Certification
3
+ class Ccd
4
+
5
+ TERMINAL_IDS = [1910, 1911, 1914, 1915, 1912, 1913, 1917, 1916]
6
+ ROUTING_NUMBERS = [490000018, 490000018, 490000034, 490000018, 490000018]
7
+ AMOUNTS = [1.50, -10.50, 1.84, 16.79, 1.50]
8
+ IDENTIFIERS = {0 => 'R', 1 => 'R', 2 => 'R', 3 => 'V', 4 => 'F'}
9
+
10
+ def initialize
11
+ #ToDo
12
+ end
13
+
14
+ def script
15
+ log = []
16
+ TERMINAL_IDS.each do |terminal_id|
17
+ AMOUNTS.each_with_index do |amount, index|
18
+ identifier = IDENTIFIERS[index]
19
+ options = build_options amount, ROUTING_NUMBERS[index], identifier
20
+ paya = Paya::Base.new
21
+ log << paya.process_single_certification_check(options, terminal_id, identifier)
22
+ end
23
+ end
24
+ log
25
+ end
26
+
27
+ def build_options amount, routing_number, identifier
28
+ {
29
+ request_id: '4654',
30
+ transaction_id: '0a4f529d-70fd-4ddb-b909-b5598dc07579',
31
+ routing_number: routing_number,
32
+ account_number: '24413815',
33
+ account_type: 'Checking',
34
+ company_name: 'Test',
35
+ address_1: '1001 Test Drive',
36
+ address_2: '#200',
37
+ city: 'Destin',
38
+ state: 'FL',
39
+ dl_state: 'FL',
40
+ dl_number: 'D12346544',
41
+ dob_year: 1951,
42
+ zip: '32540',
43
+ phone_number: '8001231456',
44
+ check_amount: amount,
45
+ identifier: identifier
46
+ }
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,52 @@
1
+
2
+ module Paya
3
+ module Certification
4
+ class Ppd
5
+
6
+ TERMINAL_IDS = [1810, 1811, 1814, 1815, 1812, 1813, 1817, 1816]
7
+ ROUTING_NUMBERS = [490000018, 490000018, 490000034, 490000018, 490000018]
8
+ AMOUNTS = [1.50, -10.50, 1.84, 16.79, 1.50]
9
+ IDENTIFIERS = {0 => 'R', 1 => 'R', 2 => 'R', 3 => 'V', 4 => 'F'}
10
+
11
+ def initialize
12
+ #ToDo
13
+ end
14
+
15
+ def script
16
+ log = []
17
+ TERMINAL_IDS.each do |terminal_id|
18
+ AMOUNTS.each_with_index do |amount, index|
19
+ identifier = IDENTIFIERS[index]
20
+ options = build_options amount, ROUTING_NUMBERS[index], identifier
21
+ paya = Paya::Base.new
22
+ log << paya.process_single_certification_check(options, terminal_id, identifier)
23
+ end
24
+ end
25
+ log
26
+ end
27
+
28
+ def build_options amount, routing_number, identifier
29
+ {
30
+ request_id: '4654',
31
+ transaction_id: '0a4f529d-70fd-4ddb-b909-b5598dc07579',
32
+ routing_number: routing_number,
33
+ account_number: '24413815',
34
+ account_type: 'Checking',
35
+ first_name: 'Test',
36
+ last_name: 'Name',
37
+ address_1: '1001 Test Drive',
38
+ address_2: '#200',
39
+ city: 'Destin',
40
+ state: 'FL',
41
+ dl_state: 'FL',
42
+ dl_number: 'D12346544',
43
+ dob_year: 1951,
44
+ zip: '32540',
45
+ phone_number: '8001231456',
46
+ check_amount: amount,
47
+ identifier: identifier
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,54 @@
1
+
2
+ module Paya
3
+ module Certification
4
+ class Tel
5
+
6
+ ROUTING_NUMBERS = [490000018, 490000034, 490000018, 490000018]
7
+ TERMINAL_IDS = [1210, 1211, 1214, 1215, 1212, 1213, 1217, 1216]
8
+ AMOUNTS = [1.50, 1.84, 16.79, 1.50]
9
+ IDENTIFIERS = {0 => 'R', 1 => 'R', 2 => 'V', 3 => 'F'}
10
+
11
+ def initialize
12
+ # ToDO
13
+ end
14
+
15
+ def script
16
+ log = []
17
+ TERMINAL_IDS.each do |terminal_id|
18
+ AMOUNTS.each_with_index do |amount, index|
19
+ identifier = IDENTIFIERS[index]
20
+ options = build_options amount, ROUTING_NUMBERS[index], identifier
21
+ paya = Paya::Base.new
22
+ pscc = paya.process_single_certification_check options, terminal_id, identifier
23
+ log << pscc
24
+ end
25
+ end
26
+ log
27
+ end
28
+
29
+ def build_options amount, routing_number, identifier
30
+ {
31
+ request_id: '4654',
32
+ transaction_id: '0a4f529d-70fd-4ddb-b909-b5598dc07579',
33
+ routing_number: routing_number,
34
+ account_number: '24413815',
35
+ account_type: 'Checking',
36
+ check_number: 13245657478,
37
+ first_name: 'Test',
38
+ last_name: 'Name',
39
+ address_1: '1001 Test Drive',
40
+ address_2: '#200',
41
+ city: 'Destin',
42
+ state: 'FL',
43
+ dl_state: 'FL',
44
+ dl_number: 'D12346544',
45
+ dob_year: 1951,
46
+ zip: '32540',
47
+ phone_number: '8001231456',
48
+ check_amount: amount,
49
+ identifier: identifier
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,52 @@
1
+ module Paya
2
+ module Certification
3
+ class Web
4
+
5
+ ROUTING_NUMBERS = [490000018, 490000034, 490000018, 490000018]
6
+ TERMINAL_IDS = [2310, 2311, 2314, 2315, 2312, 2313, 2317, 2316]
7
+ AMOUNTS = [1.50, 1.84, 16.79, 1.50]
8
+ IDENTIFIERS = {0 => 'R', 1 => 'R', 2 => 'V', 3 => 'F'}
9
+
10
+ def initialize
11
+ #ToDO
12
+ end
13
+
14
+ def script
15
+ log = []
16
+ TERMINAL_IDS.each do |terminal_id|
17
+ AMOUNTS.each_with_index do |amount, index|
18
+ identifier = IDENTIFIERS[index]
19
+ options = build_options amount, ROUTING_NUMBERS[index], identifier
20
+ paya = Paya::Base.new
21
+ pscc = paya.process_single_certification_check options, terminal_id, identifier
22
+ log << pscc
23
+ end
24
+ end
25
+ log
26
+ end
27
+
28
+ def build_options amount, routing_number, identifier
29
+ {
30
+ request_id: '4654',
31
+ transaction_id: '0a4f529d-70fd-4ddb-b909-b5598dc07579',
32
+ routing_number: routing_number,
33
+ account_number: '24413815',
34
+ account_type: 'Checking',
35
+ first_name: 'Test',
36
+ last_name: 'Test',
37
+ address_1: '1001 Test Drive',
38
+ address_2: '#200',
39
+ city: 'Destin',
40
+ state: 'FL',
41
+ dl_state: 'FL',
42
+ dl_number: 'D12346544',
43
+ dob_year: 1951,
44
+ zip: '32540',
45
+ phone_number: '8001231456',
46
+ check_amount: amount,
47
+ identifier: identifier
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end