corepro_eg 1.0.2
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 +7 -0
- data/.gitignore +16 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/codeStyleSettings.xml +14 -0
- data/.idea/corepro-sdk-ruby.iml +27 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +8 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +15 -0
- data/LICENSE +21 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/config-sample.yml +5 -0
- data/corepro_eg.gemspec +25 -0
- data/lib/corepro/account.rb +109 -0
- data/lib/corepro/account_close.rb +21 -0
- data/lib/corepro/bank_document.rb +42 -0
- data/lib/corepro/card.rb +90 -0
- data/lib/corepro/connection.rb +86 -0
- data/lib/corepro/core_pro_api_exception.rb +26 -0
- data/lib/corepro/customer.rb +139 -0
- data/lib/corepro/customer_beneficiary.rb +42 -0
- data/lib/corepro/customer_document.rb +22 -0
- data/lib/corepro/external_account.rb +84 -0
- data/lib/corepro/external_account_document.rb +34 -0
- data/lib/corepro/models/account_access.rb +25 -0
- data/lib/corepro/models/account_id_only.rb +9 -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_beneficiary_id_only.rb +8 -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 +22 -0
- data/lib/corepro/models/customer_response.rb +28 -0
- data/lib/corepro/models/customer_verify_request.rb +28 -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 +93 -0
- data/lib/corepro/models/model_base.rb +26 -0
- data/lib/corepro/models/program_account.rb +20 -0
- data/lib/corepro/models/program_checking.rb +38 -0
- data/lib/corepro/models/program_e_code.rb +31 -0
- data/lib/corepro/models/program_external_account.rb +21 -0
- data/lib/corepro/models/program_interest_rate.rb +18 -0
- data/lib/corepro/models/program_limit.rb +12 -0
- data/lib/corepro/models/program_prepaid.rb +37 -0
- data/lib/corepro/models/program_savings.rb +36 -0
- data/lib/corepro/program.rb +74 -0
- data/lib/corepro/statement.rb +25 -0
- data/lib/corepro/transaction.rb +53 -0
- data/lib/corepro/transfer.rb +40 -0
- data/lib/corepro/utils/logger.rb +9 -0
- data/lib/corepro/utils/requestor.rb +120 -0
- data/lib/corepro/version.rb +4 -0
- data/lib/corepro.rb +15 -0
- data/q2labs_public.pem +9 -0
- data/test/a_program_test.rb +12 -0
- data/test/aa_customer_test.rb +78 -0
- data/test/ab_account_test.rb +45 -0
- data/test/ac_external_account_test.rb +39 -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/ai_statement_test.rb +23 -0
- data/test/aj_transfer_test.rb +53 -0
- data/test/ak_transaction_test.rb +19 -0
- data/test/al_card_test.rb +51 -0
- data/test/core_pro_test_base.rb +30 -0
- data/test.pdf +0 -0
- metadata +175 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c9be68001a2db3bfeed4d96598dfe5e66e1452cc3bcdbdf07ec3e8f6dc44902c
|
|
4
|
+
data.tar.gz: e940ff817868b3259d0e916f35fcdab157b2c4530b5811a8be44b53ba347e769
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1e9507111ccab045bf70fdca8a0642a17f2cdd41997b6507009a7e5e30f5397cc602945e15d63cd5c7ad2b908df68af9e77ae10deb080b5957fe580d7999535f
|
|
7
|
+
data.tar.gz: 22ea7c537e08245c034c560aa5837590f59fab9da78a75e18a45bc3030e8253b9afc4f282b985d6709f4de34f8bd4b147bc4a7733852663a6be8875be8d4cde9
|
data/.gitignore
ADDED
data/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
corepro-sdk-ruby
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build corepro-1.0.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install corepro-1.0.1.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install corepro-1.0.1.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v1.0.1 and build and push corepro-1.0.1.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectCodeStyleSettingsManager">
|
|
4
|
+
<option name="PER_PROJECT_SETTINGS">
|
|
5
|
+
<value>
|
|
6
|
+
<XML>
|
|
7
|
+
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
|
8
|
+
</XML>
|
|
9
|
+
</value>
|
|
10
|
+
</option>
|
|
11
|
+
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
|
12
|
+
</component>
|
|
13
|
+
</project>
|
|
14
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
|
5
|
+
<configuration />
|
|
6
|
+
</facet>
|
|
7
|
+
</component>
|
|
8
|
+
<component name="ModuleRunConfigurationManager">
|
|
9
|
+
<shared />
|
|
10
|
+
</component>
|
|
11
|
+
<component name="NewModuleRootManager">
|
|
12
|
+
<content url="file://$MODULE_DIR$">
|
|
13
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
14
|
+
</content>
|
|
15
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.4.1" jdkType="RUBY_SDK" />
|
|
16
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.6, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest-reporters (v1.3.5, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="power_assert (v1.1.3, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.0, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="test-unit (v3.2.8, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
26
|
+
</component>
|
|
27
|
+
</module>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/corepro-sdk-ruby.iml" filepath="$PROJECT_DIR$/.idea/corepro-sdk-ruby.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in corepro_eg.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
# gem 'corepro_eg'
|
|
7
|
+
|
|
8
|
+
group :test do
|
|
9
|
+
if RUBY_PLATFORM =~ /(win32|w32)/
|
|
10
|
+
gem "win32console", '1.3.0'
|
|
11
|
+
end
|
|
12
|
+
gem "minitest"
|
|
13
|
+
gem 'minitest-reporters', '>= 0.5.0'
|
|
14
|
+
gem 'test-unit'
|
|
15
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 socialmoney.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# corepro-sdk-ruby
|
|
2
|
+
|
|
3
|
+
A Ruby SDK for consuming the CorePro API
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'corepro'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install corepro
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Use this object hierarchy as a simple entry point into CorePro. Details of the CorePro API itself are available at
|
|
24
|
+
https://docs.corepro.io/api. To see all available SDKs, visit https://docs.corepro.io/sdk.
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
require 'corepro'
|
|
28
|
+
|
|
29
|
+
# create a connection
|
|
30
|
+
# (typical use case is to pull connection info from config.yml, this is for explicitness)
|
|
31
|
+
conn = CorePro::Connection.new 'your-api-key-here', 'your-api-secret-here', 'api.corepro.io'
|
|
32
|
+
|
|
33
|
+
# retrieve a customer by a known tag (pass conn as nil if connection info is in config.yml)
|
|
34
|
+
cust = CorePro::Customer.getByTag 'bweaver', conn
|
|
35
|
+
|
|
36
|
+
# retrieve most recent transactions for that customer's primary account
|
|
37
|
+
trans = CorePro::Transaction.list cust.customerId, cust.accounts[0].accountId
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Contributing
|
|
42
|
+
|
|
43
|
+
1. Fork it ( https://github.com/socialmoney/corepro-sdk-ruby/fork )
|
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/config-sample.yml
ADDED
data/corepro_eg.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'corepro/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'corepro_eg'
|
|
8
|
+
spec.version = CorePro::VERSION
|
|
9
|
+
spec.authors = ['devsupport']
|
|
10
|
+
spec.email = ['devsupport@socialmoney.com']
|
|
11
|
+
spec.summary = %q{A Ruby SDK for consuming the CorePro API.}
|
|
12
|
+
spec.description = %q{See https://docs.corepro.io for more detail.}
|
|
13
|
+
spec.homepage = 'https://github.com/socialmoney/corepro-sdk-ruby'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
spec.required_ruby_version = '~> 2.4'
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
24
|
+
spec.add_development_dependency 'test-unit', '~> 3.2'
|
|
25
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
require_relative 'models/model_base'
|
|
2
|
+
require_relative 'utils/requestor'
|
|
3
|
+
require_relative 'models/account_id_only'
|
|
4
|
+
require_relative 'models/account_access'
|
|
5
|
+
|
|
6
|
+
module CorePro
|
|
7
|
+
class Account < Models::ModelBase
|
|
8
|
+
|
|
9
|
+
# Identifiers
|
|
10
|
+
attr_accessor :accountId
|
|
11
|
+
attr_accessor :customerId
|
|
12
|
+
attr_accessor :tag
|
|
13
|
+
attr_accessor :name
|
|
14
|
+
attr_accessor :routingNumber
|
|
15
|
+
attr_accessor :routingNumberMasked
|
|
16
|
+
attr_accessor :accountNumber
|
|
17
|
+
attr_accessor :accountNumberMasked
|
|
18
|
+
attr_accessor :legalName1
|
|
19
|
+
attr_accessor :legalName2
|
|
20
|
+
|
|
21
|
+
# state related
|
|
22
|
+
attr_accessor :status
|
|
23
|
+
attr_accessor :type
|
|
24
|
+
attr_accessor :productId
|
|
25
|
+
attr_accessor :createdDate
|
|
26
|
+
attr_accessor :closedDate
|
|
27
|
+
attr_accessor :isPrimary
|
|
28
|
+
attr_accessor :isCloseable
|
|
29
|
+
attr_accessor :lastModifiedDate
|
|
30
|
+
|
|
31
|
+
# goal related
|
|
32
|
+
attr_accessor :targetAmount
|
|
33
|
+
attr_accessor :targetDate
|
|
34
|
+
attr_accessor :targetMetDate
|
|
35
|
+
attr_accessor :targetMetPercent
|
|
36
|
+
attr_accessor :category
|
|
37
|
+
attr_accessor :subCategory
|
|
38
|
+
|
|
39
|
+
# balance related
|
|
40
|
+
attr_accessor :availableBalance
|
|
41
|
+
attr_accessor :accountBalance
|
|
42
|
+
attr_accessor :pendingBalance
|
|
43
|
+
attr_accessor :balanceLastModifiedDate
|
|
44
|
+
|
|
45
|
+
# recurring deposit related
|
|
46
|
+
attr_accessor :recurringContributionType
|
|
47
|
+
attr_accessor :recurringContributionAmount
|
|
48
|
+
attr_accessor :recurringContributionFromExternalAccountId
|
|
49
|
+
attr_accessor :recurringContributionStartDate
|
|
50
|
+
attr_accessor :recurringContributionEndDate
|
|
51
|
+
attr_accessor :recurringContributionNextDate
|
|
52
|
+
|
|
53
|
+
# joint account related
|
|
54
|
+
attr_accessor :totalCustomers
|
|
55
|
+
attr_accessor :isJointAccount
|
|
56
|
+
attr_accessor :primaryCustomerId
|
|
57
|
+
attr_accessor :isPrimaryCustomer
|
|
58
|
+
attr_accessor :accessTypeCode
|
|
59
|
+
attr_accessor :customerPriority
|
|
60
|
+
|
|
61
|
+
# customizable
|
|
62
|
+
attr_accessor :customField1
|
|
63
|
+
attr_accessor :customField2
|
|
64
|
+
attr_accessor :customField3
|
|
65
|
+
attr_accessor :customField4
|
|
66
|
+
attr_accessor :customField5
|
|
67
|
+
|
|
68
|
+
def initialize; end
|
|
69
|
+
|
|
70
|
+
def self.list(customerId, connection = nil, loggingObject = nil)
|
|
71
|
+
CorePro::Utils::Requestor.get("/account/list/#{customerId}", Account, connection, loggingObject)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.get(customerId, accountId, connection = nil, loggingObject = nil)
|
|
75
|
+
CorePro::Utils::Requestor.get("/account/get/#{customerId}/#{accountId}", Account, connection, loggingObject)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.getByTag(customerId, tag, connection = nil, loggingObject = nil)
|
|
79
|
+
CorePro::Utils::Requestor.get("/account/getByTag/#{customerId}/#{escape(tag)}", Account, connection, loggingObject)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def create(connection = nil, loggingObject = nil)
|
|
83
|
+
aid = CorePro::Utils::Requestor.post('/account/create', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
|
84
|
+
aid.accountId
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def update(connection = nil, loggingObject = nil)
|
|
88
|
+
aid = CorePro::Utils::Requestor.post('/account/update', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
|
89
|
+
aid.accountId
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def close(closeToAccountId, transactionTag, connection = nil, loggingObject = nil)
|
|
93
|
+
ac = CorePro::AccountClose.new
|
|
94
|
+
ac.closeToAccountId = closeToAccountId
|
|
95
|
+
ac.transactionTag = transactionTag
|
|
96
|
+
ac.close(connection, loggingObject)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.listAccess(customerId, accountId, connection = nil, loggingObject = nil)
|
|
100
|
+
CorePro::Utils::Requestor.get("/account/listaccess/#{customerId}/#{accountId}", CorePro::Models::AccountAccess, connection, loggingObject)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def editAccess(connection = nil, loggingObject = nil)
|
|
104
|
+
aea = CorePro::Utils::Requestor.post('/account/editaccess', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
|
105
|
+
aea.accountId
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require_relative 'models/model_base'
|
|
2
|
+
require_relative 'utils/requestor'
|
|
3
|
+
|
|
4
|
+
module CorePro
|
|
5
|
+
class AccountClose < Models::ModelBase
|
|
6
|
+
attr_accessor :customerId
|
|
7
|
+
attr_accessor :accountId
|
|
8
|
+
attr_accessor :closeToAccountId
|
|
9
|
+
attr_accessor :transactionId
|
|
10
|
+
attr_accessor :transactionTag
|
|
11
|
+
attr_accessor :closingBalanceAmount
|
|
12
|
+
attr_accessor :interestPaidAmount
|
|
13
|
+
attr_accessor :backupWithholdingAmount
|
|
14
|
+
attr_accessor :totalClosingAmount
|
|
15
|
+
attr_accessor :isClosedToExternalAccount
|
|
16
|
+
|
|
17
|
+
def close(connection = nil, loggingObject = nil)
|
|
18
|
+
CorePro::Utils::Requestor.post('/account/close', AccountClose, self, connection, loggingObject)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
CorePro::Utils::Requestor.get("/bankdocument/list/#{BankDocument.escape(self.culture)}/#{BankDocument.escape(self.documentType)}", BankDocument, connection, loggingObject)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.download(culture, documentId, connection = nil, loggingObject = nil)
|
|
31
|
+
d = BankDocument.new
|
|
32
|
+
d.culture = culture
|
|
33
|
+
d.documentId = documentId
|
|
34
|
+
d.download connection, loggingObject
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def download(connection = nil, loggingObject = nil)
|
|
38
|
+
CorePro::Utils::Requestor.get("/bankdocument/download/#{BankDocument.escape(self.culture)}/#{self.documentId}", CorePro::Models::FileContent, connection, loggingObject)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/corepro/card.rb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require_relative 'models/model_base'
|
|
2
|
+
require_relative 'utils/requestor'
|
|
3
|
+
|
|
4
|
+
module CorePro
|
|
5
|
+
class Card < Models::ModelBase
|
|
6
|
+
attr_accessor :cardId
|
|
7
|
+
attr_accessor :customerId
|
|
8
|
+
attr_accessor :cardHolderCustomerId
|
|
9
|
+
attr_accessor :typeCode
|
|
10
|
+
attr_accessor :vendorTypeCode
|
|
11
|
+
attr_accessor :status
|
|
12
|
+
attr_accessor :cardNumberMasked
|
|
13
|
+
attr_accessor :tag
|
|
14
|
+
attr_accessor :firstName
|
|
15
|
+
attr_accessor :middleName
|
|
16
|
+
attr_accessor :lastName
|
|
17
|
+
attr_accessor :nickName
|
|
18
|
+
attr_accessor :expireMonth
|
|
19
|
+
attr_accessor :expireYear
|
|
20
|
+
attr_accessor :primaryAccountId
|
|
21
|
+
attr_accessor :lockTypeCode
|
|
22
|
+
attr_accessor :lockReasonTypeCode
|
|
23
|
+
attr_accessor :createdDate
|
|
24
|
+
attr_accessor :requestedDate
|
|
25
|
+
attr_accessor :verifiedDate
|
|
26
|
+
attr_accessor :reissuedDate
|
|
27
|
+
attr_accessor :deniedDate
|
|
28
|
+
attr_accessor :expiredDate
|
|
29
|
+
attr_accessor :archivedDate
|
|
30
|
+
attr_accessor :lastModifiedDate
|
|
31
|
+
attr_accessor :accounts
|
|
32
|
+
attr_accessor :newPin
|
|
33
|
+
|
|
34
|
+
def self.get(customerId, cardId, connection = nil, loggingObject = nil)
|
|
35
|
+
CorePro::Utils::Requestor.get("/card/get/#{customerId}/#{cardId}", Card, connection, loggingObject)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.getByTag(customerId, tag, connection = nil, loggingObject = nil)
|
|
39
|
+
CorePro::Utils::Requestor.get("/card/getByTag/#{customerId}/#{escape(tag)}", Card, connection, loggingObject)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.list(customerId, connection = nil, loggingObject = nil)
|
|
43
|
+
CorePro::Utils::Requestor.get("/card/list/#{customerId}", Card, connection, loggingObject)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def initiate(connection = nil, loggingObject = nil)
|
|
47
|
+
CorePro::Utils::Requestor.post('/card/initiate', Card, self, connection, loggingObject)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def verify(connection = nil, loggingObject = nil)
|
|
51
|
+
CorePro::Utils::Requestor.post('/card/verify', Card, self, connection, loggingObject)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def reissue(connection = nil, loggingObject = nil)
|
|
55
|
+
CorePro::Utils::Requestor.post('/card/reissue', Card, self, connection, loggingObject)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def archive(connection = nil, loggingObject = nil)
|
|
59
|
+
CorePro::Utils::Requestor.post('/card/archive', nil, self, connection, loggingObject)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def addAccount(connection = nil, loggingObject = nil)
|
|
65
|
+
CorePro::Utils::Requestor.post('/card/addAccount', Card, self, connection, loggingObject)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def removeAccount(connection = nil, loggingObject = nil)
|
|
69
|
+
CorePro::Utils::Requestor.post('/card/removeAccount', Card, self, connection, loggingObject)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def reprioritizeAccount(connection = nil, loggingObject = nil)
|
|
73
|
+
CorePro::Utils::Requestor.post('/card/reprioritizeAccount', Card, self, connection, loggingObject)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def hotlist(connection = nil, loggingObject = nil)
|
|
78
|
+
CorePro::Utils::Requestor.post('/card/hotlist', Card, self, connection, loggingObject)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def lock(connection = nil, loggingObject = nil)
|
|
82
|
+
CorePro::Utils::Requestor.post('/card/lock', Card, self, connection, loggingObject)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def unlock(connection = nil, loggingObject = nil)
|
|
86
|
+
CorePro::Utils::Requestor.post('/card/unlock', Card, self, connection, loggingObject)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'base64'
|
|
2
|
+
require 'yaml'
|
|
3
|
+
|
|
4
|
+
module CorePro
|
|
5
|
+
class Connection
|
|
6
|
+
|
|
7
|
+
attr_accessor :proxyServerName
|
|
8
|
+
attr_accessor :proxyPort
|
|
9
|
+
|
|
10
|
+
@@config = begin
|
|
11
|
+
if File.exists?('config.yml')
|
|
12
|
+
YAML.load(File.open('config.yml'))
|
|
13
|
+
elsif File.exists?('../config.yml')
|
|
14
|
+
YAML.load(File.open('../config.yml'))
|
|
15
|
+
else
|
|
16
|
+
{}
|
|
17
|
+
end
|
|
18
|
+
rescue ArgumentError => e
|
|
19
|
+
puts "Could not parse YAML: #{e.message}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def self.createFromConfig(apiKey = nil, apiSecret = nil, domainName = nil, proxyServerName = nil, proxyPort = nil)
|
|
24
|
+
c = Connection.new
|
|
25
|
+
c.apiKey = apiKey || @@config['CoreProApiKey']
|
|
26
|
+
c.apiSecret = apiSecret || @@config['CoreProApiSecret']
|
|
27
|
+
c.domainName = domainName || @@config['CoreProDomainName']
|
|
28
|
+
c.proxyServerName = proxyServerName || @@config['CoreProProxyServerName']
|
|
29
|
+
c.proxyPort = proxyPort || @@config['CoreProProxyPort']
|
|
30
|
+
c
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def initialize(apiKey = nil, apiSecret = nil, domainName = nil, proxyServerName = nil, proxyPort = nil)
|
|
34
|
+
@apiKey = apiKey || @@config['CoreProApiKey']
|
|
35
|
+
@apiSecret = apiSecret || @@config['CoreProApiSecret']
|
|
36
|
+
@domainName = domainName || @@config['CoreProDomainName']
|
|
37
|
+
@proxyServerName = proxyServerName || @@config['CoreProProxyServerName']
|
|
38
|
+
@proxyPort = proxyPort || @@config['CoreProProxyPort']
|
|
39
|
+
@headerValue = ''
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def apiKey
|
|
43
|
+
@apiKey
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def apiKey=(value)
|
|
47
|
+
@apiKey = value
|
|
48
|
+
@headerValue = ''
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def apiSecret
|
|
52
|
+
@apiSecret
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def apiSecret=(value)
|
|
56
|
+
@apiSecret = value
|
|
57
|
+
@headerValue = ''
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def headerValue
|
|
61
|
+
if (@headerValue || '' == '')
|
|
62
|
+
utf8Value = "#{@apiKey}:#{@apiSecret}".force_encoding('iso-8859-1').encode('utf-8')
|
|
63
|
+
b64 = Base64.strict_encode64(utf8Value)
|
|
64
|
+
@headerValue = "Basic #{b64}"
|
|
65
|
+
end
|
|
66
|
+
@headerValue
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def domainName
|
|
70
|
+
@domainName
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def domainName=(value)
|
|
74
|
+
if value == nil
|
|
75
|
+
@domainName = nil
|
|
76
|
+
else
|
|
77
|
+
value.gsub! 'https://', ''
|
|
78
|
+
value.gsub! 'http://', ''
|
|
79
|
+
value.gsub! 'www.', ''
|
|
80
|
+
|
|
81
|
+
@domainName = value.split('/')[0]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module CorePro
|
|
2
|
+
class CoreProApiException < StandardError
|
|
3
|
+
def initialize(errors)
|
|
4
|
+
@errors = errors
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
attr_accessor :errors
|
|
8
|
+
|
|
9
|
+
def firstMessage
|
|
10
|
+
@errors[0].message
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def firstCode
|
|
14
|
+
@errors[0].code
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_s
|
|
18
|
+
msg = ''
|
|
19
|
+
@errors.each do |e|
|
|
20
|
+
msg += e.to_s + ' '
|
|
21
|
+
end
|
|
22
|
+
msg
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|