corepro 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/corepro-sdk-ruby.iml +67 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/CorePro.gemspec +23 -0
- data/Gemfile +15 -0
- data/LICENSE +21 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/config-sample.yml +3 -0
- data/lib/CorePro/Models/account_id_only.rb +8 -0
- data/lib/CorePro/Models/api_error.rb +14 -0
- data/lib/CorePro/Models/customer_address.rb +17 -0
- data/lib/CorePro/Models/customer_answer.rb +9 -0
- data/lib/CorePro/Models/customer_id_only.rb +8 -0
- data/lib/CorePro/Models/customer_message.rb +10 -0
- data/lib/CorePro/Models/customer_phone.rb +11 -0
- data/lib/CorePro/Models/customer_question.rb +21 -0
- data/lib/CorePro/Models/customer_response.rb +27 -0
- data/lib/CorePro/Models/customer_verify_request.rb +29 -0
- data/lib/CorePro/Models/envelope.rb +37 -0
- data/lib/CorePro/Models/external_account_id_only.rb +8 -0
- data/lib/CorePro/Models/external_account_verify.rb +13 -0
- data/lib/CorePro/Models/file_content.rb +10 -0
- data/lib/CorePro/Models/json_base.rb +81 -0
- data/lib/CorePro/Models/model_base.rb +16 -0
- data/lib/CorePro/Models/program_interest_rate.rb +13 -0
- data/lib/CorePro/Models/program_limit.rb +12 -0
- data/lib/CorePro/Utils/logger.rb +9 -0
- data/lib/CorePro/Utils/requestor.rb +89 -0
- data/lib/CorePro/account.rb +74 -0
- data/lib/CorePro/account_close.rb +22 -0
- data/lib/CorePro/connection.rb +68 -0
- data/lib/CorePro/core_pro_api_exception.rb +21 -0
- data/lib/CorePro/customer.rb +150 -0
- data/lib/CorePro/customer_beneficiary.rb +55 -0
- data/lib/CorePro/customer_document.rb +34 -0
- data/lib/CorePro/document.rb +23 -0
- data/lib/CorePro/external_account.rb +86 -0
- data/lib/CorePro/external_account_document.rb +36 -0
- data/lib/CorePro/program.rb +58 -0
- data/lib/CorePro/statement.rb +28 -0
- data/lib/CorePro/transaction.rb +40 -0
- data/lib/CorePro/transfer.rb +42 -0
- data/lib/CorePro/version.rb +4 -0
- data/lib/CorePro.rb +14 -0
- data/test/account_test.rb +37 -0
- data/test/core_pro_test_base.rb +10 -0
- data/test/customer_test.rb +46 -0
- metadata +135 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
require_relative 'models/program_interest_rate'
|
4
|
+
require_relative 'models/program_limit'
|
5
|
+
|
6
|
+
module CorePro
|
7
|
+
class Program < Models::ModelBase
|
8
|
+
|
9
|
+
attr_accessor :name
|
10
|
+
attr_accessor :verificationType
|
11
|
+
attr_accessor :timeZone
|
12
|
+
attr_accessor :regDFeeAmount
|
13
|
+
attr_accessor :regDMonthlyTransactionWithdrawCountMax
|
14
|
+
attr_accessor :perTransactionWithdrawLimit
|
15
|
+
attr_accessor :perUserDailyWithdrawLimit
|
16
|
+
attr_accessor :perUserMonthlyWithdrawLimit
|
17
|
+
attr_accessor :perProgramDailyWithdrawLimit
|
18
|
+
attr_accessor :perTransactionDepositLimit
|
19
|
+
attr_accessor :perUserDailyDepositLimit
|
20
|
+
attr_accessor :perUserMonthlyDepositLimit
|
21
|
+
attr_accessor :perProgramDailyDepositLimit
|
22
|
+
attr_accessor :website
|
23
|
+
attr_accessor :isInternalToInternalTransferEnabled
|
24
|
+
attr_accessor :decimalCount
|
25
|
+
attr_accessor :isInterestEnabled
|
26
|
+
attr_accessor :allowedAccountType
|
27
|
+
attr_accessor :isRecurringContributionEnabled
|
28
|
+
attr_accessor :interestRates
|
29
|
+
attr_accessor :filledDate
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
super
|
33
|
+
@interestRates = []
|
34
|
+
end
|
35
|
+
|
36
|
+
def from_json! json, classDefs
|
37
|
+
classDefs = classDefs || {}
|
38
|
+
classDefs['interestRates'] = CorePro::Models::ProgramInterestRate
|
39
|
+
classDefs['perTransactionWithdrawLimit'] = CorePro::Models::ProgramLimit
|
40
|
+
classDefs['perUserDailyWithdrawLimit'] = CorePro::Models::ProgramLimit
|
41
|
+
classDefs['perUserMonthlyWithdrawLimit'] = CorePro::Models::ProgramLimit
|
42
|
+
classDefs['perProgramDailyWithdrawLimit'] = CorePro::Models::ProgramLimit
|
43
|
+
|
44
|
+
classDefs['perTransactionDepositLimit'] = CorePro::Models::ProgramLimit
|
45
|
+
classDefs['perUserDailyDepositLimit'] = CorePro::Models::ProgramLimit
|
46
|
+
classDefs['perUserMonthlyDepositLimit'] = CorePro::Models::ProgramLimit
|
47
|
+
classDefs['perProgramDailyDepositLimit'] = CorePro::Models::ProgramLimit
|
48
|
+
|
49
|
+
super json, classDefs
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.get(connection = nil, loggingObject = nil)
|
53
|
+
connection ||= Connection.createFromConfig()
|
54
|
+
CorePro::Utils::Requestor.get("/program/get", Program, connection, loggingObject)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
require_relative 'models/file_content'
|
4
|
+
|
5
|
+
module CorePro
|
6
|
+
class Statement < Models::ModelBase
|
7
|
+
attr_accessor :statementId
|
8
|
+
attr_accessor :customerId
|
9
|
+
attr_accessor :type
|
10
|
+
attr_accessor :month
|
11
|
+
attr_accessor :year
|
12
|
+
|
13
|
+
def self.list(customerId, connection = nil, loggingObject = nil)
|
14
|
+
connection ||= Connection.createFromConfig()
|
15
|
+
CorePro::Utils::Requestor.get("/statement/list/#{customerId}", Statement, connection, loggingObject)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get(customerId, statementId, connection = nil, loggingObject = nil)
|
19
|
+
connection ||= Connection.createFromConfig()
|
20
|
+
CorePro::Utils::Requestor.get("/statement/get/#{customerId}/#{statementId}", Statement, connection, loggingObject)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.download(customerId, statementId, connection = nil, loggingObject = nil)
|
24
|
+
connection ||= Connection.createFromConfig()
|
25
|
+
CorePro::Utils::Requestor.get("/statement/download/#{customerId}/#{statementId}", CorePro::Models::FileContent, connection, loggingObject)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
|
4
|
+
module CorePro
|
5
|
+
class Transaction < Models::ModelBase
|
6
|
+
attr_accessor :transactionCount
|
7
|
+
attr_accessor :customerId
|
8
|
+
attr_accessor :transactionId
|
9
|
+
attr_accessor :tag
|
10
|
+
attr_accessor :createdDate
|
11
|
+
attr_accessor :type
|
12
|
+
attr_accessor :typeCode
|
13
|
+
attr_accessor :status
|
14
|
+
attr_accessor :amount
|
15
|
+
attr_accessor :settledDate
|
16
|
+
attr_accessor :voidedDate
|
17
|
+
attr_accessor :nachaDescription
|
18
|
+
attr_accessor :friendlyDescription
|
19
|
+
attr_accessor :availableDate
|
20
|
+
attr_accessor :returnCode
|
21
|
+
attr_accessor :isCredit
|
22
|
+
|
23
|
+
def self.list(customerId, accountId, status = nil, beginDate = nil, endDate = nil, pageNumber = 0, pageSize = 200, connection = nil, loggingObject = nil)
|
24
|
+
connection ||= Connection.createFromConfig()
|
25
|
+
start = beginDate.kind_of?(Date) ? beginDate.strftime('%Y-%m-%d') : (beginDate.kind_of?(String) ? beginDate[0..9] : nil)
|
26
|
+
finish = endDate.kind_of?(Date) ? endDate.strftime('%Y-%m-%d') : (endDate.kind_of?(String) ? endDate[0..9] : nil)
|
27
|
+
|
28
|
+
start ||= ''
|
29
|
+
finish ||= ''
|
30
|
+
|
31
|
+
if finish != '' && start == ''
|
32
|
+
start = '1900-01-01'
|
33
|
+
end
|
34
|
+
|
35
|
+
CorePro::Utils::Requestor.get("/transaction/list/#{customerId}/#{accountId}/#{status}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'models/model'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
|
4
|
+
module CorePro
|
5
|
+
class Transfer < Models::ModelBase
|
6
|
+
|
7
|
+
attr_accessor :customerId
|
8
|
+
attr_accessor :fromId
|
9
|
+
attr_accessor :toId
|
10
|
+
attr_accessor :amount
|
11
|
+
attr_accessor :tag
|
12
|
+
attr_accessor :transactionId
|
13
|
+
|
14
|
+
def self.create(customerId, fromId, toId, amount, tag, connection = nil, loggingObject = nil)
|
15
|
+
t = Transfer.new
|
16
|
+
t.customerId = customerId
|
17
|
+
t.fromId = fromId
|
18
|
+
t.toId = toId
|
19
|
+
t.amount = amount
|
20
|
+
t.tag = tag
|
21
|
+
t.create connection, loggingObject
|
22
|
+
end
|
23
|
+
|
24
|
+
def create(connection = nil, loggingObject = nil)
|
25
|
+
connection ||= Connection.createFromConfig()
|
26
|
+
CorePro::Utils::Requestor.post('/transfer/create', Transfer, self, connection, loggingObject)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.void(customerId, transactionId, tag, connection = nil, loggingObject = nil)
|
30
|
+
t = Transfer.new
|
31
|
+
t.customerId = customerId
|
32
|
+
t.transactionId = transactionId
|
33
|
+
t.tag = tag
|
34
|
+
t.void connection, loggingObject
|
35
|
+
end
|
36
|
+
|
37
|
+
def void(connection = nil, loggingObject = nil)
|
38
|
+
connection ||= Connection.createFromConfig()
|
39
|
+
CorePro::Utils::Requestor.post('/transfer/void', Transfer, self, connection, loggingObject)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/CorePro.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative 'corepro/connection'
|
2
|
+
require_relative 'corepro/account'
|
3
|
+
require_relative 'corepro/account_close'
|
4
|
+
require_relative 'corepro/core_pro_api_exception'
|
5
|
+
require_relative 'corepro/customer'
|
6
|
+
require_relative 'corepro/customer_beneficiary'
|
7
|
+
require_relative 'corepro/customer_document'
|
8
|
+
require_relative 'corepro/document'
|
9
|
+
require_relative 'corepro/external_account'
|
10
|
+
require_relative 'corepro/external_account_document'
|
11
|
+
require_relative 'corepro/program'
|
12
|
+
require_relative 'corepro/statement'
|
13
|
+
require_relative 'corepro/transaction'
|
14
|
+
require_relative 'corepro/transfer'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../test/core_pro_test_base'
|
2
|
+
require_relative "../lib/CorePro/account"
|
3
|
+
require_relative "../lib/CorePro/external_account"
|
4
|
+
require_relative "../lib/CorePro/core_pro_api_exception"
|
5
|
+
require_relative '../lib/CorePro/connection'
|
6
|
+
|
7
|
+
class AccountTest # < CoreProTestBase
|
8
|
+
|
9
|
+
def test_list
|
10
|
+
accounts = CorePro::Account.list(@@customerId, @@conn, NIL)
|
11
|
+
accounts.each{ |a|
|
12
|
+
puts a
|
13
|
+
}
|
14
|
+
assert_equal 1, accounts.length
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get
|
18
|
+
a = CorePro::Account.get(@@customerId, @@accountId, @@conn, NIL)
|
19
|
+
puts a
|
20
|
+
assert_equal '101686', a.accountNumber
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_update
|
24
|
+
a = CorePro::Account.get(@@customerId, @@accountId, @@conn, NIL)
|
25
|
+
a.name = "Testing ruby sdk #{Time.new.inspect}"
|
26
|
+
begin
|
27
|
+
assert_true a.update(@@conn, NIL)
|
28
|
+
|
29
|
+
rescue CorePro::CoreProApiException => cpaex
|
30
|
+
puts cpaex.to_s
|
31
|
+
raise
|
32
|
+
rescue Exception => ex
|
33
|
+
puts ex.to_s
|
34
|
+
raise
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative "../test/core_pro_test_base"
|
2
|
+
require_relative "../lib/CorePro/customer"
|
3
|
+
require_relative "../lib/CorePro/connection"
|
4
|
+
require_relative "../lib/CorePro/core_pro_api_exception"
|
5
|
+
|
6
|
+
class CustomerTest < CoreProTestBase
|
7
|
+
|
8
|
+
|
9
|
+
def test_get
|
10
|
+
puts 'test_get'
|
11
|
+
c = CorePro::Customer.get @@customerId, @@conn, nil
|
12
|
+
puts c
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_getByTag
|
16
|
+
puts 'test_getByTag'
|
17
|
+
c = CorePro::Customer.getByTag 'jsmith123abc'
|
18
|
+
puts c
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_search
|
22
|
+
puts 'test_search'
|
23
|
+
cs = CorePro::Customer.search nil, lastName = 'Smith'
|
24
|
+
cs.each do | x |
|
25
|
+
puts x
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_list
|
30
|
+
puts 'test_list'
|
31
|
+
cs = CorePro::Customer.list 0, 15, @@conn, nil
|
32
|
+
cs.each do |x|
|
33
|
+
puts x
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_update
|
38
|
+
c = CorePro::Customer.get @@customerId, @@conn, nil
|
39
|
+
puts "test_update. orig gender = #{c.gender}"
|
40
|
+
c.gender = c.gender == 'M' ? 'F' : 'M'
|
41
|
+
c.update @@conn
|
42
|
+
c = CorePro::Customer.get @@customerId, @@conn, nil
|
43
|
+
puts "test_update. new gender = #{c.gender}"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: corepro
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- devsupport
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '10.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '10.0'
|
46
|
+
description: See http://docs.corepro.io for more detail.
|
47
|
+
email:
|
48
|
+
- devsupport@socialmoney.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- .idea/.name
|
55
|
+
- .idea/.rakeTasks
|
56
|
+
- .idea/corepro-sdk-ruby.iml
|
57
|
+
- .idea/encodings.xml
|
58
|
+
- .idea/misc.xml
|
59
|
+
- .idea/modules.xml
|
60
|
+
- .idea/scopes/scope_settings.xml
|
61
|
+
- .idea/vcs.xml
|
62
|
+
- CorePro.gemspec
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- config-sample.yml
|
68
|
+
- lib/CorePro.rb
|
69
|
+
- lib/CorePro/Models/account_id_only.rb
|
70
|
+
- lib/CorePro/Models/api_error.rb
|
71
|
+
- lib/CorePro/Models/customer_address.rb
|
72
|
+
- lib/CorePro/Models/customer_answer.rb
|
73
|
+
- lib/CorePro/Models/customer_id_only.rb
|
74
|
+
- lib/CorePro/Models/customer_message.rb
|
75
|
+
- lib/CorePro/Models/customer_phone.rb
|
76
|
+
- lib/CorePro/Models/customer_question.rb
|
77
|
+
- lib/CorePro/Models/customer_response.rb
|
78
|
+
- lib/CorePro/Models/customer_verify_request.rb
|
79
|
+
- lib/CorePro/Models/envelope.rb
|
80
|
+
- lib/CorePro/Models/external_account_id_only.rb
|
81
|
+
- lib/CorePro/Models/external_account_verify.rb
|
82
|
+
- lib/CorePro/Models/file_content.rb
|
83
|
+
- lib/CorePro/Models/json_base.rb
|
84
|
+
- lib/CorePro/Models/model_base.rb
|
85
|
+
- lib/CorePro/Models/program_interest_rate.rb
|
86
|
+
- lib/CorePro/Models/program_limit.rb
|
87
|
+
- lib/CorePro/Utils/logger.rb
|
88
|
+
- lib/CorePro/Utils/requestor.rb
|
89
|
+
- lib/CorePro/account.rb
|
90
|
+
- lib/CorePro/account_close.rb
|
91
|
+
- lib/CorePro/connection.rb
|
92
|
+
- lib/CorePro/core_pro_api_exception.rb
|
93
|
+
- lib/CorePro/customer.rb
|
94
|
+
- lib/CorePro/customer_beneficiary.rb
|
95
|
+
- lib/CorePro/customer_document.rb
|
96
|
+
- lib/CorePro/document.rb
|
97
|
+
- lib/CorePro/external_account.rb
|
98
|
+
- lib/CorePro/external_account_document.rb
|
99
|
+
- lib/CorePro/program.rb
|
100
|
+
- lib/CorePro/statement.rb
|
101
|
+
- lib/CorePro/transaction.rb
|
102
|
+
- lib/CorePro/transfer.rb
|
103
|
+
- lib/CorePro/version.rb
|
104
|
+
- test/account_test.rb
|
105
|
+
- test/core_pro_test_base.rb
|
106
|
+
- test/customer_test.rb
|
107
|
+
homepage: https://github.com/socialmoney/corepro-sdk-ruby
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.8.28
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: A Ruby SDK for consuming the corepro API.
|
132
|
+
test_files:
|
133
|
+
- test/account_test.rb
|
134
|
+
- test/core_pro_test_base.rb
|
135
|
+
- test/customer_test.rb
|