tesser-api-sdk 1.0.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.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +148 -0
  4. data/bin/console +15 -0
  5. data/lib/tesser_apiv1/api_helper.rb +10 -0
  6. data/lib/tesser_apiv1/client.rb +118 -0
  7. data/lib/tesser_apiv1/configuration.rb +182 -0
  8. data/lib/tesser_apiv1/controllers/accounts_controller.rb +193 -0
  9. data/lib/tesser_apiv1/controllers/base_controller.rb +60 -0
  10. data/lib/tesser_apiv1/controllers/counterparties_controller.rb +171 -0
  11. data/lib/tesser_apiv1/controllers/currencies_controller.rb +39 -0
  12. data/lib/tesser_apiv1/controllers/experimental_controller.rb +49 -0
  13. data/lib/tesser_apiv1/controllers/health_controller.rb +24 -0
  14. data/lib/tesser_apiv1/controllers/networks_controller.rb +39 -0
  15. data/lib/tesser_apiv1/controllers/payments_controller.rb +202 -0
  16. data/lib/tesser_apiv1/controllers/tenants_controller.rb +156 -0
  17. data/lib/tesser_apiv1/controllers/treasury_controller.rb +77 -0
  18. data/lib/tesser_apiv1/exceptions/api_exception.rb +21 -0
  19. data/lib/tesser_apiv1/http/auth/o_auth2.rb +53 -0
  20. data/lib/tesser_apiv1/http/http_call_back.rb +10 -0
  21. data/lib/tesser_apiv1/http/http_method_enum.rb +10 -0
  22. data/lib/tesser_apiv1/http/http_request.rb +10 -0
  23. data/lib/tesser_apiv1/http/http_response.rb +10 -0
  24. data/lib/tesser_apiv1/http/proxy_settings.rb +22 -0
  25. data/lib/tesser_apiv1/models/account.rb +230 -0
  26. data/lib/tesser_apiv1/models/account_list_item.rb +230 -0
  27. data/lib/tesser_apiv1/models/account_list_response.rb +69 -0
  28. data/lib/tesser_apiv1/models/account_response.rb +60 -0
  29. data/lib/tesser_apiv1/models/account_safe.rb +218 -0
  30. data/lib/tesser_apiv1/models/balance_status1_enum.rb +40 -0
  31. data/lib/tesser_apiv1/models/balance_status_enum.rb +40 -0
  32. data/lib/tesser_apiv1/models/base_model.rb +110 -0
  33. data/lib/tesser_apiv1/models/classification7_enum.rb +36 -0
  34. data/lib/tesser_apiv1/models/classification_enum.rb +36 -0
  35. data/lib/tesser_apiv1/models/counterparty.rb +411 -0
  36. data/lib/tesser_apiv1/models/counterparty_list_response.rb +69 -0
  37. data/lib/tesser_apiv1/models/counterparty_response.rb +60 -0
  38. data/lib/tesser_apiv1/models/create_bank_request.rb +122 -0
  39. data/lib/tesser_apiv1/models/create_bank_response.rb +60 -0
  40. data/lib/tesser_apiv1/models/create_counterparty_request.rb +350 -0
  41. data/lib/tesser_apiv1/models/create_counterparty_response.rb +60 -0
  42. data/lib/tesser_apiv1/models/create_deposit_request.rb +119 -0
  43. data/lib/tesser_apiv1/models/create_payment_request.rb +168 -0
  44. data/lib/tesser_apiv1/models/create_tenant_request.rb +183 -0
  45. data/lib/tesser_apiv1/models/create_tenant_response.rb +60 -0
  46. data/lib/tesser_apiv1/models/create_wallet_request.rb +112 -0
  47. data/lib/tesser_apiv1/models/create_wallet_response.rb +60 -0
  48. data/lib/tesser_apiv1/models/create_withdrawal_request.rb +130 -0
  49. data/lib/tesser_apiv1/models/currencies_response.rb +69 -0
  50. data/lib/tesser_apiv1/models/currency.rb +119 -0
  51. data/lib/tesser_apiv1/models/data.rb +221 -0
  52. data/lib/tesser_apiv1/models/data6.rb +242 -0
  53. data/lib/tesser_apiv1/models/data7.rb +419 -0
  54. data/lib/tesser_apiv1/models/data8.rb +200 -0
  55. data/lib/tesser_apiv1/models/direction1_enum.rb +40 -0
  56. data/lib/tesser_apiv1/models/direction_enum.rb +40 -0
  57. data/lib/tesser_apiv1/models/execute_payment_request_dto.rb +71 -0
  58. data/lib/tesser_apiv1/models/fee.rb +117 -0
  59. data/lib/tesser_apiv1/models/fee1.rb +117 -0
  60. data/lib/tesser_apiv1/models/network.rb +68 -0
  61. data/lib/tesser_apiv1/models/networks_response.rb +69 -0
  62. data/lib/tesser_apiv1/models/pagination.rb +104 -0
  63. data/lib/tesser_apiv1/models/payment.rb +421 -0
  64. data/lib/tesser_apiv1/models/payment_list_response.rb +79 -0
  65. data/lib/tesser_apiv1/models/payment_response.rb +60 -0
  66. data/lib/tesser_apiv1/models/payment_type3_enum.rb +52 -0
  67. data/lib/tesser_apiv1/models/payment_type_enum.rb +54 -0
  68. data/lib/tesser_apiv1/models/provider_key1_enum.rb +36 -0
  69. data/lib/tesser_apiv1/models/provider_key_enum.rb +36 -0
  70. data/lib/tesser_apiv1/models/response.rb +81 -0
  71. data/lib/tesser_apiv1/models/review_payment_request.rb +60 -0
  72. data/lib/tesser_apiv1/models/risk_status_enum.rb +44 -0
  73. data/lib/tesser_apiv1/models/status1_enum.rb +52 -0
  74. data/lib/tesser_apiv1/models/status_enum.rb +48 -0
  75. data/lib/tesser_apiv1/models/step.rb +421 -0
  76. data/lib/tesser_apiv1/models/step_type_enum.rb +44 -0
  77. data/lib/tesser_apiv1/models/tenant.rb +275 -0
  78. data/lib/tesser_apiv1/models/tenant_api_credentials.rb +88 -0
  79. data/lib/tesser_apiv1/models/tenant_list_response.rb +69 -0
  80. data/lib/tesser_apiv1/models/tenant_response.rb +60 -0
  81. data/lib/tesser_apiv1/models/transfer_step.rb +422 -0
  82. data/lib/tesser_apiv1/models/turnkey_stamp.rb +81 -0
  83. data/lib/tesser_apiv1/models/type3_enum.rb +40 -0
  84. data/lib/tesser_apiv1/models/type4_enum.rb +44 -0
  85. data/lib/tesser_apiv1/models/type_enum.rb +44 -0
  86. data/lib/tesser_apiv1/models/update_account_request.rb +62 -0
  87. data/lib/tesser_apiv1/models/update_account_response.rb +60 -0
  88. data/lib/tesser_apiv1/models/update_counterparty_request.rb +166 -0
  89. data/lib/tesser_apiv1/models/update_counterparty_response.rb +60 -0
  90. data/lib/tesser_apiv1/models/update_payment_request.rb +100 -0
  91. data/lib/tesser_apiv1/models/update_tenant_request.rb +111 -0
  92. data/lib/tesser_apiv1/models/update_tenant_response.rb +60 -0
  93. data/lib/tesser_apiv1/utilities/date_time_helper.rb +11 -0
  94. data/lib/tesser_apiv1/utilities/file_wrapper.rb +28 -0
  95. data/lib/tesser_apiv1/utilities/union_type_lookup.rb +1234 -0
  96. data/lib/tesser_apiv1.rb +116 -0
  97. data/test/controllers/controller_test_base.rb +23 -0
  98. data/test/controllers/test_health_controller.rb +31 -0
  99. data/test/controllers/test_tenants_controller.rb +133 -0
  100. data/test/http_response_catcher.rb +19 -0
  101. metadata +212 -0
@@ -0,0 +1,242 @@
1
+ # tesser_apiv1
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ require_relative 'payment'
8
+
9
+ module TesserApiv1
10
+ # Data6 Model.
11
+ class Data6 < Payment
12
+
13
+
14
+ # A mapping from model property names to API property names.
15
+ def self.names
16
+ @_hash = {} if @_hash.nil?
17
+
18
+ @_hash = super().merge(@_hash)
19
+ @_hash
20
+ end
21
+
22
+ # An array for optional fields
23
+ def self.optionals
24
+ _arr = []
25
+ (_arr << super()).flatten!
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ _arr = []
31
+ (_arr << super()).flatten!
32
+ end
33
+
34
+ def initialize(id = nil, workspace_id = nil, direction = nil,
35
+ payment_type = nil, from_amount = nil, from_currency = nil,
36
+ to_amount = nil, to_currency = nil, risk_status = nil,
37
+ created_at = nil, updated_at = nil, expires_at = nil,
38
+ organization_reference_id = SKIP, source_account_id = SKIP,
39
+ originator_account_id = SKIP, beneficiary_account_id = SKIP,
40
+ from_network = SKIP, to_network = SKIP,
41
+ risk_status_reasons = SKIP, risk_reviewed_by = SKIP,
42
+ risk_reviewed_at = SKIP, balance_status = SKIP,
43
+ balance_reserved_at = SKIP, steps = SKIP)
44
+
45
+
46
+ # Call the constructor of the base class
47
+ super(id,
48
+ workspace_id,
49
+ direction,
50
+ payment_type,
51
+ from_amount,
52
+ from_currency,
53
+ to_amount,
54
+ to_currency,
55
+ risk_status,
56
+ created_at,
57
+ updated_at,
58
+ expires_at,
59
+ organization_reference_id,
60
+ source_account_id,
61
+ originator_account_id,
62
+ beneficiary_account_id,
63
+ from_network,
64
+ to_network,
65
+ risk_status_reasons,
66
+ risk_reviewed_by,
67
+ risk_reviewed_at,
68
+ balance_status,
69
+ balance_reserved_at,
70
+ steps)
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ id = hash.key?('id') ? hash['id'] : nil
79
+ workspace_id = hash.key?('workspace_id') ? hash['workspace_id'] : nil
80
+ direction = hash.key?('direction') ? hash['direction'] : nil
81
+ payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil
82
+ from_amount = hash.key?('from_amount') ? hash['from_amount'] : nil
83
+ from_currency = hash.key?('from_currency') ? hash['from_currency'] : nil
84
+ to_amount = hash.key?('to_amount') ? hash['to_amount'] : nil
85
+ to_currency = hash.key?('to_currency') ? hash['to_currency'] : nil
86
+ risk_status = hash.key?('risk_status') ? hash['risk_status'] : nil
87
+ created_at = if hash.key?('created_at')
88
+ (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
89
+ end
90
+ updated_at = if hash.key?('updated_at')
91
+ (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
92
+ end
93
+ expires_at = if hash.key?('expires_at')
94
+ (DateTimeHelper.from_rfc3339(hash['expires_at']) if hash['expires_at'])
95
+ end
96
+ organization_reference_id = hash.key?('organization_reference_id') ? APIHelper.deserialize_union_type(
97
+ UnionTypeLookUp.get(:PaymentOrganizationReferenceId), hash['organization_reference_id']
98
+ ) : SKIP
99
+ source_account_id = hash.key?('source_account_id') ? APIHelper.deserialize_union_type(
100
+ UnionTypeLookUp.get(:PaymentSourceAccountId), hash['source_account_id']
101
+ ) : SKIP
102
+ originator_account_id = hash.key?('originator_account_id') ? APIHelper.deserialize_union_type(
103
+ UnionTypeLookUp.get(:PaymentOriginatorAccountId), hash['originator_account_id']
104
+ ) : SKIP
105
+ beneficiary_account_id = hash.key?('beneficiary_account_id') ? APIHelper.deserialize_union_type(
106
+ UnionTypeLookUp.get(:PaymentBeneficiaryAccountId), hash['beneficiary_account_id']
107
+ ) : SKIP
108
+ from_network = hash.key?('from_network') ? APIHelper.deserialize_union_type(
109
+ UnionTypeLookUp.get(:PaymentFromNetwork), hash['from_network']
110
+ ) : SKIP
111
+ to_network = hash.key?('to_network') ? APIHelper.deserialize_union_type(
112
+ UnionTypeLookUp.get(:PaymentToNetwork), hash['to_network']
113
+ ) : SKIP
114
+ risk_status_reasons =
115
+ hash.key?('risk_status_reasons') ? hash['risk_status_reasons'] : SKIP
116
+ risk_reviewed_by = hash.key?('risk_reviewed_by') ? APIHelper.deserialize_union_type(
117
+ UnionTypeLookUp.get(:PaymentRiskReviewedBy), hash['risk_reviewed_by']
118
+ ) : SKIP
119
+ risk_reviewed_at = hash.key?('risk_reviewed_at') ? APIHelper.deserialize_union_type(
120
+ UnionTypeLookUp.get(:PaymentRiskReviewedAt), hash['risk_reviewed_at']
121
+ ) : SKIP
122
+ balance_status = hash.key?('balance_status') ? APIHelper.deserialize_union_type(
123
+ UnionTypeLookUp.get(:PaymentBalanceStatus), hash['balance_status']
124
+ ) : SKIP
125
+ balance_reserved_at = hash.key?('balance_reserved_at') ? APIHelper.deserialize_union_type(
126
+ UnionTypeLookUp.get(:PaymentBalanceReservedAt), hash['balance_reserved_at']
127
+ ) : SKIP
128
+ # Parameter is an array, so we need to iterate through it
129
+ steps = nil
130
+ unless hash['steps'].nil?
131
+ steps = []
132
+ hash['steps'].each do |structure|
133
+ steps << (Step.from_hash(structure) if structure)
134
+ end
135
+ end
136
+
137
+ steps = SKIP unless hash.key?('steps')
138
+
139
+ # Create object from extracted values.
140
+ Data6.new(id,
141
+ workspace_id,
142
+ direction,
143
+ payment_type,
144
+ from_amount,
145
+ from_currency,
146
+ to_amount,
147
+ to_currency,
148
+ risk_status,
149
+ created_at,
150
+ updated_at,
151
+ expires_at,
152
+ organization_reference_id,
153
+ source_account_id,
154
+ originator_account_id,
155
+ beneficiary_account_id,
156
+ from_network,
157
+ to_network,
158
+ risk_status_reasons,
159
+ risk_reviewed_by,
160
+ risk_reviewed_at,
161
+ balance_status,
162
+ balance_reserved_at,
163
+ steps)
164
+ end
165
+
166
+ # Validates an instance of the object from a given value.
167
+ # @param [Data6 | Hash] The value against the validation is performed.
168
+ def self.validate(value)
169
+ if value.instance_of? self
170
+ return (
171
+ APIHelper.valid_type?(value.id,
172
+ ->(val) { val.instance_of? String }) and
173
+ APIHelper.valid_type?(value.workspace_id,
174
+ ->(val) { val.instance_of? String }) and
175
+ APIHelper.valid_type?(value.direction,
176
+ ->(val) { DirectionEnum.validate(val) }) and
177
+ APIHelper.valid_type?(value.payment_type,
178
+ ->(val) { PaymentTypeEnum.validate(val) }) and
179
+ APIHelper.valid_type?(value.from_amount,
180
+ ->(val) { val.instance_of? String }) and
181
+ APIHelper.valid_type?(value.from_currency,
182
+ ->(val) { val.instance_of? String }) and
183
+ APIHelper.valid_type?(value.to_amount,
184
+ ->(val) { val.instance_of? String }) and
185
+ APIHelper.valid_type?(value.to_currency,
186
+ ->(val) { val.instance_of? String }) and
187
+ APIHelper.valid_type?(value.risk_status,
188
+ ->(val) { RiskStatusEnum.validate(val) }) and
189
+ APIHelper.valid_type?(value.created_at,
190
+ ->(val) { val.instance_of? DateTime }) and
191
+ APIHelper.valid_type?(value.updated_at,
192
+ ->(val) { val.instance_of? DateTime }) and
193
+ APIHelper.valid_type?(value.expires_at,
194
+ ->(val) { val.instance_of? DateTime })
195
+ )
196
+ end
197
+
198
+ return false unless value.instance_of? Hash
199
+
200
+ (
201
+ APIHelper.valid_type?(value['id'],
202
+ ->(val) { val.instance_of? String }) and
203
+ APIHelper.valid_type?(value['workspace_id'],
204
+ ->(val) { val.instance_of? String }) and
205
+ APIHelper.valid_type?(value['direction'],
206
+ ->(val) { DirectionEnum.validate(val) }) and
207
+ APIHelper.valid_type?(value['payment_type'],
208
+ ->(val) { PaymentTypeEnum.validate(val) }) and
209
+ APIHelper.valid_type?(value['from_amount'],
210
+ ->(val) { val.instance_of? String }) and
211
+ APIHelper.valid_type?(value['from_currency'],
212
+ ->(val) { val.instance_of? String }) and
213
+ APIHelper.valid_type?(value['to_amount'],
214
+ ->(val) { val.instance_of? String }) and
215
+ APIHelper.valid_type?(value['to_currency'],
216
+ ->(val) { val.instance_of? String }) and
217
+ APIHelper.valid_type?(value['risk_status'],
218
+ ->(val) { RiskStatusEnum.validate(val) }) and
219
+ APIHelper.valid_type?(value['created_at'],
220
+ ->(val) { val.instance_of? String }) and
221
+ APIHelper.valid_type?(value['updated_at'],
222
+ ->(val) { val.instance_of? String }) and
223
+ APIHelper.valid_type?(value['expires_at'],
224
+ ->(val) { val.instance_of? String })
225
+ )
226
+ end
227
+
228
+ # Provides a human-readable string representation of the object.
229
+ def to_s
230
+ class_name = self.class.name.split('::').last
231
+ super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
232
+ "<#{class_name} #{super_string}>"
233
+ end
234
+
235
+ # Provides a debugging-friendly string with detailed object information.
236
+ def inspect
237
+ class_name = self.class.name.split('::').last
238
+ super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
239
+ "<#{class_name} #{super_string}>"
240
+ end
241
+ end
242
+ end
@@ -0,0 +1,419 @@
1
+ # tesser_apiv1
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module TesserApiv1
8
+ # Data7 Model.
9
+ class Data7 < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Unique identifier for the payment
14
+ # @return [String]
15
+ attr_accessor :id
16
+
17
+ # Workspace ID the payment belongs to
18
+ # @return [String]
19
+ attr_accessor :workspace_id
20
+
21
+ # Optional external reference ID.
22
+ # @return [Object]
23
+ attr_accessor :organization_reference_id
24
+
25
+ # Payment direction: 'inbound', 'outbound', 'internal'
26
+ # @return [Direction1Enum]
27
+ attr_accessor :direction
28
+
29
+ # Type of payment operation: 'payment' (wallet-to-wallet), 'offramp'
30
+ # (crypto-to-fiat), 'onramp' (fiat-to-crypto), 'withdrawal', 'deposit', or
31
+ # 'transfer'.
32
+ # @return [PaymentTypeEnum]
33
+ attr_accessor :payment_type
34
+
35
+ # ID of the source account (paying wallet).
36
+ # @return [Object]
37
+ attr_accessor :source_account_id
38
+
39
+ # ID of the originator account.
40
+ # @return [Object]
41
+ attr_accessor :originator_account_id
42
+
43
+ # ID of the beneficiary account.
44
+ # @return [Object]
45
+ attr_accessor :beneficiary_account_id
46
+
47
+ # Amount to send.
48
+ # @return [String]
49
+ attr_accessor :from_amount
50
+
51
+ # Source currency code.
52
+ # @return [String]
53
+ attr_accessor :from_currency
54
+
55
+ # Source blockchain network.
56
+ # @return [Object]
57
+ attr_accessor :from_network
58
+
59
+ # Amount to receive.
60
+ # @return [String]
61
+ attr_accessor :to_amount
62
+
63
+ # Destination currency code.
64
+ # @return [String]
65
+ attr_accessor :to_currency
66
+
67
+ # Destination blockchain network.
68
+ # @return [Object]
69
+ attr_accessor :to_network
70
+
71
+ # Current risk status.
72
+ # @return [RiskStatusEnum]
73
+ attr_accessor :risk_status
74
+
75
+ # List of reasons for risk status.
76
+ # @return [Object]
77
+ attr_accessor :risk_status_reasons
78
+
79
+ # ID of the user who performed the risk review.
80
+ # @return [Object]
81
+ attr_accessor :risk_reviewed_by
82
+
83
+ # Timestamp of risk review.
84
+ # @return [Object]
85
+ attr_accessor :risk_reviewed_at
86
+
87
+ # Balance reservation status.
88
+ # @return [Object]
89
+ attr_accessor :balance_status
90
+
91
+ # Timestamp when balance was reserved.
92
+ # @return [Object]
93
+ attr_accessor :balance_reserved_at
94
+
95
+ # Optional list of system-generated steps that make up this payment/transfer
96
+ # route.
97
+ # @return [Array[Step]]
98
+ attr_accessor :steps
99
+
100
+ # ISO 8601 timestamp of creation.
101
+ # @return [DateTime]
102
+ attr_accessor :created_at
103
+
104
+ # ISO 8601 timestamp of last update.
105
+ # @return [DateTime]
106
+ attr_accessor :updated_at
107
+
108
+ # ISO 8601 timestamp when the quote expires.
109
+ # @return [DateTime]
110
+ attr_accessor :expires_at
111
+
112
+ # A mapping from model property names to API property names.
113
+ def self.names
114
+ @_hash = {} if @_hash.nil?
115
+ @_hash['id'] = 'id'
116
+ @_hash['workspace_id'] = 'workspace_id'
117
+ @_hash['organization_reference_id'] = 'organization_reference_id'
118
+ @_hash['direction'] = 'direction'
119
+ @_hash['payment_type'] = 'payment_type'
120
+ @_hash['source_account_id'] = 'source_account_id'
121
+ @_hash['originator_account_id'] = 'originator_account_id'
122
+ @_hash['beneficiary_account_id'] = 'beneficiary_account_id'
123
+ @_hash['from_amount'] = 'from_amount'
124
+ @_hash['from_currency'] = 'from_currency'
125
+ @_hash['from_network'] = 'from_network'
126
+ @_hash['to_amount'] = 'to_amount'
127
+ @_hash['to_currency'] = 'to_currency'
128
+ @_hash['to_network'] = 'to_network'
129
+ @_hash['risk_status'] = 'risk_status'
130
+ @_hash['risk_status_reasons'] = 'risk_status_reasons'
131
+ @_hash['risk_reviewed_by'] = 'risk_reviewed_by'
132
+ @_hash['risk_reviewed_at'] = 'risk_reviewed_at'
133
+ @_hash['balance_status'] = 'balance_status'
134
+ @_hash['balance_reserved_at'] = 'balance_reserved_at'
135
+ @_hash['steps'] = 'steps'
136
+ @_hash['created_at'] = 'created_at'
137
+ @_hash['updated_at'] = 'updated_at'
138
+ @_hash['expires_at'] = 'expires_at'
139
+ @_hash
140
+ end
141
+
142
+ # An array for optional fields
143
+ def self.optionals
144
+ %w[
145
+ organization_reference_id
146
+ source_account_id
147
+ originator_account_id
148
+ beneficiary_account_id
149
+ from_network
150
+ to_network
151
+ risk_status_reasons
152
+ risk_reviewed_by
153
+ risk_reviewed_at
154
+ balance_status
155
+ balance_reserved_at
156
+ steps
157
+ ]
158
+ end
159
+
160
+ # An array for nullable fields
161
+ def self.nullables
162
+ []
163
+ end
164
+
165
+ def initialize(id = nil, workspace_id = nil, direction = nil,
166
+ payment_type = nil, from_amount = nil, from_currency = nil,
167
+ to_amount = nil, to_currency = nil, risk_status = nil,
168
+ created_at = nil, updated_at = nil, expires_at = nil,
169
+ organization_reference_id = SKIP, source_account_id = SKIP,
170
+ originator_account_id = SKIP, beneficiary_account_id = SKIP,
171
+ from_network = SKIP, to_network = SKIP,
172
+ risk_status_reasons = SKIP, risk_reviewed_by = SKIP,
173
+ risk_reviewed_at = SKIP, balance_status = SKIP,
174
+ balance_reserved_at = SKIP, steps = SKIP)
175
+ @id = id
176
+ @workspace_id = workspace_id
177
+ unless organization_reference_id == SKIP
178
+ @organization_reference_id =
179
+ organization_reference_id
180
+ end
181
+ @direction = direction
182
+ @payment_type = payment_type
183
+ @source_account_id = source_account_id unless source_account_id == SKIP
184
+ @originator_account_id = originator_account_id unless originator_account_id == SKIP
185
+ @beneficiary_account_id = beneficiary_account_id unless beneficiary_account_id == SKIP
186
+ @from_amount = from_amount
187
+ @from_currency = from_currency
188
+ @from_network = from_network unless from_network == SKIP
189
+ @to_amount = to_amount
190
+ @to_currency = to_currency
191
+ @to_network = to_network unless to_network == SKIP
192
+ @risk_status = risk_status
193
+ @risk_status_reasons = risk_status_reasons unless risk_status_reasons == SKIP
194
+ @risk_reviewed_by = risk_reviewed_by unless risk_reviewed_by == SKIP
195
+ @risk_reviewed_at = risk_reviewed_at unless risk_reviewed_at == SKIP
196
+ @balance_status = balance_status unless balance_status == SKIP
197
+ @balance_reserved_at = balance_reserved_at unless balance_reserved_at == SKIP
198
+ @steps = steps unless steps == SKIP
199
+ @created_at = created_at
200
+ @updated_at = updated_at
201
+ @expires_at = expires_at
202
+ end
203
+
204
+ # Creates an instance of the object from a hash.
205
+ def self.from_hash(hash)
206
+ return nil unless hash
207
+
208
+ # Extract variables from the hash.
209
+ id = hash.key?('id') ? hash['id'] : nil
210
+ workspace_id = hash.key?('workspace_id') ? hash['workspace_id'] : nil
211
+ direction = hash.key?('direction') ? hash['direction'] : nil
212
+ payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil
213
+ from_amount = hash.key?('from_amount') ? hash['from_amount'] : nil
214
+ from_currency = hash.key?('from_currency') ? hash['from_currency'] : nil
215
+ to_amount = hash.key?('to_amount') ? hash['to_amount'] : nil
216
+ to_currency = hash.key?('to_currency') ? hash['to_currency'] : nil
217
+ risk_status = hash.key?('risk_status') ? hash['risk_status'] : nil
218
+ created_at = if hash.key?('created_at')
219
+ (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
220
+ end
221
+ updated_at = if hash.key?('updated_at')
222
+ (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
223
+ end
224
+ expires_at = if hash.key?('expires_at')
225
+ (DateTimeHelper.from_rfc3339(hash['expires_at']) if hash['expires_at'])
226
+ end
227
+ organization_reference_id = hash.key?('organization_reference_id') ? APIHelper.deserialize_union_type(
228
+ UnionTypeLookUp.get(:Data7OrganizationReferenceId), hash['organization_reference_id']
229
+ ) : SKIP
230
+ source_account_id = hash.key?('source_account_id') ? APIHelper.deserialize_union_type(
231
+ UnionTypeLookUp.get(:Data7SourceAccountId), hash['source_account_id']
232
+ ) : SKIP
233
+ originator_account_id = hash.key?('originator_account_id') ? APIHelper.deserialize_union_type(
234
+ UnionTypeLookUp.get(:Data7OriginatorAccountId), hash['originator_account_id']
235
+ ) : SKIP
236
+ beneficiary_account_id = hash.key?('beneficiary_account_id') ? APIHelper.deserialize_union_type(
237
+ UnionTypeLookUp.get(:Data7BeneficiaryAccountId), hash['beneficiary_account_id']
238
+ ) : SKIP
239
+ from_network = hash.key?('from_network') ? APIHelper.deserialize_union_type(
240
+ UnionTypeLookUp.get(:Data7FromNetwork), hash['from_network']
241
+ ) : SKIP
242
+ to_network = hash.key?('to_network') ? APIHelper.deserialize_union_type(
243
+ UnionTypeLookUp.get(:Data7ToNetwork), hash['to_network']
244
+ ) : SKIP
245
+ risk_status_reasons = hash.key?('risk_status_reasons') ? APIHelper.deserialize_union_type(
246
+ UnionTypeLookUp.get(:Data7RiskStatusReasons), hash['risk_status_reasons']
247
+ ) : SKIP
248
+ risk_reviewed_by = hash.key?('risk_reviewed_by') ? APIHelper.deserialize_union_type(
249
+ UnionTypeLookUp.get(:Data7RiskReviewedBy), hash['risk_reviewed_by']
250
+ ) : SKIP
251
+ risk_reviewed_at = hash.key?('risk_reviewed_at') ? APIHelper.deserialize_union_type(
252
+ UnionTypeLookUp.get(:Data7RiskReviewedAt), hash['risk_reviewed_at']
253
+ ) : SKIP
254
+ balance_status = hash.key?('balance_status') ? APIHelper.deserialize_union_type(
255
+ UnionTypeLookUp.get(:Data7BalanceStatus), hash['balance_status']
256
+ ) : SKIP
257
+ balance_reserved_at = hash.key?('balance_reserved_at') ? APIHelper.deserialize_union_type(
258
+ UnionTypeLookUp.get(:Data7BalanceReservedAt), hash['balance_reserved_at']
259
+ ) : SKIP
260
+ # Parameter is an array, so we need to iterate through it
261
+ steps = nil
262
+ unless hash['steps'].nil?
263
+ steps = []
264
+ hash['steps'].each do |structure|
265
+ steps << (Step.from_hash(structure) if structure)
266
+ end
267
+ end
268
+
269
+ steps = SKIP unless hash.key?('steps')
270
+
271
+ # Create object from extracted values.
272
+ Data7.new(id,
273
+ workspace_id,
274
+ direction,
275
+ payment_type,
276
+ from_amount,
277
+ from_currency,
278
+ to_amount,
279
+ to_currency,
280
+ risk_status,
281
+ created_at,
282
+ updated_at,
283
+ expires_at,
284
+ organization_reference_id,
285
+ source_account_id,
286
+ originator_account_id,
287
+ beneficiary_account_id,
288
+ from_network,
289
+ to_network,
290
+ risk_status_reasons,
291
+ risk_reviewed_by,
292
+ risk_reviewed_at,
293
+ balance_status,
294
+ balance_reserved_at,
295
+ steps)
296
+ end
297
+
298
+ def to_union_type_risk_reviewed_at
299
+ UnionTypeLookUp.get(:Data7RiskReviewedAt)
300
+ .validate(risk_reviewed_at)
301
+ .serialize(risk_reviewed_at)
302
+ end
303
+
304
+ def to_union_type_balance_reserved_at
305
+ UnionTypeLookUp.get(:Data7BalanceReservedAt)
306
+ .validate(balance_reserved_at)
307
+ .serialize(balance_reserved_at)
308
+ end
309
+
310
+ def to_custom_created_at
311
+ DateTimeHelper.to_rfc3339(created_at)
312
+ end
313
+
314
+ def to_custom_updated_at
315
+ DateTimeHelper.to_rfc3339(updated_at)
316
+ end
317
+
318
+ def to_custom_expires_at
319
+ DateTimeHelper.to_rfc3339(expires_at)
320
+ end
321
+
322
+ # Validates an instance of the object from a given value.
323
+ # @param [Data7 | Hash] The value against the validation is performed.
324
+ def self.validate(value)
325
+ if value.instance_of? self
326
+ return (
327
+ APIHelper.valid_type?(value.id,
328
+ ->(val) { val.instance_of? String }) and
329
+ APIHelper.valid_type?(value.workspace_id,
330
+ ->(val) { val.instance_of? String }) and
331
+ APIHelper.valid_type?(value.direction,
332
+ ->(val) { Direction1Enum.validate(val) }) and
333
+ APIHelper.valid_type?(value.payment_type,
334
+ ->(val) { PaymentTypeEnum.validate(val) }) and
335
+ APIHelper.valid_type?(value.from_amount,
336
+ ->(val) { val.instance_of? String }) and
337
+ APIHelper.valid_type?(value.from_currency,
338
+ ->(val) { val.instance_of? String }) and
339
+ APIHelper.valid_type?(value.to_amount,
340
+ ->(val) { val.instance_of? String }) and
341
+ APIHelper.valid_type?(value.to_currency,
342
+ ->(val) { val.instance_of? String }) and
343
+ APIHelper.valid_type?(value.risk_status,
344
+ ->(val) { RiskStatusEnum.validate(val) }) and
345
+ APIHelper.valid_type?(value.created_at,
346
+ ->(val) { val.instance_of? DateTime }) and
347
+ APIHelper.valid_type?(value.updated_at,
348
+ ->(val) { val.instance_of? DateTime }) and
349
+ APIHelper.valid_type?(value.expires_at,
350
+ ->(val) { val.instance_of? DateTime })
351
+ )
352
+ end
353
+
354
+ return false unless value.instance_of? Hash
355
+
356
+ (
357
+ APIHelper.valid_type?(value['id'],
358
+ ->(val) { val.instance_of? String }) and
359
+ APIHelper.valid_type?(value['workspace_id'],
360
+ ->(val) { val.instance_of? String }) and
361
+ APIHelper.valid_type?(value['direction'],
362
+ ->(val) { Direction1Enum.validate(val) }) and
363
+ APIHelper.valid_type?(value['payment_type'],
364
+ ->(val) { PaymentTypeEnum.validate(val) }) and
365
+ APIHelper.valid_type?(value['from_amount'],
366
+ ->(val) { val.instance_of? String }) and
367
+ APIHelper.valid_type?(value['from_currency'],
368
+ ->(val) { val.instance_of? String }) and
369
+ APIHelper.valid_type?(value['to_amount'],
370
+ ->(val) { val.instance_of? String }) and
371
+ APIHelper.valid_type?(value['to_currency'],
372
+ ->(val) { val.instance_of? String }) and
373
+ APIHelper.valid_type?(value['risk_status'],
374
+ ->(val) { RiskStatusEnum.validate(val) }) and
375
+ APIHelper.valid_type?(value['created_at'],
376
+ ->(val) { val.instance_of? String }) and
377
+ APIHelper.valid_type?(value['updated_at'],
378
+ ->(val) { val.instance_of? String }) and
379
+ APIHelper.valid_type?(value['expires_at'],
380
+ ->(val) { val.instance_of? String })
381
+ )
382
+ end
383
+
384
+ # Provides a human-readable string representation of the object.
385
+ def to_s
386
+ class_name = self.class.name.split('::').last
387
+ "<#{class_name} id: #{@id}, workspace_id: #{@workspace_id}, organization_reference_id:"\
388
+ " #{@organization_reference_id}, direction: #{@direction}, payment_type: #{@payment_type},"\
389
+ " source_account_id: #{@source_account_id}, originator_account_id:"\
390
+ " #{@originator_account_id}, beneficiary_account_id: #{@beneficiary_account_id},"\
391
+ " from_amount: #{@from_amount}, from_currency: #{@from_currency}, from_network:"\
392
+ " #{@from_network}, to_amount: #{@to_amount}, to_currency: #{@to_currency}, to_network:"\
393
+ " #{@to_network}, risk_status: #{@risk_status}, risk_status_reasons:"\
394
+ " #{@risk_status_reasons}, risk_reviewed_by: #{@risk_reviewed_by}, risk_reviewed_at:"\
395
+ " #{@risk_reviewed_at}, balance_status: #{@balance_status}, balance_reserved_at:"\
396
+ " #{@balance_reserved_at}, steps: #{@steps}, created_at: #{@created_at}, updated_at:"\
397
+ " #{@updated_at}, expires_at: #{@expires_at}>"
398
+ end
399
+
400
+ # Provides a debugging-friendly string with detailed object information.
401
+ def inspect
402
+ class_name = self.class.name.split('::').last
403
+ "<#{class_name} id: #{@id.inspect}, workspace_id: #{@workspace_id.inspect},"\
404
+ " organization_reference_id: #{@organization_reference_id.inspect}, direction:"\
405
+ " #{@direction.inspect}, payment_type: #{@payment_type.inspect}, source_account_id:"\
406
+ " #{@source_account_id.inspect}, originator_account_id: #{@originator_account_id.inspect},"\
407
+ " beneficiary_account_id: #{@beneficiary_account_id.inspect}, from_amount:"\
408
+ " #{@from_amount.inspect}, from_currency: #{@from_currency.inspect}, from_network:"\
409
+ " #{@from_network.inspect}, to_amount: #{@to_amount.inspect}, to_currency:"\
410
+ " #{@to_currency.inspect}, to_network: #{@to_network.inspect}, risk_status:"\
411
+ " #{@risk_status.inspect}, risk_status_reasons: #{@risk_status_reasons.inspect},"\
412
+ " risk_reviewed_by: #{@risk_reviewed_by.inspect}, risk_reviewed_at:"\
413
+ " #{@risk_reviewed_at.inspect}, balance_status: #{@balance_status.inspect},"\
414
+ " balance_reserved_at: #{@balance_reserved_at.inspect}, steps: #{@steps.inspect},"\
415
+ " created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, expires_at:"\
416
+ " #{@expires_at.inspect}>"
417
+ end
418
+ end
419
+ end