corepro 0.0.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +15 -15
  3. data/.idea/.rakeTasks +1 -1
  4. data/.idea/corepro-sdk-ruby.iml +12 -134
  5. data/.idea/modules.xml +1 -3
  6. data/CorePro.gemspec +25 -23
  7. data/Gemfile +14 -14
  8. data/README.md +47 -47
  9. data/Rakefile +2 -2
  10. data/lib/corepro.rb +13 -13
  11. data/lib/corepro/account.rb +47 -6
  12. data/lib/corepro/bank_document.rb +2 -2
  13. data/lib/corepro/card.rb +91 -0
  14. data/lib/corepro/customer.rb +28 -34
  15. data/lib/corepro/customer_beneficiary.rb +4 -15
  16. data/lib/corepro/customer_document.rb +0 -10
  17. data/lib/corepro/external_account.rb +8 -21
  18. data/lib/corepro/models/account_access.rb +25 -0
  19. data/lib/corepro/models/customer_beneficiary_id_only.rb +8 -8
  20. data/lib/corepro/models/model_base.rb +1 -1
  21. data/lib/corepro/models/program_account.rb +20 -0
  22. data/lib/corepro/models/program_checking.rb +36 -36
  23. data/lib/corepro/models/program_e_code.rb +30 -30
  24. data/lib/corepro/models/program_external_account.rb +21 -0
  25. data/lib/corepro/models/program_interest_rate.rb +5 -0
  26. data/lib/corepro/models/program_prepaid.rb +36 -36
  27. data/lib/corepro/models/program_savings.rb +35 -35
  28. data/lib/corepro/program.rb +9 -0
  29. data/lib/corepro/transaction.rb +8 -1
  30. data/lib/corepro/utils/requestor.rb +3 -3
  31. data/lib/corepro/version.rb +4 -4
  32. data/test/a_program_test.rb +12 -0
  33. data/test/aa_customer_test.rb +74 -0
  34. data/test/ab_account_test.rb +44 -0
  35. data/test/ac_external_account_test.rb +39 -0
  36. data/test/ad_customer_beneficiary_test.rb +42 -42
  37. data/test/ae_customer_document_test.rb +15 -15
  38. data/test/af_bankdocument_test.rb +19 -19
  39. data/test/ag_external_account_document_test.rb +17 -17
  40. data/test/ai_statement_test.rb +22 -22
  41. data/test/aj_transfer_test.rb +53 -0
  42. data/test/ak_transaction_test.rb +18 -8
  43. data/test/core_pro_test_base.rb +9 -23
  44. metadata +50 -41
  45. data/.idea/runConfigurations/All_tests_in_corepro_sdk_ruby__corepro_sdk_ruby.xml +0 -34
  46. data/test/aa_customer_nacha_test.rb +0 -63
  47. data/test/aa_customer_prepaid_test.rb +0 -55
  48. data/test/aaa_program_test.rb +0 -11
  49. data/test/ab_account_nacha_test.rb +0 -46
  50. data/test/ab_account_prepaid_test.rb +0 -46
  51. data/test/ac_external_account_nacha_test.rb +0 -6
  52. data/test/ac_external_account_prepaid_test.rb +0 -46
  53. data/test/aj_transfer_nacha_test.rb +0 -6
  54. data/test/aj_transfer_prepaid_test.rb +0 -36
@@ -1,31 +1,31 @@
1
- require_relative 'json_base'
2
- module CorePro
3
- module Models
4
- class ProgramECode < JsonBase
5
-
6
- def is_hash?
7
- true
8
- end
9
-
10
- attr_accessor :category
11
- attr_accessor :type
12
- attr_accessor :programECodeId
13
- attr_accessor :productCode
14
- attr_accessor :minimumAmount
15
- attr_accessor :maximumAmount
16
- attr_accessor :name
17
- attr_accessor :imageUrl
18
- attr_accessor :isReissueSupported
19
-
20
- def initialize
21
- super
22
- end
23
-
24
- def from_json! json, classDefs
25
- classDefs = classDefs || {}
26
-
27
- super json, classDefs
28
- end
29
- end
30
- end
1
+ require_relative 'json_base'
2
+ module CorePro
3
+ module Models
4
+ class ProgramECode < JsonBase
5
+
6
+ def is_hash?
7
+ true
8
+ end
9
+
10
+ attr_accessor :category
11
+ attr_accessor :type
12
+ attr_accessor :programECodeId
13
+ attr_accessor :productCode
14
+ attr_accessor :minimumAmount
15
+ attr_accessor :maximumAmount
16
+ attr_accessor :name
17
+ attr_accessor :imageUrl
18
+ attr_accessor :isReissueSupported
19
+
20
+ def initialize
21
+ super
22
+ end
23
+
24
+ def from_json! json, classDefs
25
+ classDefs = classDefs || {}
26
+
27
+ super json, classDefs
28
+ end
29
+ end
30
+ end
31
31
  end
@@ -0,0 +1,21 @@
1
+ require_relative 'json_base'
2
+ module CorePro
3
+ module Models
4
+ class ProgramExternalAccount < JsonBase
5
+
6
+ def is_hash?
7
+ true
8
+ end
9
+
10
+ attr_accessor :programExternalAccountId
11
+ attr_accessor :type
12
+ attr_accessor :routingNumber
13
+ attr_accessor :accountNumber
14
+ attr_accessor :accountNumberMasked
15
+ attr_accessor :description
16
+ attr_accessor :nachaName
17
+ attr_accessor :isActive
18
+
19
+ end
20
+ end
21
+ end
@@ -7,6 +7,11 @@ module CorePro
7
7
  attr_accessor :apr
8
8
  attr_accessor :minimumAmount
9
9
  attr_accessor :maximumAmount
10
+ attr_accessor :effectiveDate
11
+ attr_accessor :expireDate
12
+ attr_accessor :rateEffectiveDate
13
+ attr_accessor :rateExpireDate
14
+ attr_accessor :description
10
15
 
11
16
  end
12
17
  end
@@ -1,37 +1,37 @@
1
- require_relative 'json_base'
2
- require_relative 'program_interest_rate'
3
- require_relative 'program_limit'
4
- module CorePro
5
- module Models
6
- class ProgramPrepaid < JsonBase
7
- def is_hash?
8
- true
9
- end
10
- attr_accessor :category
11
- attr_accessor :type
12
- attr_accessor :balanceLimit
13
- attr_accessor :interestRates
14
- attr_accessor :isImmediateLoadFromLinkedAccountEnabled
15
- attr_accessor :isExternalWithdrawEnabled
16
- attr_accessor :isInterestEnabled
17
- attr_accessor :isRecurringContributionEnabled
18
- attr_accessor :perTransactionDepositLimit
19
- attr_accessor :perTransactionWithdrawLimit
20
-
21
- def initialize
22
- super
23
- @interestRates = []
24
- end
25
-
26
- def from_json! json, classDefs
27
- classDefs = classDefs || {}
28
- classDefs['balanceLimit'] = CorePro::Models::ProgramLimit
29
- classDefs['interestRates'] = CorePro::Models::ProgramInterestRate
30
- classDefs['perTransactionDepositLimit'] = CorePro::Models::ProgramLimit
31
- classDefs['perTransactionWithdrawLimit'] = CorePro::Models::ProgramLimit
32
-
33
- super json, classDefs
34
- end
35
- end
36
- end
1
+ require_relative 'json_base'
2
+ require_relative 'program_interest_rate'
3
+ require_relative 'program_limit'
4
+ module CorePro
5
+ module Models
6
+ class ProgramPrepaid < JsonBase
7
+ def is_hash?
8
+ true
9
+ end
10
+ attr_accessor :category
11
+ attr_accessor :type
12
+ attr_accessor :balanceLimit
13
+ attr_accessor :interestRates
14
+ attr_accessor :isImmediateLoadFromLinkedAccountEnabled
15
+ attr_accessor :isExternalWithdrawEnabled
16
+ attr_accessor :isInterestEnabled
17
+ attr_accessor :isRecurringContributionEnabled
18
+ attr_accessor :perTransactionDepositLimit
19
+ attr_accessor :perTransactionWithdrawLimit
20
+
21
+ def initialize
22
+ super
23
+ @interestRates = []
24
+ end
25
+
26
+ def from_json! json, classDefs
27
+ classDefs = classDefs || {}
28
+ classDefs['balanceLimit'] = CorePro::Models::ProgramLimit
29
+ classDefs['interestRates'] = CorePro::Models::ProgramInterestRate
30
+ classDefs['perTransactionDepositLimit'] = CorePro::Models::ProgramLimit
31
+ classDefs['perTransactionWithdrawLimit'] = CorePro::Models::ProgramLimit
32
+
33
+ super json, classDefs
34
+ end
35
+ end
36
+ end
37
37
  end
@@ -1,36 +1,36 @@
1
- require_relative 'json_base'
2
- require_relative 'program_interest_rate'
3
- require_relative 'program_limit'
4
- module CorePro
5
- module Models
6
- class ProgramSavings < JsonBase
7
- def is_hash?
8
- true
9
- end
10
- attr_accessor :category
11
- attr_accessor :type
12
- attr_accessor :balanceLimit
13
- attr_accessor :interestRates
14
- attr_accessor :isExternalWithdrawEnabled
15
- attr_accessor :isInterestEnabled
16
- attr_accessor :isRecurringContributionEnabled
17
- attr_accessor :perTransactionDepositLimit
18
- attr_accessor :perTransactionWithdrawLimit
19
-
20
- def initialize
21
- @interestRates = []
22
- super
23
- end
24
-
25
- def from_json! json, classDefs
26
- classDefs = classDefs || {}
27
- classDefs['balanceLimit'] = CorePro::Models::ProgramLimit
28
- classDefs['interestRates'] = CorePro::Models::ProgramInterestRate
29
- classDefs['perTransactionDepositLimit'] = CorePro::Models::ProgramLimit
30
- classDefs['perTransactionWithdrawLimit'] = CorePro::Models::ProgramLimit
31
-
32
- super json, classDefs
33
- end
34
- end
35
- end
1
+ require_relative 'json_base'
2
+ require_relative 'program_interest_rate'
3
+ require_relative 'program_limit'
4
+ module CorePro
5
+ module Models
6
+ class ProgramSavings < JsonBase
7
+ def is_hash?
8
+ true
9
+ end
10
+ attr_accessor :category
11
+ attr_accessor :type
12
+ attr_accessor :balanceLimit
13
+ attr_accessor :interestRates
14
+ attr_accessor :isExternalWithdrawEnabled
15
+ attr_accessor :isInterestEnabled
16
+ attr_accessor :isRecurringContributionEnabled
17
+ attr_accessor :perTransactionDepositLimit
18
+ attr_accessor :perTransactionWithdrawLimit
19
+
20
+ def initialize
21
+ @interestRates = []
22
+ super
23
+ end
24
+
25
+ def from_json! json, classDefs
26
+ classDefs = classDefs || {}
27
+ classDefs['balanceLimit'] = CorePro::Models::ProgramLimit
28
+ classDefs['interestRates'] = CorePro::Models::ProgramInterestRate
29
+ classDefs['perTransactionDepositLimit'] = CorePro::Models::ProgramLimit
30
+ classDefs['perTransactionWithdrawLimit'] = CorePro::Models::ProgramLimit
31
+
32
+ super json, classDefs
33
+ end
34
+ end
35
+ end
36
36
  end
@@ -1,7 +1,9 @@
1
1
  require_relative 'models/model_base'
2
2
  require_relative 'utils/requestor'
3
+ require_relative 'models/program_account'
3
4
  require_relative 'models/program_checking'
4
5
  require_relative 'models/program_e_code'
6
+ require_relative 'models/program_external_account'
5
7
  require_relative 'models/program_interest_rate'
6
8
  require_relative 'models/program_savings'
7
9
  require_relative 'models/program_prepaid'
@@ -30,6 +32,8 @@ module CorePro
30
32
  attr_accessor :eCodeProducts
31
33
  attr_accessor :savingsProducts
32
34
  attr_accessor :prepaidProducts
35
+ attr_accessor :accounts
36
+ attr_accessor :externalAccounts
33
37
 
34
38
  def initialize
35
39
  super
@@ -37,6 +41,8 @@ module CorePro
37
41
  @eCodeProducts = {}
38
42
  @savingsProducts = {}
39
43
  @prepaidProducts = {}
44
+ @accounts = {}
45
+ @externalAccounts = {}
40
46
  end
41
47
 
42
48
  def from_json! json, classDefs
@@ -54,6 +60,9 @@ module CorePro
54
60
  classDefs['savingsProducts'] = CorePro::Models::ProgramSavings
55
61
  classDefs['prepaidProducts'] = CorePro::Models::ProgramPrepaid
56
62
 
63
+ classDefs['accounts'] = CorePro::Models::ProgramAccount
64
+ classDefs['externalAccounts'] = CorePro::Models::ProgramExternalAccount
65
+
57
66
  super json, classDefs
58
67
  end
59
68
 
@@ -37,9 +37,16 @@ module CorePro
37
37
  start = '1900-01-01'
38
38
  end
39
39
 
40
- CorePro::Utils::Requestor.get("/transaction/list/#{self.customerId}/#{accountId}/#{escape(status)}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
40
+ CorePro::Utils::Requestor.get("/transaction/list/#{self.customerId}/#{accountId}/#{Transaction.escape(status)}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
41
41
  end
42
42
 
43
+ def self.get(customerId, transactionId, connection = nil, loggingObject = nil)
44
+ CorePro::Utils::Requestor.get("/transaction/get/#{customerId}/#{transactionId}", Transaction, connection, loggingObject)
45
+ end
46
+
47
+ def self.getByTag(customerId, tag, connection = nil, loggingObject = nil)
48
+ CorePro::Utils::Requestor.get("/transaction/getByTag/#{customerId}/#{Transaction.escape(tag)}", Transaction, connection, loggingObject)
49
+ end
43
50
 
44
51
  end
45
52
  end
@@ -40,7 +40,7 @@ module CorePro
40
40
  http = Net::HTTP.new(uri.host, uri.port)
41
41
  end
42
42
  http.use_ssl = true
43
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
44
44
  headers = { 'User-Agent' => SDK_USER_AGENT,
45
45
  'Content-Type' => 'application/json; charset=utf-8',
46
46
  'Accept' => 'application/json; charset=utf-8',
@@ -69,7 +69,7 @@ module CorePro
69
69
  http = Net::HTTP.new(uri.host, uri.port)
70
70
  end
71
71
  http.use_ssl = true
72
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
72
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
73
73
  headers = { 'User-Agent' => SDK_USER_AGENT,
74
74
  'Content-Type' => 'application/json; charset=utf-8',
75
75
  'Accept' => 'application/json; charset=utf-8',
@@ -105,7 +105,7 @@ module CorePro
105
105
  if envelope.errors.length > 0
106
106
  raise CorePro::CoreProApiException.new(envelope.errors)
107
107
  else
108
- if classDef == NIL
108
+ if classDef == nil
109
109
  # no class definition given, return raw envelope
110
110
  envelope
111
111
  else
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby -w
2
- module CorePro
3
- VERSION = '0.0.9'
4
- end
1
+ #!/usr/bin/ruby -w
2
+ module CorePro
3
+ VERSION = '1.0.0'
4
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'core_pro_test_base'
2
+ require_relative '../lib/corepro/program'
3
+
4
+ class AProgramTest < CoreProTestBase
5
+ def test_get
6
+ p = CorePro::Program.get @@exampleConn, nil
7
+ pa = p.accounts.select {|e| e.type == 'ProgramReserve'}
8
+ @@exampleProgramReserveAccountId = pa[0].programAccountId
9
+ puts "Program Reserve AccountId=#{@@exampleProgramReserveAccountId}"
10
+ assert_equal 'Example1', p.name
11
+ end
12
+ end
@@ -0,0 +1,74 @@
1
+ require_relative 'core_pro_test_base'
2
+ require_relative '../lib/corepro/customer'
3
+ require_relative '../lib/corepro/models/customer_address'
4
+ require_relative '../lib/corepro/models/customer_response'
5
+
6
+ class AaCustomerTest < CoreProTestBase
7
+
8
+ def test_aaa_create
9
+ c = CorePro::Customer.new
10
+ c.birthDate = '01/01/1985'
11
+ c.culture = 'en-US'
12
+ c.firstName = 'Joey'
13
+ c.middleName = 'Flanagan'
14
+ c.lastName = "McTester#{@@timestamp}"
15
+ c.gender = 'M'
16
+ c.isDocumentsAccepted = true
17
+ c.isSubjectToBackupWithholding = false
18
+ c.isOptedInToBankCommunication = false
19
+ c.tag = "jfm#{@@timestamp}"
20
+ c.taxId = '012341234'
21
+
22
+ ra = CorePro::Models::CustomerAddress.new
23
+ ra.addressLine1 = '123 Main Street'
24
+ ra.city = 'Anytown'
25
+ ra.state = 'IA'
26
+ ra.postalCode = '55555'
27
+ ra.addressType = 'residence'
28
+ ra.country = 'US'
29
+ ra.isActive = 1
30
+ c.addresses.push(ra)
31
+
32
+ #@@exampleCustomerInitiateResponse = c.initiate(@@exampleConn, nil)
33
+ @@exampleCustomerId = c.create(@@exampleConn, nil)
34
+ puts "customerId=#{@@exampleCustomerId}"
35
+ assert @@exampleCustomerId > 0
36
+ end
37
+
38
+ # def test_aaa_verify
39
+ # c = CorePro::Customer.new
40
+ # c.customerId = @@exampleCustomerId
41
+ # end
42
+
43
+ def test_get
44
+ puts "getting #{@@exampleCustomerId}..."
45
+ c = CorePro::Customer.get @@exampleCustomerId, @@exampleConn, nil
46
+ assert c != nil, "Could not 'get' customerId #{@@exampleCustomerId}"
47
+ end
48
+
49
+ def test_getByTag
50
+ c = CorePro::Customer.getByTag "jfm#{@@timestamp}", @@exampleConn, nil
51
+ assert c != nil, "Could not 'getByTag' tag 'jfm#{@@timestamp}'"
52
+ end
53
+
54
+ def test_list
55
+ cs = CorePro::Customer.list 0, 15, @@exampleConn, nil
56
+ assert cs != nil && cs.length > 0, "Could not list customers"
57
+ end
58
+
59
+ def test_search
60
+ c = CorePro::Customer.new
61
+ c.lastName = "McTester#{@@timestamp}"
62
+ cs = c.search nil, nil, @@exampleConn, nil
63
+ assert cs != nil && cs.length > 0, "Could not search 'McTester#{@@timestamp}'"
64
+ end
65
+
66
+ def test_update
67
+ c = CorePro::Customer.new
68
+ c.customerId = @@exampleCustomerId
69
+ c.firstName = "Joey#{@@timestamp}"
70
+ customerId = c.update @@exampleConn, nil
71
+ assert customerId > 0
72
+ end
73
+
74
+ end
@@ -0,0 +1,44 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/account'
3
+
4
+ class AbAccountTest < CoreProTestBase
5
+
6
+ def test_create
7
+ a = CorePro::Account.new
8
+ a.customerId = @@exampleCustomerId
9
+ a.tag = "act ruby #{@@timestamp}"
10
+ a.type = 'Checking'
11
+ a.category = 'CategoryA'
12
+ a.subCategory = 'CategoryB'
13
+ a.isCloseable = true
14
+ a.name = "Account #{@@timestamp}"
15
+ a.targetAmount = 500
16
+ a.targetDate = '01/01/2030'
17
+ @@exampleAccountId = a.create @@exampleConn, nil
18
+ puts "accountId=#{@@exampleAccountId}"
19
+ assert @@exampleAccountId > 0
20
+
21
+ end
22
+
23
+ def test_list
24
+ accounts = CorePro::Account.list(@@exampleCustomerId, @@exampleConn, nil)
25
+ assert_equal 1, accounts.length, "Listed #{accounts.length} accounts for customerId=#{@@exampleCustomerId}"
26
+ end
27
+
28
+ def test_get
29
+ puts "getting #{@@exampleAccountId}..."
30
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
31
+ assert_equal 'CategoryB', a.subCategory
32
+ end
33
+
34
+ def test_update
35
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
36
+ a = CorePro::Account.new
37
+ a.accountId = @@exampleAccountId
38
+ a.customerId = @@exampleCustomerId
39
+ a.name = "Updated account #{@@timestamp}"
40
+ accountId = a.update @@exampleConn, nil
41
+ assert accountId == @@exampleAccountId
42
+ end
43
+
44
+ end