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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18b867d8d8816b49b9f6fc3c5ad56cf9d8f880ef7cde8d00967ada67c466b382
4
- data.tar.gz: 834f229a02e5d24662e4ac0ed9726d1c0bb1122bb29ec567ed63989bbcdf9be4
3
+ metadata.gz: 681e7a9060969e02aa1666ef0b416fc78bd1e3fa4cf2fc80e050836971359fdd
4
+ data.tar.gz: 3491a7bbbceb45eafa4602a2e1a26053d18945424efbcf12e3cef9cc6f5643cf
5
5
  SHA512:
6
- metadata.gz: 6c2dbbbd2b14d234b4452dfc6cbe1a425cb7709cf7577e3e3a7c616315efaab1c914b2471d7e3a1be0dd3e2c86b51c73bae75a0e7e6f949f7de5a6ed29436818
7
- data.tar.gz: eeb6aff99dfd1c0cc9d3660714987a71ee7f269573f3a227bd532aa034eeb42e263ccce608bebc54e2f1f1dc9bef45ca312c56eb8140e1697bbdd8adbae5acfe
6
+ metadata.gz: 60d96d6d2bfdc74348f916c70c6f888051ec7d50b75297e8043ee255c31048b4e7c01dca27449989c55a25e0acc37807de043cd967fca4f7be4f6fbf0cf81e2e
7
+ data.tar.gz: ff82b8d6b329d605e0e415bab346b06f720bb47e43f3d2e0862b817e359969da134a7c693aad3905857e590a5aa0e2b02010d50e0c79289108f75bbf5a425ca5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0
4
+
5
+ - Add `Unit::DepositAccount#close` to close a deposit account.
6
+ - Add `Unit::IndividualCustomer#archive` to archive a customer.
7
+
3
8
  ## 1.2.0
4
9
 
5
10
  - Add `Unit::BookPayment` for booking transfers between Unit accounts.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Unit
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chloe Isacke