unit-ruby 1.2.0 → 1.3.0
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/unit-ruby/deposit_account.rb +21 -0
- data/lib/unit-ruby/individual_customer.rb +22 -0
- data/lib/unit-ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 681e7a9060969e02aa1666ef0b416fc78bd1e3fa4cf2fc80e050836971359fdd
|
|
4
|
+
data.tar.gz: 3491a7bbbceb45eafa4602a2e1a26053d18945424efbcf12e3cef9cc6f5643cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60d96d6d2bfdc74348f916c70c6f888051ec7d50b75297e8043ee255c31048b4e7c01dca27449989c55a25e0acc37807de043cd967fca4f7be4f6fbf0cf81e2e
|
|
7
|
+
data.tar.gz: ff82b8d6b329d605e0e415bab346b06f720bb47e43f3d2e0862b817e359969da134a7c693aad3905857e590a5aa0e2b02010d50e0c79289108f75bbf5a425ca5
|
data/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,9 @@ module Unit
|
|
|
17
17
|
attribute :status, Types::String, readonly: true # Status of the account, either Open, Frozen, or Closed.
|
|
18
18
|
attribute :freeze_reason, Types::String, readonly: true # Optional. The reason the account was frozen, either Fraud or free-text description.
|
|
19
19
|
attribute :close_reason, Types::String, readonly: true # Optional. The reason the account was closed, either ByCustomer or Fraud.
|
|
20
|
+
attribute :close_reason_text, Types::String, readonly: true # Optional. Free-text description of the close reason.
|
|
21
|
+
attribute :fraud_reason, Types::String, readonly: true # Optional. The fraud reason, when the account was closed for Fraud.
|
|
22
|
+
attribute :bank_reason, Types::String, readonly: true # Optional. The bank reason, when the account was closed ByBank.
|
|
20
23
|
|
|
21
24
|
belongs_to :customer, class_name: 'Unit::IndividualCustomer'
|
|
22
25
|
has_many :customers, class_name: 'Unit::IndividualCustomer'
|
|
@@ -32,6 +35,24 @@ module Unit
|
|
|
32
35
|
self.class.find(id)
|
|
33
36
|
end
|
|
34
37
|
|
|
38
|
+
# Closes the account. This action cannot be undone.
|
|
39
|
+
#
|
|
40
|
+
# @param reason [String] ByCustomer, Fraud, ByBank, NegativeBalance, BreachOfTermsAndConditions,
|
|
41
|
+
# NoAccountActivity, ProgramChange, ProgramClosed or CustomerDeceased
|
|
42
|
+
# @param reason_text [String] Optional. Free-text description, up to 255 characters
|
|
43
|
+
# @param fraud_reason [String] Optional. Applicable when the reason is Fraud
|
|
44
|
+
# @param bank_reason [String] Optional. Applicable when the reason is ByBank
|
|
45
|
+
def close(reason:, reason_text: nil, fraud_reason: nil, bank_reason: nil)
|
|
46
|
+
attributes = { reason: reason, reason_text: reason_text,
|
|
47
|
+
fraud_reason: fraud_reason, bank_reason: bank_reason }.compact
|
|
48
|
+
closed_account = self.class.connection.post(
|
|
49
|
+
"#{self.class.resource_path(id)}/close",
|
|
50
|
+
{ data: { type: 'depositAccountClose', attributes: attributes } }
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
update_resource_from_json_api(closed_account)
|
|
54
|
+
end
|
|
55
|
+
|
|
35
56
|
def limits
|
|
36
57
|
@limits ||= Types::AccountLimits.cast(
|
|
37
58
|
self.class.connection.get("accounts/#{id}/limits")
|
|
@@ -17,9 +17,31 @@ module Unit
|
|
|
17
17
|
attribute :risk_rate, Types::String, readonly: true
|
|
18
18
|
attribute :authorized_users, Types::Array, readonly: true
|
|
19
19
|
attribute :created_at, Types::DateTime, readonly: true
|
|
20
|
+
attribute :status, Types::String, readonly: true # Status of the customer, either Active or Archived.
|
|
21
|
+
attribute :archive_reason, Types::String, readonly: true # Optional. The reason the customer was archived.
|
|
20
22
|
|
|
21
23
|
belongs_to :application, class_name: 'Unit::IndividualApplication'
|
|
22
24
|
|
|
25
|
+
# Archives the customer. This action cannot be undone.
|
|
26
|
+
# All accounts of the customer must be closed first.
|
|
27
|
+
#
|
|
28
|
+
# @param reason [String] Inactive, FraudACHActivity, FraudCardActivity, FraudCheckActivity,
|
|
29
|
+
# FraudApplicationHistory, FraudAccountActivity, FraudClientIdentified,
|
|
30
|
+
# FraudLinkedToFraudulentCustomer or ByBank
|
|
31
|
+
def archive(reason:)
|
|
32
|
+
archived_customer = self.class.connection.post(
|
|
33
|
+
"#{self.class.resource_path(id)}/archive",
|
|
34
|
+
{
|
|
35
|
+
data: {
|
|
36
|
+
type: 'archiveCustomer',
|
|
37
|
+
attributes: { reason: reason }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
update_resource_from_json_api(archived_customer)
|
|
43
|
+
end
|
|
44
|
+
|
|
23
45
|
include ResourceOperations::List
|
|
24
46
|
include ResourceOperations::Create
|
|
25
47
|
include ResourceOperations::Save
|
data/lib/unit-ruby/version.rb
CHANGED