corepro 0.0.5 → 0.0.6
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 +8 -8
- data/.idea/corepro-sdk-ruby.iml +28 -0
- data/lib/corepro.rb +1 -1
- data/lib/corepro/bank_document.rb +44 -0
- data/lib/corepro/connection.rb +13 -5
- data/lib/corepro/core_pro_api_exception.rb +6 -1
- data/lib/corepro/customer_beneficiary.rb +7 -4
- data/lib/corepro/customer_document.rb +3 -2
- data/lib/corepro/external_account_document.rb +1 -1
- data/lib/corepro/models/customer_beneficiary_id_only.rb +8 -0
- data/lib/corepro/models/model_base.rb +5 -1
- data/lib/corepro/transaction.rb +7 -1
- data/lib/corepro/transfer.rb +1 -1
- data/lib/corepro/utils/requestor.rb +12 -1
- data/lib/corepro/version.rb +1 -1
- data/test.pdf +0 -0
- data/test/aa_customer_nacha_test.rb +60 -2
- data/test/ab_account_nacha_test.rb +46 -0
- data/test/ab_account_prepaid_test.rb +4 -0
- data/test/ad_customer_beneficiary_test.rb +43 -0
- data/test/ae_customer_document_test.rb +16 -0
- data/test/af_bankdocument_test.rb +20 -0
- data/test/ag_external_account_document_test.rb +18 -0
- data/test/ah_program_test.rb +9 -0
- data/test/ai_statement_test.rb +23 -0
- data/test/aj_transfer_nacha_test.rb +6 -0
- data/test/aj_transfer_prepaid_test.rb +34 -0
- data/test/ak_transaction_test.rb +9 -0
- data/test/core_pro_test_base.rb +25 -3
- metadata +25 -3
- data/lib/corepro/document.rb +0 -23
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzFkZjk4Mzk2YmI1N2JlN2U0OWI3ODg1YjUzNTIzNjk4YTRmNTk4Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWYzMmNkZTM0YWY4ZTJkYTBmMGVhOGQwYzFhNGVjNzZmYjEzMWY4Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODRlNzZlMzE5NWY3ZmRmZjM4ZGQ0Y2NiYTAwYTI4Y2M4NGMwMGEzYzY5NjZk
|
10
|
+
MWVmMzM0ODI2OWJjZjY4NjM4MjVjOWU5OTVhN2I4OWY5MmQ0YmY2Yzc5MjYw
|
11
|
+
NDZhNTU2YmU3NDQxNGM0YTQ0YTUyYWNhYjYyMTZjMTUxMDhlMTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2VlZjQ2MGJmY2UzZmU5NDIwMjA3ODc0ODhhNjBiNmJlOWNmYjAzZDRiMWQw
|
14
|
+
M2E5MDM2MmI2ZTJkZTM4ZmFlYmI1ZGI0N2NlODkzYmY3MWJhNmE0YjhjNjA5
|
15
|
+
MTM3ZmY3OTZmMWRmZTJlYmRiYjdkNmE3ZTJkYjU5ZjMwMmZiOGQ=
|
data/.idea/corepro-sdk-ruby.iml
CHANGED
@@ -45,6 +45,34 @@
|
|
45
45
|
<ConfigurationWrapper RunnerId="RubyRunner" />
|
46
46
|
<method />
|
47
47
|
</configuration>
|
48
|
+
<configuration default="false" name="Run test 'ad_customer_beneficiary_test': corepro-sdk-ruby" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest" temporary="true">
|
49
|
+
<predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
|
50
|
+
<module name="corepro-sdk-ruby" />
|
51
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
52
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$/test" />
|
53
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
54
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
55
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
56
|
+
<envs>
|
57
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
58
|
+
</envs>
|
59
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
60
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
61
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov" />
|
62
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
63
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
64
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/test/ad_customer_beneficiary_test.rb" />
|
65
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
66
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
|
67
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
68
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
69
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
70
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
71
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
72
|
+
<RunnerSettings RunnerId="RubyRunner" />
|
73
|
+
<ConfigurationWrapper RunnerId="RubyRunner" />
|
74
|
+
<method />
|
75
|
+
</configuration>
|
48
76
|
</component>
|
49
77
|
<component name="NewModuleRootManager">
|
50
78
|
<content url="file://$MODULE_DIR$">
|
data/lib/corepro.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'corepro/core_pro_api_exception'
|
|
5
5
|
require_relative 'corepro/customer'
|
6
6
|
require_relative 'corepro/customer_beneficiary'
|
7
7
|
require_relative 'corepro/customer_document'
|
8
|
-
require_relative 'corepro/
|
8
|
+
require_relative 'corepro/bank_document'
|
9
9
|
require_relative 'corepro/external_account'
|
10
10
|
require_relative 'corepro/external_account_document'
|
11
11
|
require_relative 'corepro/program'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
require_relative 'models/file_content'
|
4
|
+
|
5
|
+
module CorePro
|
6
|
+
class BankDocument < Models::ModelBase
|
7
|
+
|
8
|
+
attr_accessor :bankId
|
9
|
+
attr_accessor :customerId
|
10
|
+
attr_accessor :documentId
|
11
|
+
attr_accessor :documentType
|
12
|
+
attr_accessor :culture
|
13
|
+
attr_accessor :html
|
14
|
+
attr_accessor :title
|
15
|
+
attr_accessor :downloadUrl
|
16
|
+
attr_accessor :effectiveDate
|
17
|
+
attr_accessor :expireDate
|
18
|
+
|
19
|
+
def self.list(culture, documentType = nil, connection = nil, loggingObject = nil)
|
20
|
+
d = BankDocument.new
|
21
|
+
d.culture = culture
|
22
|
+
d.documentType = documentType
|
23
|
+
d.list connection, loggingObject
|
24
|
+
end
|
25
|
+
|
26
|
+
def list(connection = nil, loggingObject = nil)
|
27
|
+
connection ||= Connection.createFromConfig()
|
28
|
+
CorePro::Utils::Requestor.get("/bankdocument/list/#{escape(self.culture)}/#{escape(self.documentType)}", BankDocument, connection, loggingObject)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.download(culture, documentId, connection = nil, loggingObject = nil)
|
32
|
+
d = BankDocument.new
|
33
|
+
d.culture = culture
|
34
|
+
d.documentId = documentId
|
35
|
+
d.download connection, loggingObject
|
36
|
+
end
|
37
|
+
|
38
|
+
def download(connection = nil, loggingObject = nil)
|
39
|
+
connection ||= Connection.createFromConfig()
|
40
|
+
CorePro::Utils::Requestor.get("/bankdocument/download/#{escape(self.culture)}/#{self.documentId}", CorePro::Models::FileContent, connection, loggingObject)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
data/lib/corepro/connection.rb
CHANGED
@@ -5,7 +5,11 @@ module CorePro
|
|
5
5
|
class Connection
|
6
6
|
|
7
7
|
@@config = begin
|
8
|
-
|
8
|
+
if File.exists?('config.yml')
|
9
|
+
YAML.load(File.open('config.yml'))
|
10
|
+
else
|
11
|
+
{}
|
12
|
+
end
|
9
13
|
rescue ArgumentError => e
|
10
14
|
puts "Could not parse YAML: #{e.message}"
|
11
15
|
end
|
@@ -57,11 +61,15 @@ module CorePro
|
|
57
61
|
end
|
58
62
|
|
59
63
|
def domainName=(value)
|
60
|
-
value
|
61
|
-
|
62
|
-
|
64
|
+
if value == nil
|
65
|
+
@domainName = nil
|
66
|
+
else
|
67
|
+
value.gsub! 'https://', ''
|
68
|
+
value.gsub! 'http://', ''
|
69
|
+
value.gsub! 'www.', ''
|
63
70
|
|
64
|
-
|
71
|
+
@domainName = value.split('/')[0]
|
72
|
+
end
|
65
73
|
end
|
66
74
|
|
67
75
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'models/model_base'
|
2
|
+
require_relative 'models/customer_beneficiary_id_only'
|
2
3
|
|
3
4
|
module CorePro
|
4
5
|
class CustomerBeneficiary < Models::ModelBase
|
@@ -37,18 +38,20 @@ module CorePro
|
|
37
38
|
|
38
39
|
def create(connection = nil, loggingObject = nil)
|
39
40
|
connection ||= Connection.createFromConfig()
|
40
|
-
CorePro::Utils::Requestor.post('/customerbeneficiary/create',
|
41
|
+
cbid = CorePro::Utils::Requestor.post('/customerbeneficiary/create', CorePro::Models::CustomerBeneficiaryIdOnly, self, connection, loggingObject)
|
42
|
+
cbid.customerBeneficiaryId
|
41
43
|
end
|
42
44
|
|
43
45
|
def update(connection = nil, loggingObject = nil)
|
44
46
|
connection ||= Connection.createFromConfig()
|
45
|
-
CorePro::Utils::Requestor.post('/customerbeneficiary/update',
|
47
|
+
cbid = CorePro::Utils::Requestor.post('/customerbeneficiary/update', CorePro::Models::CustomerBeneficiaryIdOnly, self, connection, loggingObject)
|
48
|
+
cbid.customerBeneficiaryId
|
46
49
|
end
|
47
50
|
|
48
51
|
def deactivate(connection = nil, loggingObject = nil)
|
49
52
|
connection ||= Connection.createFromConfig()
|
50
|
-
CorePro::Utils::Requestor.post('/customerbeneficiary/deactivate',
|
51
|
-
|
53
|
+
cbid = CorePro::Utils::Requestor.post('/customerbeneficiary/deactivate', CorePro::Models::CustomerBeneficiaryIdOnly, self, connection, loggingObject)
|
54
|
+
cbid.customerBeneficiaryId
|
52
55
|
end
|
53
56
|
|
54
57
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative 'models/
|
1
|
+
require_relative 'models/model_base'
|
2
2
|
require_relative 'utils/requestor'
|
3
3
|
require 'base64'
|
4
4
|
|
@@ -24,7 +24,8 @@ module CorePro
|
|
24
24
|
def upload(connection = nil, loggingObject = nil)
|
25
25
|
# NOTE: documentContent is assumed to be raw content bytes.
|
26
26
|
# corepro API expects base64 encoded string. so we convert that here.
|
27
|
-
|
27
|
+
bytes = Base64.encode64(self.documentContent)
|
28
|
+
self.documentContent = bytes
|
28
29
|
|
29
30
|
connection ||= Connection.createFromConfig()
|
30
31
|
CorePro::Utils::Requestor.post('/customerdocument/upload', nil, self, connection, loggingObject)
|
@@ -26,7 +26,7 @@ module CorePro
|
|
26
26
|
def upload(connection = nil, loggingObject = nil)
|
27
27
|
# NOTE: documentContent is assumed to be raw content bytes.
|
28
28
|
# corepro API expects base64 encoded string. so we convert that here.
|
29
|
-
documentContent = Base64.encode64(documentContent)
|
29
|
+
self.documentContent = Base64.encode64(self.documentContent)
|
30
30
|
|
31
31
|
connection ||= Connection.createFromConfig()
|
32
32
|
CorePro::Utils::Requestor.post('/externalaccountdocument/upload', nil, self, connection, loggingObject)
|
data/lib/corepro/transaction.rb
CHANGED
@@ -21,6 +21,12 @@ module CorePro
|
|
21
21
|
attr_accessor :isCredit
|
22
22
|
|
23
23
|
def self.list(customerId, accountId, status = nil, beginDate = nil, endDate = nil, pageNumber = 0, pageSize = 200, connection = nil, loggingObject = nil)
|
24
|
+
t = Transaction.new
|
25
|
+
t.customerId = customerId
|
26
|
+
t.list accountId, status, beginDate, endDate, pageNumber, pageSize, connection, loggingObject
|
27
|
+
end
|
28
|
+
|
29
|
+
def list(accountId = nil, status = nil, beginDate = nil, endDate =nil, pageNumber =0, pageSize = 200, connection = nil, loggingObject = nil)
|
24
30
|
connection ||= Connection.createFromConfig()
|
25
31
|
start = beginDate.kind_of?(Date) ? beginDate.strftime('%Y-%m-%d') : (beginDate.kind_of?(String) ? beginDate[0..9] : nil)
|
26
32
|
finish = endDate.kind_of?(Date) ? endDate.strftime('%Y-%m-%d') : (endDate.kind_of?(String) ? endDate[0..9] : nil)
|
@@ -32,7 +38,7 @@ module CorePro
|
|
32
38
|
start = '1900-01-01'
|
33
39
|
end
|
34
40
|
|
35
|
-
CorePro::Utils::Requestor.get("/transaction/list/#{customerId}/#{accountId}/#{escape(status)}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
|
41
|
+
CorePro::Utils::Requestor.get("/transaction/list/#{self.customerId}/#{accountId}/#{escape(status)}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
|
36
42
|
end
|
37
43
|
|
38
44
|
|
data/lib/corepro/transfer.rb
CHANGED
@@ -16,13 +16,20 @@ module CorePro
|
|
16
16
|
SDK_USER_AGENT = "CorePro Ruby SDK v #{CorePro::VERSION}"
|
17
17
|
|
18
18
|
@@config = begin
|
19
|
-
|
19
|
+
if File.exists?('config.yml')
|
20
|
+
YAML.load(File.open('config.yml'))
|
21
|
+
else
|
22
|
+
{}
|
23
|
+
end
|
20
24
|
rescue ArgumentError => e
|
21
25
|
puts "Could not parse YAML: #{e.message}"
|
22
26
|
end
|
23
27
|
|
24
28
|
|
25
29
|
def self.get(relativeUrl, classDef, connection, loggingObject)
|
30
|
+
if connection.headerValue.to_s.empty? || connection.domainName.to_s.empty?
|
31
|
+
raise ArgumentError, 'A valid connection with apiKey, apiSecret, and domainName must be specified.'
|
32
|
+
end
|
26
33
|
uri = URI.parse("https://#{connection.domainName}#{relativeUrl}")
|
27
34
|
if @@config['CoreProProxyServer'] != nil && @@config['CoreProProxyPort'] != nil
|
28
35
|
proxy = Net::HTTP::Proxy(@@config['CoreProProxyServer'], @@config['CoreProProxyPort'])
|
@@ -47,6 +54,10 @@ module CorePro
|
|
47
54
|
end
|
48
55
|
|
49
56
|
def self.post(relativeUrl, classDef, toPost, connection, loggingObject)
|
57
|
+
if connection.headerValue.to_s.empty? || connection.domainName.to_s.empty?
|
58
|
+
raise ArgumentError, 'A valid connection with apiKey, apiSecret, and domainName must be specified.'
|
59
|
+
end
|
60
|
+
|
50
61
|
uri = URI.parse("https://#{connection.domainName}#{relativeUrl}")
|
51
62
|
if @@config['CoreProProxyServer'] != nil && @@config['CoreProProxyPort'] != nil
|
52
63
|
proxy = Net::HTTP::Proxy(@@config['CoreProProxyServer'], @@config['CoreProProxyPort'])
|
data/lib/corepro/version.rb
CHANGED
data/test.pdf
ADDED
Binary file
|
@@ -1,5 +1,63 @@
|
|
1
1
|
require_relative '../test/core_pro_test_base'
|
2
|
-
require_relative
|
2
|
+
require_relative '../lib/corepro/customer'
|
3
|
+
require_relative '../lib/corepro/models/customer_response'
|
4
|
+
|
5
|
+
class AaCustomerNachaTest # < CoreProTestBase
|
6
|
+
|
7
|
+
def test_aaa_initiate
|
8
|
+
c = CorePro::Customer.new
|
9
|
+
c.birthDate = '01/01/1985'
|
10
|
+
c.culture = 'en-US'
|
11
|
+
c.firstName = 'Joey'
|
12
|
+
c.middleName = 'Flanagan'
|
13
|
+
c.lastName = "McTester#{@@timestamp}"
|
14
|
+
c.gender = 'M'
|
15
|
+
c.isDocumentsAccepted = true
|
16
|
+
c.isSubjectToBackupWithholding = false
|
17
|
+
c.isOptedInToBankCommunication = false
|
18
|
+
c.tag = "jfm#{@@timestamp}"
|
19
|
+
c.taxId = '012341234'
|
20
|
+
|
21
|
+
@@nachaCustomerInitiateResponse = c.initiate(@@nachaConn, nil)
|
22
|
+
@@nachaCustomerId = @@nachaCustomerInitiateResponse.customerId
|
23
|
+
|
24
|
+
assert @@nachaCustomerId > 0
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_aaa_verify
|
28
|
+
c = CorePro::Customer.new
|
29
|
+
c.customerId = @@nachaCustomerId
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_get
|
34
|
+
c = CorePro::Customer.get @@nachaCustomerId, @@nachaConn, nil
|
35
|
+
assert c != nil, "Could not 'get' customerId #{@@nachaCustomerId}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_getByTag
|
39
|
+
c = CorePro::Customer.getByTag "jfm#{@@timestamp}", @@nachaConn, nil
|
40
|
+
assert c != nil, "Could not 'getByTag' tag 'jfm#{@@timestamp}'"
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_list
|
44
|
+
cs = CorePro::Customer.list 0, 15, @@nachaConn, nil
|
45
|
+
assert cs != nil && cs.length > 0, "Could not list customers"
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_search
|
49
|
+
c = CorePro::Customer.new
|
50
|
+
c.lastName = "McTester#{@@timestamp}"
|
51
|
+
cs = c.search nil, nil, @@nachaConn, nil
|
52
|
+
assert cs != nil && cs.length > 0, "Could not search 'McTester#{@@timestamp}'"
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_update
|
56
|
+
c = CorePro::Customer.new
|
57
|
+
c.customerId = @@nachaCustomerId
|
58
|
+
c.firstName = "Joey#{@@timestamp}"
|
59
|
+
customerId = c.update @@nachaConn, nil
|
60
|
+
assert customerId > 0
|
61
|
+
end
|
3
62
|
|
4
|
-
class AaCustomerNachaTest < CoreProTestBase
|
5
63
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative '../test/core_pro_test_base'
|
2
|
+
require_relative '../lib/corepro/account'
|
3
|
+
|
4
|
+
class AbAccountNachaTest #< CoreProTestBase
|
5
|
+
|
6
|
+
def test_create
|
7
|
+
a = CorePro::Account.new
|
8
|
+
a.customerId = @@nachaCustomerId
|
9
|
+
a.tag = "act#{@@timestamp}"
|
10
|
+
a.type = 'Client'
|
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
|
+
@@nachaAccountId = a.create @@nachaConn, nil
|
18
|
+
|
19
|
+
assert @@nachaAccountId > 0
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_list
|
24
|
+
accounts = CorePro::Account.list(@@nachaCustomerId, @@nachaConn, nil)
|
25
|
+
assert_equal 1, accounts.length, "Listed #{accounts.length} accounts for customerId=#{@@nachaCustomerId}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_get
|
29
|
+
a = CorePro::Account.get(@@nachaCustomerId, @@nachaAccountId, @@nachaConn, nil)
|
30
|
+
assert_not_empty a.accountNumber
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_update
|
34
|
+
a = CorePro::Account.get(@@nachaCustomerId, @@nachaAccountId, @@nachaConn, nil)
|
35
|
+
a = CorePro::Account.new
|
36
|
+
a.accountId = @@nachaAccountId
|
37
|
+
a.customerId = @@nachaCustomerId
|
38
|
+
a.name = "Updated account #{@@timestamp}"
|
39
|
+
accountId = a.update @@nachaConn, nil
|
40
|
+
assert accountId == @@nachaAccountId
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_zzz_close
|
44
|
+
|
45
|
+
end
|
46
|
+
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 = @@prepaidCustomerId
|
9
|
+
cb.firstName = 'Freddie'
|
10
|
+
cb.lastName = "Mercury #{@@timestamp}"
|
11
|
+
cb.birthDate = '1969-05-05T00:00:00.000+00:00'
|
12
|
+
cb.taxId = '123412349'
|
13
|
+
@@prepaidCustomerBeneficiaryId = cb.create @@prepaidConn, nil
|
14
|
+
assert @@prepaidCustomerBeneficiaryId > 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get
|
18
|
+
cb = CorePro::CustomerBeneficiary.get @@prepaidCustomerId, @@prepaidCustomerBeneficiaryId, @@prepaidConn, nil
|
19
|
+
assert_instance_of CorePro::CustomerBeneficiary, cb
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_list
|
23
|
+
cbs = CorePro::CustomerBeneficiary.list @@prepaidCustomerId, @@prepaidConn, nil
|
24
|
+
assert cbs.length > 0
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_update
|
28
|
+
cb = CorePro::CustomerBeneficiary.new
|
29
|
+
cb.customerId = @@prepaidCustomerId
|
30
|
+
cb.customerBeneficiaryId = @@prepaidCustomerBeneficiaryId
|
31
|
+
cb.firstName = "Freddie #{@@timestamp}"
|
32
|
+
cbid = cb.update @@prepaidConn, nil
|
33
|
+
assert_equal @@prepaidCustomerBeneficiaryId, cbid
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_zzz_deactivate
|
37
|
+
cb = CorePro::CustomerBeneficiary.new
|
38
|
+
cb.customerId = @@prepaidCustomerId
|
39
|
+
cb.customerBeneficiaryId = @@prepaidCustomerBeneficiaryId
|
40
|
+
cbid = cb.deactivate @@prepaidConn, nil
|
41
|
+
assert_equal @@prepaidCustomerBeneficiaryId, 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 = @@prepaidCustomerId
|
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 @@prepaidConn, 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, @@prepaidConn, 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, @@prepaidConn, 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 = @@prepaidCustomerId
|
8
|
+
ead.externalAccountId = @@prepaidExternalAccountId
|
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 @@prepaidConn, 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,34 @@
|
|
1
|
+
require_relative '../test/core_pro_test_base'
|
2
|
+
require_relative '../lib/corepro/transfer'
|
3
|
+
|
4
|
+
class AjTransferPrepaidTest < CoreProTestBase
|
5
|
+
|
6
|
+
def test_create_external_to_internal
|
7
|
+
t = CorePro::Transfer.new
|
8
|
+
t.customerId = @@prepaidCustomerId
|
9
|
+
t.fromId = @@prepaidExternalAccountId
|
10
|
+
t.toId = @@prepaidAccountId
|
11
|
+
t.amount = 1.25
|
12
|
+
results = t.create @@prepaidConn, nil
|
13
|
+
@@prepaidExternalToInternalTransactionId = results[0].transactionId
|
14
|
+
assert @@prepaidExternalToInternalTransactionId > 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_create_internal_to_external
|
18
|
+
t = CorePro::Transfer.new
|
19
|
+
t.customerId = @@prepaidCustomerId
|
20
|
+
t.fromId = @@prepaidAccountId
|
21
|
+
t.toId = @@prepaidExternalAccountId
|
22
|
+
t.amount = 1.20
|
23
|
+
results = t.create @@prepaidConn, nil
|
24
|
+
@@prepaidInternalToExternalTransactionId = results[0].transactionId
|
25
|
+
assert @@prepaidInternalToExternalTransactionId > 0
|
26
|
+
end
|
27
|
+
|
28
|
+
# def test_void
|
29
|
+
# t = CorePro::Transfer.new
|
30
|
+
# t.customerId = @@prepaidCustomerId
|
31
|
+
# t.transactionId = @@prepaidExternalToInternalTransactionId
|
32
|
+
# t.void @@prepaidConn, nil
|
33
|
+
# end
|
34
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require_relative '../test/core_pro_test_base'
|
2
|
+
require_relative '../lib/corepro/transaction'
|
3
|
+
|
4
|
+
class AkTransactionTest < CoreProTestBase
|
5
|
+
def test_list
|
6
|
+
ts = CorePro::Transaction.list @@prepaidCustomerId, @@prepaidAccountId, nil, nil, nil, nil, nil, @@prepaidConn, nil
|
7
|
+
assert ts.length > 0
|
8
|
+
end
|
9
|
+
end
|
data/test/core_pro_test_base.rb
CHANGED
@@ -4,12 +4,16 @@ require_relative "../lib/corepro/core_pro_api_exception"
|
|
4
4
|
|
5
5
|
class CoreProTestBase < Test::Unit::TestCase
|
6
6
|
|
7
|
+
# common properties between prepaid and nacha
|
8
|
+
@@timestamp = Time.now.to_s
|
9
|
+
|
10
|
+
@@documentId = nil
|
11
|
+
|
12
|
+
|
13
|
+
# prepaid-specific program
|
7
14
|
# tests the config.yml lookup. should always return coreproprepaid credentials and server.
|
8
15
|
@@prepaidConn = CorePro::Connection.createFromConfig()
|
9
16
|
|
10
|
-
@@nachaConn = CorePro::Connection.new 'corepronacha', 'corepronacha', 'sandbox-api.corepro.io'
|
11
|
-
|
12
|
-
@@timestamp = Time.now.to_s
|
13
17
|
|
14
18
|
@@prepaidCustomerId = nil
|
15
19
|
|
@@ -17,4 +21,22 @@ class CoreProTestBase < Test::Unit::TestCase
|
|
17
21
|
|
18
22
|
@@prepaidExternalAccountId = nil
|
19
23
|
|
24
|
+
@@prepaidCustomerBeneficiaryId = nil
|
25
|
+
|
26
|
+
@@prepaidInternalToExternalTransactionId = nil
|
27
|
+
|
28
|
+
@@prepaidExternalToInternalTransactionId = nil
|
29
|
+
|
30
|
+
|
31
|
+
# nacha-specific program
|
32
|
+
|
33
|
+
@@nachaConn = CorePro::Connection.new 'corepronacha', 'corepronacha', 'sandbox-api.corepro.io'
|
34
|
+
|
35
|
+
@@nachaCustomerId = nil
|
36
|
+
|
37
|
+
@@nachaAccountId = nil
|
38
|
+
|
39
|
+
@@nachaExternalAccountId = nil
|
40
|
+
|
41
|
+
@@nachaExternalToInternalTransactionId = nil
|
20
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corepro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- devsupport
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,18 +64,19 @@ files:
|
|
64
64
|
- lib/corepro.rb
|
65
65
|
- lib/corepro/account.rb
|
66
66
|
- lib/corepro/account_close.rb
|
67
|
+
- lib/corepro/bank_document.rb
|
67
68
|
- lib/corepro/connection.rb
|
68
69
|
- lib/corepro/core_pro_api_exception.rb
|
69
70
|
- lib/corepro/customer.rb
|
70
71
|
- lib/corepro/customer_beneficiary.rb
|
71
72
|
- lib/corepro/customer_document.rb
|
72
|
-
- lib/corepro/document.rb
|
73
73
|
- lib/corepro/external_account.rb
|
74
74
|
- lib/corepro/external_account_document.rb
|
75
75
|
- lib/corepro/models/account_id_only.rb
|
76
76
|
- lib/corepro/models/api_error.rb
|
77
77
|
- lib/corepro/models/customer_address.rb
|
78
78
|
- lib/corepro/models/customer_answer.rb
|
79
|
+
- lib/corepro/models/customer_beneficiary_id_only.rb
|
79
80
|
- lib/corepro/models/customer_id_only.rb
|
80
81
|
- lib/corepro/models/customer_message.rb
|
81
82
|
- lib/corepro/models/customer_phone.rb
|
@@ -97,11 +98,22 @@ files:
|
|
97
98
|
- lib/corepro/utils/logger.rb
|
98
99
|
- lib/corepro/utils/requestor.rb
|
99
100
|
- lib/corepro/version.rb
|
101
|
+
- test.pdf
|
100
102
|
- test/aa_customer_nacha_test.rb
|
101
103
|
- test/aa_customer_prepaid_test.rb
|
104
|
+
- test/ab_account_nacha_test.rb
|
102
105
|
- test/ab_account_prepaid_test.rb
|
103
106
|
- test/ac_external_account_nacha_test.rb
|
104
107
|
- test/ac_external_account_prepaid_test.rb
|
108
|
+
- test/ad_customer_beneficiary_test.rb
|
109
|
+
- test/ae_customer_document_test.rb
|
110
|
+
- test/af_bankdocument_test.rb
|
111
|
+
- test/ag_external_account_document_test.rb
|
112
|
+
- test/ah_program_test.rb
|
113
|
+
- test/ai_statement_test.rb
|
114
|
+
- test/aj_transfer_nacha_test.rb
|
115
|
+
- test/aj_transfer_prepaid_test.rb
|
116
|
+
- test/ak_transaction_test.rb
|
105
117
|
- test/core_pro_test_base.rb
|
106
118
|
homepage: https://github.com/socialmoney/corepro-sdk-ruby
|
107
119
|
licenses:
|
@@ -130,7 +142,17 @@ summary: A Ruby SDK for consuming the corepro API.
|
|
130
142
|
test_files:
|
131
143
|
- test/aa_customer_nacha_test.rb
|
132
144
|
- test/aa_customer_prepaid_test.rb
|
145
|
+
- test/ab_account_nacha_test.rb
|
133
146
|
- test/ab_account_prepaid_test.rb
|
134
147
|
- test/ac_external_account_nacha_test.rb
|
135
148
|
- test/ac_external_account_prepaid_test.rb
|
149
|
+
- test/ad_customer_beneficiary_test.rb
|
150
|
+
- test/ae_customer_document_test.rb
|
151
|
+
- test/af_bankdocument_test.rb
|
152
|
+
- test/ag_external_account_document_test.rb
|
153
|
+
- test/ah_program_test.rb
|
154
|
+
- test/ai_statement_test.rb
|
155
|
+
- test/aj_transfer_nacha_test.rb
|
156
|
+
- test/aj_transfer_prepaid_test.rb
|
157
|
+
- test/ak_transaction_test.rb
|
136
158
|
- test/core_pro_test_base.rb
|
data/lib/corepro/document.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative 'models/model_base'
|
2
|
-
require_relative 'utils/requestor'
|
3
|
-
module CorePro
|
4
|
-
class Document < Models::ModelBase
|
5
|
-
|
6
|
-
attr_accessor :bankId
|
7
|
-
attr_accessor :customerId
|
8
|
-
attr_accessor :documentId
|
9
|
-
attr_accessor :documentType
|
10
|
-
attr_accessor :culture
|
11
|
-
attr_accessor :html
|
12
|
-
attr_accessor :title
|
13
|
-
attr_accessor :downloadUrl
|
14
|
-
attr_accessor :effectiveDate
|
15
|
-
attr_accessor :expireDate
|
16
|
-
|
17
|
-
def self.list(cultureName, documentType = nil, connection = nil, loggingObject = nil)
|
18
|
-
connection ||= Connection.createFromConfig()
|
19
|
-
CorePro::Utils::Requestor.get("/document/list/#{escape(cultureName)}/#{escape(documentType)}", Document, connection, loggingObject)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|