corepro_fvr 1.0.9

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +15 -0
  4. data/LICENSE +21 -0
  5. data/README.md +47 -0
  6. data/Rakefile +2 -0
  7. data/config-sample.yml +5 -0
  8. data/corepro_fvr.gemspec +25 -0
  9. data/lib/corepro.rb +15 -0
  10. data/lib/corepro/account.rb +111 -0
  11. data/lib/corepro/account_close.rb +21 -0
  12. data/lib/corepro/bank_document.rb +42 -0
  13. data/lib/corepro/card.rb +90 -0
  14. data/lib/corepro/connection.rb +90 -0
  15. data/lib/corepro/core_pro_api_exception.rb +26 -0
  16. data/lib/corepro/customer.rb +140 -0
  17. data/lib/corepro/customer_beneficiary.rb +42 -0
  18. data/lib/corepro/customer_document.rb +22 -0
  19. data/lib/corepro/external_account.rb +84 -0
  20. data/lib/corepro/external_account_document.rb +34 -0
  21. data/lib/corepro/models/account_access.rb +25 -0
  22. data/lib/corepro/models/account_id_only.rb +9 -0
  23. data/lib/corepro/models/api_error.rb +14 -0
  24. data/lib/corepro/models/customer_address.rb +17 -0
  25. data/lib/corepro/models/customer_answer.rb +9 -0
  26. data/lib/corepro/models/customer_beneficiary_id_only.rb +8 -0
  27. data/lib/corepro/models/customer_id_only.rb +8 -0
  28. data/lib/corepro/models/customer_message.rb +10 -0
  29. data/lib/corepro/models/customer_phone.rb +11 -0
  30. data/lib/corepro/models/customer_question.rb +21 -0
  31. data/lib/corepro/models/customer_response.rb +28 -0
  32. data/lib/corepro/models/customer_verify_request.rb +28 -0
  33. data/lib/corepro/models/envelope.rb +37 -0
  34. data/lib/corepro/models/external_account_id_only.rb +8 -0
  35. data/lib/corepro/models/external_account_verify.rb +13 -0
  36. data/lib/corepro/models/file_content.rb +10 -0
  37. data/lib/corepro/models/json_base.rb +93 -0
  38. data/lib/corepro/models/model_base.rb +26 -0
  39. data/lib/corepro/models/program_account.rb +20 -0
  40. data/lib/corepro/models/program_checking.rb +38 -0
  41. data/lib/corepro/models/program_e_code.rb +31 -0
  42. data/lib/corepro/models/program_external_account.rb +21 -0
  43. data/lib/corepro/models/program_interest_rate.rb +18 -0
  44. data/lib/corepro/models/program_limit.rb +12 -0
  45. data/lib/corepro/models/program_prepaid.rb +37 -0
  46. data/lib/corepro/models/program_savings.rb +36 -0
  47. data/lib/corepro/program.rb +74 -0
  48. data/lib/corepro/statement.rb +25 -0
  49. data/lib/corepro/transaction.rb +53 -0
  50. data/lib/corepro/transfer.rb +42 -0
  51. data/lib/corepro/utils/logger.rb +9 -0
  52. data/lib/corepro/utils/requestor.rb +120 -0
  53. data/lib/corepro/version.rb +4 -0
  54. data/q2labs_public.pem +9 -0
  55. data/test.pdf +0 -0
  56. data/test/a_program_test.rb +12 -0
  57. data/test/aa_customer_test.rb +78 -0
  58. data/test/ab_account_test.rb +45 -0
  59. data/test/ac_external_account_test.rb +39 -0
  60. data/test/ad_customer_beneficiary_test.rb +43 -0
  61. data/test/ae_customer_document_test.rb +16 -0
  62. data/test/af_bankdocument_test.rb +20 -0
  63. data/test/ag_external_account_document_test.rb +18 -0
  64. data/test/ai_statement_test.rb +23 -0
  65. data/test/aj_transfer_test.rb +53 -0
  66. data/test/ak_transaction_test.rb +19 -0
  67. data/test/al_card_test.rb +51 -0
  68. data/test/core_pro_test_base.rb +30 -0
  69. metadata +170 -0
@@ -0,0 +1,78 @@
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
+ p = CorePro::Models::CustomerPhone.new
22
+ p.phoneType = 'mobile'
23
+ p.number = '515-555-1234'
24
+ c.phones.push(p)
25
+
26
+ ra = CorePro::Models::CustomerAddress.new
27
+ ra.addressLine1 = '123 Main Street'
28
+ ra.city = 'Anytown'
29
+ ra.state = 'IA'
30
+ ra.postalCode = '55555'
31
+ ra.addressType = 'residence'
32
+ ra.country = 'US'
33
+ ra.isActive = 1
34
+ c.addresses.push(ra)
35
+
36
+ #@@exampleCustomerInitiateResponse = c.initiate(@@exampleConn, nil)
37
+ @@exampleCustomerId = c.create(@@exampleConn, nil)
38
+ puts "customerId=#{@@exampleCustomerId}"
39
+ assert @@exampleCustomerId > 0
40
+ end
41
+
42
+ # def test_aaa_verify
43
+ # c = CorePro::Customer.new
44
+ # c.customerId = @@exampleCustomerId
45
+ # end
46
+
47
+ def test_get
48
+ puts "getting #{@@exampleCustomerId}..."
49
+ c = CorePro::Customer.get @@exampleCustomerId, @@exampleConn, nil
50
+ assert c != nil, "Could not 'get' customerId #{@@exampleCustomerId}"
51
+ end
52
+
53
+ def test_getByTag
54
+ c = CorePro::Customer.getByTag "jfm#{@@timestamp}", @@exampleConn, nil
55
+ assert c != nil, "Could not 'getByTag' tag 'jfm#{@@timestamp}'"
56
+ end
57
+
58
+ def test_list
59
+ cs = CorePro::Customer.list 0, 15, @@exampleConn, nil
60
+ assert cs != nil && cs.length > 0, "Could not list customers"
61
+ end
62
+
63
+ def test_search
64
+ c = CorePro::Customer.new
65
+ c.lastName = "McTester#{@@timestamp}"
66
+ cs = c.search nil, nil, @@exampleConn, nil
67
+ assert cs != nil && cs.length > 0, "Could not search 'McTester#{@@timestamp}'"
68
+ end
69
+
70
+ def test_update
71
+ c = CorePro::Customer.new
72
+ c.customerId = @@exampleCustomerId
73
+ c.firstName = "Joey#{@@timestamp}"
74
+ customerId = c.update @@exampleConn, nil
75
+ assert customerId > 0
76
+ end
77
+
78
+ end
@@ -0,0 +1,45 @@
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.productId = 348741
12
+ a.category = 'CategoryA'
13
+ a.subCategory = 'CategoryB'
14
+ a.isCloseable = true
15
+ a.name = "Account #{@@timestamp}"
16
+ a.targetAmount = 500
17
+ a.targetDate = '01/01/2030'
18
+ @@exampleAccountId = a.create @@exampleConn, nil
19
+ puts "accountId=#{@@exampleAccountId}"
20
+ assert @@exampleAccountId > 0
21
+
22
+ end
23
+
24
+ def test_list
25
+ accounts = CorePro::Account.list(@@exampleCustomerId, @@exampleConn, nil)
26
+ assert_equal 1, accounts.length, "Listed #{accounts.length} accounts for customerId=#{@@exampleCustomerId}"
27
+ end
28
+
29
+ def test_get
30
+ puts "getting #{@@exampleAccountId}..."
31
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
32
+ assert_equal 'CategoryB', a.subCategory
33
+ end
34
+
35
+ def test_update
36
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
37
+ a = CorePro::Account.new
38
+ a.accountId = @@exampleAccountId
39
+ a.customerId = @@exampleCustomerId
40
+ a.name = "Updated account #{@@timestamp}"
41
+ accountId = a.update @@exampleConn, nil
42
+ assert accountId == @@exampleAccountId
43
+ end
44
+
45
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/external_account'
3
+
4
+ class AcExternalAccountTest < CoreProTestBase
5
+ def test_create
6
+ ea = CorePro::ExternalAccount.new
7
+ ea.customerId = @@exampleCustomerId
8
+ ea.tag = "extact ruby #{@@timestamp}"
9
+ ea.routingNumber = '123456789'
10
+ ea.accountNumber = '987654321'
11
+ ea.firstName = 'Edwin'
12
+ ea.lastName = 'Awesome'
13
+ ea.nickName = "Savings #{@@timestamp}"
14
+ ea.type = 'Savings'
15
+ ea.tag = "ext_acct_#{@@timestamp}"
16
+ @@exampleExternalAccountId = ea.create @@exampleConn, nil
17
+ puts "externalAccountId=#{@@exampleExternalAccountId}"
18
+ assert @@exampleExternalAccountId > 0
19
+
20
+ end
21
+
22
+ def test_get
23
+ puts "getting #{@@exampleExternalAccountId}..."
24
+ ea = CorePro::ExternalAccount.get(@@exampleCustomerId, @@exampleExternalAccountId, @@exampleConn, nil)
25
+ assert_equal 'COREPRO SANDBOX BANK', ea.name
26
+ end
27
+
28
+ def test_list
29
+ externalAccounts = CorePro::ExternalAccount.list(@@exampleCustomerId, @@exampleConn, nil)
30
+ assert_equal 1, externalAccounts.length, "Listed #{externalAccounts.length} external accounts for customerId=#{@@exampleCustomerId}"
31
+ end
32
+
33
+ def test_update
34
+ ea = CorePro::ExternalAccount.get(@@exampleCustomerId, @@exampleExternalAccountId, @@exampleConn, nil)
35
+ ea.nickName = "Updated external account #{@@timestamp}"
36
+ externalAccountId = ea.update @@exampleConn, nil
37
+ assert externalAccountId == @@exampleExternalAccountId
38
+ end
39
+ end
@@ -0,0 +1,43 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/customer_beneficiary'
3
+
4
+ class AdCustomerBeneficiaryTest < CoreProTestBase
5
+
6
+ def test_create
7
+ cb = CorePro::CustomerBeneficiary.new
8
+ cb.customerId = @@exampleCustomerId
9
+ cb.firstName = 'Freddie'
10
+ cb.lastName = "Mercury Ruby #{@@timestamp}"
11
+ cb.birthDate = '1969-05-05T00:00:00.000+00:00'
12
+ cb.taxId = '123412349'
13
+ @@exampleCustomerBeneficiaryId = cb.create @@exampleConn, nil
14
+ assert @@exampleCustomerBeneficiaryId > 0
15
+ end
16
+
17
+ def test_get
18
+ cb = CorePro::CustomerBeneficiary.get @@exampleCustomerId, @@exampleCustomerBeneficiaryId, @@exampleConn, nil
19
+ assert_instance_of CorePro::CustomerBeneficiary, cb
20
+ end
21
+
22
+ def test_list
23
+ cbs = CorePro::CustomerBeneficiary.list @@exampleCustomerId, @@exampleConn, nil
24
+ assert cbs.length > 0
25
+ end
26
+
27
+ def test_update
28
+ cb = CorePro::CustomerBeneficiary.new
29
+ cb.customerId = @@exampleCustomerId
30
+ cb.customerBeneficiaryId = @@exampleCustomerBeneficiaryId
31
+ cb.firstName = "Freddie #{@@timestamp}"
32
+ cbid = cb.update @@exampleConn, nil
33
+ assert_equal @@exampleCustomerBeneficiaryId, cbid
34
+ end
35
+
36
+ def test_zzz_deactivate
37
+ cb = CorePro::CustomerBeneficiary.new
38
+ cb.customerId = @@exampleCustomerId
39
+ cb.customerBeneficiaryId = @@exampleCustomerBeneficiaryId
40
+ cbid = cb.deactivate @@exampleConn, nil
41
+ assert_equal @@exampleCustomerBeneficiaryId, cbid
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/customer_document'
3
+
4
+ class AeCustomerDocumentTest < CoreProTestBase
5
+ def test_upload
6
+ cd = CorePro::CustomerDocument.new
7
+ cd.customerId = @@exampleCustomerId
8
+ cd.documentType = 'DriversLicense'
9
+ cd.reasonType = 'NameChange'
10
+ cd.documentName = 'test.pdf'
11
+ folder = File.expand_path(File.dirname(File.dirname(__FILE__)))
12
+ cd.documentContent = File.read(folder + '/test.pdf')
13
+ cd.upload @@exampleConn, nil
14
+ assert true
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/bank_document'
3
+ require_relative '../lib/corepro/models/file_content'
4
+
5
+ class AfBankDocumentTest < CoreProTestBase
6
+ def test_list
7
+ docs = CorePro::BankDocument.list 'en-US', nil, @@exampleConn, nil
8
+ doc = nil
9
+ docs.each do |x|
10
+ doc = x # if x.documentType == 'eStatement'
11
+ end
12
+ @@documentId = doc.documentId
13
+ assert_instance_of CorePro::BankDocument, doc
14
+ end
15
+
16
+ def test_zzz_download
17
+ doc = CorePro::BankDocument.download 'en-US', @@documentId, @@exampleConn, nil
18
+ assert_instance_of CorePro::Models::FileContent, doc
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/external_account_document'
3
+
4
+ class AgExternalAccountDocumentTest < CoreProTestBase
5
+ def test_upload
6
+ ead = CorePro::ExternalAccountDocument.new
7
+ ead.customerId = @@exampleCustomerId
8
+ ead.externalAccountId = @@exampleExternalAccountId
9
+ ead.documentType = 'DriversLicense'
10
+ ead.documentName = 'test.pdf'
11
+ ead.reasonType = 'NameChange'
12
+ folder = File.expand_path(File.dirname(File.dirname(__FILE__)))
13
+ ead.documentContent = File.read(folder + '/test.pdf')
14
+ ead.upload @@exampleConn, nil
15
+ assert true
16
+
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/statement'
3
+
4
+ class AiStatementTest # < CoreProTestBase
5
+
6
+ def test_download
7
+ assert false
8
+ end
9
+
10
+ def test_get
11
+ assert false
12
+ end
13
+
14
+ def test_list
15
+ assert false
16
+ end
17
+
18
+ def test_search
19
+ assert false
20
+ end
21
+
22
+
23
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/transfer'
3
+
4
+ class AjTransferTest < CoreProTestBase
5
+
6
+ def test_01_create_external_to_internal
7
+ t = CorePro::Transfer.new
8
+ t.customerId = @@exampleCustomerId
9
+ t.fromId = @@exampleExternalAccountId
10
+ t.toId = @@exampleAccountId
11
+ t.amount = 2.75
12
+ t.tag = "e_2_i #{@@timestamp}"
13
+ @@exampleExternalToInternalTransactionTag = t.tag
14
+ results = t.create @@exampleConn, nil
15
+ @@exampleExternalToInternalTransactionId = results[0].transactionId
16
+ puts "external to internal transactionid=#{@@exampleExternalToInternalTransactionId}"
17
+ assert @@exampleExternalToInternalTransactionId > 0
18
+ end
19
+
20
+ def test_02_create_programreserve_to_internal
21
+ t = CorePro::Transfer.new
22
+ t.customerId = @@exampleCustomerId
23
+ t.fromId = @@exampleProgramReserveAccountId
24
+ t.toId = @@exampleAccountId
25
+ t.amount = 1.25
26
+ t.tag = "pr_2_i #{@@timestamp}"
27
+ results = t.create @@exampleConn, nil
28
+ @@exampleProgramReserveToInternalTransactionId = results[0].transactionId
29
+ puts "program reserve to internal transactionid=#{@@exampleProgramReserveToInternalTransactionId}"
30
+ assert @@exampleProgramReserveToInternalTransactionId > 0
31
+ end
32
+
33
+ def test_03_create_internal_to_external
34
+ t = CorePro::Transfer.new
35
+ t.customerId = @@exampleCustomerId
36
+ t.fromId = @@exampleAccountId
37
+ t.toId = @@exampleExternalAccountId
38
+ t.amount = 1.20
39
+ t.tag = "i_2_e #{@@timestamp}"
40
+ results = t.create @@exampleConn, nil
41
+ @@exampleInternalToExternalTransactionId = results[0].transactionId
42
+ puts "internal to external transactionid=#{@@exampleInternalToExternalTransactionId}"
43
+ assert @@exampleInternalToExternalTransactionId > 0
44
+ end
45
+
46
+
47
+ # def test_void
48
+ # t = CorePro::Transfer.new
49
+ # t.customerId = @@prepaidCustomerId
50
+ # t.transactionId = @@prepaidExternalToInternalTransactionId
51
+ # t.void @@prepaidConn, nil
52
+ # end
53
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/transaction'
3
+
4
+ class AkTransactionTest < CoreProTestBase
5
+ def test_01_list
6
+ ts = CorePro::Transaction.list @@exampleCustomerId, @@exampleAccountId, nil, nil, nil, nil, nil, @@exampleConn, nil
7
+ assert ts.length > 0
8
+ end
9
+
10
+ def test_02_get
11
+ ts = CorePro::Transaction.get @@exampleCustomerId, @@exampleProgramReserveToInternalTransactionId, @@exampleConn, nil
12
+ assert ts.length > 0
13
+ end
14
+
15
+ def test_03_getByTag
16
+ ts = CorePro::Transaction.getByTag @@exampleCustomerId, @@exampleExternalToInternalTransactionTag, @@exampleConn, nil
17
+ assert ts.length > 0
18
+ end
19
+ end
@@ -0,0 +1,51 @@
1
+ require_relative '../test/core_pro_test_base'
2
+ require_relative '../lib/corepro/card'
3
+
4
+ require 'openssl'
5
+ require 'base64'
6
+
7
+ class AlCardTest < CoreProTestBase
8
+
9
+ def test_create
10
+ c = CorePro::Card.new
11
+ c.customerId = @@exampleCustomerId
12
+ c.primaryAccountId = @@exampleAccountId
13
+ c.tag = "card ruby #{@@timestamp}"
14
+ c.nickName = "Card #{@@timestamp}"
15
+ c.firstName = 'Frank'
16
+ c.lastName = 'Drummond'
17
+ c.vendorTypeCode = 'VS'
18
+
19
+ rawPin = '1234'
20
+ publicKey = OpenSSL::PKey::RSA.new(File.read('q2labs_public.pem'))
21
+ c.newPin = encrypted_string = Base64.encode64(publicKey.public_encrypt(rawPin, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING))
22
+ puts "#{rawPin}, #{c.newPin}"
23
+ newCard = c.initiate @@exampleConn, nil
24
+ @@exampleCardId = newCard.cardId
25
+ puts "cardId=#{@@exampleCardId}"
26
+ assert @@exampleCardId > 0
27
+
28
+ end
29
+
30
+ def test_list
31
+ accounts = CorePro::Account.list(@@exampleCustomerId, @@exampleConn, nil)
32
+ assert_equal 1, accounts.length, "Listed #{accounts.length} accounts for customerId=#{@@exampleCustomerId}"
33
+ end
34
+
35
+ def test_get
36
+ puts "getting #{@@exampleAccountId}..."
37
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
38
+ assert_equal 'CategoryB', a.subCategory
39
+ end
40
+
41
+ def test_update
42
+ a = CorePro::Account.get(@@exampleCustomerId, @@exampleAccountId, @@exampleConn, nil)
43
+ a = CorePro::Account.new
44
+ a.accountId = @@exampleAccountId
45
+ a.customerId = @@exampleCustomerId
46
+ a.name = "Updated account #{@@timestamp}"
47
+ accountId = a.update @@exampleConn, nil
48
+ assert accountId == @@exampleAccountId
49
+ end
50
+
51
+ end
@@ -0,0 +1,30 @@
1
+ require "test/unit"
2
+ require_relative "../lib/corepro/connection"
3
+ require_relative "../lib/corepro/core_pro_api_exception"
4
+
5
+ class CoreProTestBase < Test::Unit::TestCase
6
+
7
+ # common properties for tests
8
+ @@timestamp = Time.now.to_s
9
+
10
+ @@documentId = nil
11
+
12
+ @@exampleConn = CorePro::Connection.new 'example1', 'example1', 'sandbox-api.corepro.io' #, '127.0.0.1', '8888'
13
+
14
+ @@exampleProgramReserveAccountId = nil
15
+
16
+ @@exampleCustomerId = nil
17
+
18
+ @@exampleAccountId = nil
19
+
20
+ @@exampleExternalAccountId = nil
21
+
22
+ @@exampleCardId = nil
23
+
24
+ @@exampleExternalToInternalTransactionId = nil
25
+
26
+ @@exampleExternalToInternalTransactionTag = nil
27
+
28
+ @@exampleProgramReserveToInternalTransactionId = nil
29
+
30
+ end