candidhealth 0.25.0 → 0.26.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/third_party_payer_payments/client.rb +30 -0
  3. data/lib/candidhealth/third_party_payer_payments/v_1/client.rb +360 -0
  4. data/lib/candidhealth/third_party_payer_payments/v_1/types/third_party_payer_payment.rb +138 -0
  5. data/lib/candidhealth/third_party_payer_payments/v_1/types/third_party_payer_payment_create.rb +124 -0
  6. data/lib/candidhealth/third_party_payer_payments/v_1/types/third_party_payer_payment_sort_field.rb +14 -0
  7. data/lib/candidhealth/third_party_payer_payments/v_1/types/third_party_payer_payments_page.rb +88 -0
  8. data/lib/candidhealth/third_party_payer_refunds/client.rb +30 -0
  9. data/lib/candidhealth/third_party_payer_refunds/v_1/client.rb +385 -0
  10. data/lib/candidhealth/third_party_payer_refunds/v_1/types/third_party_payer_refund.rb +139 -0
  11. data/lib/candidhealth/third_party_payer_refunds/v_1/types/third_party_payer_refund_create.rb +125 -0
  12. data/lib/candidhealth/third_party_payer_refunds/v_1/types/third_party_payer_refund_sort_field.rb +14 -0
  13. data/lib/candidhealth/third_party_payer_refunds/v_1/types/third_party_payer_refunds_page.rb +88 -0
  14. data/lib/candidhealth/third_party_payers/client.rb +30 -0
  15. data/lib/candidhealth/third_party_payers/v_1/client.rb +375 -0
  16. data/lib/candidhealth/third_party_payers/v_1/types/create_third_party_payer_request.rb +79 -0
  17. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer.rb +100 -0
  18. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer_category_update.rb +97 -0
  19. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer_description_update.rb +97 -0
  20. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer_page.rb +88 -0
  21. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer_sort_field.rb +16 -0
  22. data/lib/candidhealth/third_party_payers/v_1/types/third_party_payer_update_request.rb +92 -0
  23. data/lib/candidhealth/third_party_payers/v_1/types/toggle_third_party_payer_enablement_request.rb +61 -0
  24. data/lib/candidhealth.rb +21 -0
  25. data/lib/requests.rb +2 -2
  26. data/lib/types_export.rb +16 -0
  27. metadata +23 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 218a5d9b13ccba40aaa88b7b8b9053173ad1fcdbbe9c413fe9f62be90bbb8994
4
- data.tar.gz: 347c1ee3e5cbd30d80dc4123f24785f17346c4a861011f5142503ecf1c027ba5
3
+ metadata.gz: 4b53feca220d040d6be48d229853df8783efbfabbf1b403f71e7b162e39a0585
4
+ data.tar.gz: aac2f2a803035bec99d2ff1b05aaec6e750c5ed33384ebbf2c07ef18f7304ad2
5
5
  SHA512:
6
- metadata.gz: '086ea181fd2648a863006761aea50dcdc963ebc4ad5ad9f6c8ab5ef6ad7a172387ce0a13cb325a2ad0b6eec9b192ab65be125b1be59aefc400b05ac05f20ae68'
7
- data.tar.gz: a27a3d07c76e9a4cb331bc5aaa058b429a5f8c5215648966706724bfe9a3e7f62c0801d70a5b2294e1b1960987a9abe9e045082fa6b082667922021498b24474
6
+ metadata.gz: 4065d136f50e44143ba7e6ffb145653c1dc72b89c74b896b64561539dfd59a2f1a8f98401cac0e7790a0733f6469eeb1da96f26f17f09ca87f7cee938217ad7c
7
+ data.tar.gz: 64e15cb9346707b3ae514c875472914b44d35b49d48e9c26788b0dfdcf3c0761e0a670a601e63a5f33b22baf7273f9d5a88b63b2dd1e15613c83bf76eb17784b
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require_relative "v_1/client"
5
+
6
+ module CandidApiClient
7
+ module ThirdPartyPayerPayments
8
+ class Client
9
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::V1Client]
10
+ attr_reader :v_1
11
+
12
+ # @param request_client [CandidApiClient::RequestClient]
13
+ # @return [CandidApiClient::ThirdPartyPayerPayments::Client]
14
+ def initialize(request_client:)
15
+ @v_1 = CandidApiClient::ThirdPartyPayerPayments::V1::V1Client.new(request_client: request_client)
16
+ end
17
+ end
18
+
19
+ class AsyncClient
20
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::AsyncV1Client]
21
+ attr_reader :v_1
22
+
23
+ # @param request_client [CandidApiClient::AsyncRequestClient]
24
+ # @return [CandidApiClient::ThirdPartyPayerPayments::AsyncClient]
25
+ def initialize(request_client:)
26
+ @v_1 = CandidApiClient::ThirdPartyPayerPayments::V1::AsyncV1Client.new(request_client: request_client)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,360 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "types/third_party_payer_payment_sort_field"
5
+ require_relative "../../commons/types/sort_direction"
6
+ require_relative "types/third_party_payer_payments_page"
7
+ require_relative "types/third_party_payer_payment"
8
+ require_relative "types/third_party_payer_payment_create"
9
+ require "date"
10
+ require_relative "../../financials/types/note_update"
11
+ require_relative "../../financials/types/invoice_update"
12
+ require "async"
13
+
14
+ module CandidApiClient
15
+ module ThirdPartyPayerPayments
16
+ module V1
17
+ class V1Client
18
+ # @return [CandidApiClient::RequestClient]
19
+ attr_reader :request_client
20
+
21
+ # @param request_client [CandidApiClient::RequestClient]
22
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::V1Client]
23
+ def initialize(request_client:)
24
+ @request_client = request_client
25
+ end
26
+
27
+ # Returns all third party payer payments
28
+ #
29
+ # @param limit [Integer] Defaults to 100. The value must be greater than 0 and less than 1000.
30
+ # @param third_party_payer_id [String]
31
+ # @param check_number [String]
32
+ # @param invoice_id [String]
33
+ # @param sort [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentSortField] Defaults to refund_timestamp
34
+ # @param sort_direction [CandidApiClient::Commons::Types::SortDirection] Sort direction. Defaults to descending order if not provided.
35
+ # @param page_token [String]
36
+ # @param request_options [CandidApiClient::RequestOptions]
37
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentsPage]
38
+ # @example
39
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
40
+ # api.third_party_payer_payments.v_1.get_multi(
41
+ # limit: 1,
42
+ # third_party_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
43
+ # check_number: "string",
44
+ # invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
45
+ # sort: AMOUNT_CENTS,
46
+ # sort_direction: ASC,
47
+ # page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9"
48
+ # )
49
+ def get_multi(limit: nil, third_party_payer_id: nil, check_number: nil, invoice_id: nil, sort: nil,
50
+ sort_direction: nil, page_token: nil, request_options: nil)
51
+ response = @request_client.conn.get do |req|
52
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
53
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
54
+ req.headers = {
55
+ **(req.headers || {}),
56
+ **@request_client.get_headers,
57
+ **(request_options&.additional_headers || {})
58
+ }.compact
59
+ req.params = {
60
+ **(request_options&.additional_query_parameters || {}),
61
+ "limit": limit,
62
+ "third_party_payer_id": third_party_payer_id,
63
+ "check_number": check_number,
64
+ "invoice_id": invoice_id,
65
+ "sort": sort,
66
+ "sort_direction": sort_direction,
67
+ "page_token": page_token
68
+ }.compact
69
+ req.url "#{@request_client.get_url(environment: CandidApi,
70
+ request_options: request_options)}/api/third-party-payer-payments/v1"
71
+ end
72
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentsPage.from_json(json_object: response.body)
73
+ end
74
+
75
+ # Retrieves a previously created third party payer payment by its
76
+ # `third_party_payer_payment_id`.
77
+ #
78
+ # @param third_party_payer_payment_id [String]
79
+ # @param request_options [CandidApiClient::RequestOptions]
80
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
81
+ # @example
82
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
83
+ # api.third_party_payer_payments.v_1.get(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
84
+ def get(third_party_payer_payment_id:, request_options: nil)
85
+ response = @request_client.conn.get do |req|
86
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
87
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
88
+ req.headers = {
89
+ **(req.headers || {}),
90
+ **@request_client.get_headers,
91
+ **(request_options&.additional_headers || {})
92
+ }.compact
93
+ req.url "#{@request_client.get_url(environment: CandidApi,
94
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
95
+ end
96
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
97
+ end
98
+
99
+ # @param request [Hash] Request of type CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentCreate, as a Hash
100
+ # * :third_party_payer_id (String)
101
+ # * :amount_cents (Integer)
102
+ # * :payment_timestamp (DateTime)
103
+ # * :payment_note (String)
104
+ # * :check_number (String)
105
+ # * :allocations (Array<CandidApiClient::Financials::Types::AllocationCreate>)
106
+ # * :invoice_id (String)
107
+ # @param request_options [CandidApiClient::RequestOptions]
108
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
109
+ # @example
110
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
111
+ # api.third_party_payer_payments.v_1.create(request: { third_party_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
112
+ def create(request:, request_options: nil)
113
+ response = @request_client.conn.post do |req|
114
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
115
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
116
+ req.headers = {
117
+ **(req.headers || {}),
118
+ **@request_client.get_headers,
119
+ **(request_options&.additional_headers || {})
120
+ }.compact
121
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
122
+ req.url "#{@request_client.get_url(environment: CandidApi,
123
+ request_options: request_options)}/api/third-party-payer-payments/v1"
124
+ end
125
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
126
+ end
127
+
128
+ # @param third_party_payer_payment_id [String]
129
+ # @param payment_timestamp [DateTime]
130
+ # @param payment_note [CandidApiClient::Financials::Types::NoteUpdate]
131
+ # @param invoice_id [CandidApiClient::Financials::Types::InvoiceUpdate]
132
+ # @param request_options [CandidApiClient::RequestOptions]
133
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
134
+ # @example
135
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
136
+ # api.third_party_payer_payments.v_1.update(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z))
137
+ def update(third_party_payer_payment_id:, payment_timestamp: nil, payment_note: nil, invoice_id: nil,
138
+ request_options: nil)
139
+ response = @request_client.conn.patch do |req|
140
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
141
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
142
+ req.headers = {
143
+ **(req.headers || {}),
144
+ **@request_client.get_headers,
145
+ **(request_options&.additional_headers || {})
146
+ }.compact
147
+ req.body = {
148
+ **(request_options&.additional_body_parameters || {}),
149
+ payment_timestamp: payment_timestamp,
150
+ payment_note: payment_note,
151
+ invoice_id: invoice_id
152
+ }.compact
153
+ req.url "#{@request_client.get_url(environment: CandidApi,
154
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
155
+ end
156
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
157
+ end
158
+
159
+ # Deletes the third party payer payment record matching the provided
160
+ # `third_party_payer_payment_id`.
161
+ #
162
+ # @param third_party_payer_payment_id [String]
163
+ # @param request_options [CandidApiClient::RequestOptions]
164
+ # @return [Void]
165
+ # @example
166
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
167
+ # api.third_party_payer_payments.v_1.delete(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
168
+ def delete(third_party_payer_payment_id:, request_options: nil)
169
+ @request_client.conn.delete do |req|
170
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
171
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
172
+ req.headers = {
173
+ **(req.headers || {}),
174
+ **@request_client.get_headers,
175
+ **(request_options&.additional_headers || {})
176
+ }.compact
177
+ req.url "#{@request_client.get_url(environment: CandidApi,
178
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
179
+ end
180
+ end
181
+ end
182
+
183
+ class AsyncV1Client
184
+ # @return [CandidApiClient::AsyncRequestClient]
185
+ attr_reader :request_client
186
+
187
+ # @param request_client [CandidApiClient::AsyncRequestClient]
188
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::AsyncV1Client]
189
+ def initialize(request_client:)
190
+ @request_client = request_client
191
+ end
192
+
193
+ # Returns all third party payer payments
194
+ #
195
+ # @param limit [Integer] Defaults to 100. The value must be greater than 0 and less than 1000.
196
+ # @param third_party_payer_id [String]
197
+ # @param check_number [String]
198
+ # @param invoice_id [String]
199
+ # @param sort [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentSortField] Defaults to refund_timestamp
200
+ # @param sort_direction [CandidApiClient::Commons::Types::SortDirection] Sort direction. Defaults to descending order if not provided.
201
+ # @param page_token [String]
202
+ # @param request_options [CandidApiClient::RequestOptions]
203
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentsPage]
204
+ # @example
205
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
206
+ # api.third_party_payer_payments.v_1.get_multi(
207
+ # limit: 1,
208
+ # third_party_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
209
+ # check_number: "string",
210
+ # invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
211
+ # sort: AMOUNT_CENTS,
212
+ # sort_direction: ASC,
213
+ # page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9"
214
+ # )
215
+ def get_multi(limit: nil, third_party_payer_id: nil, check_number: nil, invoice_id: nil, sort: nil,
216
+ sort_direction: nil, page_token: nil, request_options: nil)
217
+ Async do
218
+ response = @request_client.conn.get do |req|
219
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
220
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
221
+ req.headers = {
222
+ **(req.headers || {}),
223
+ **@request_client.get_headers,
224
+ **(request_options&.additional_headers || {})
225
+ }.compact
226
+ req.params = {
227
+ **(request_options&.additional_query_parameters || {}),
228
+ "limit": limit,
229
+ "third_party_payer_id": third_party_payer_id,
230
+ "check_number": check_number,
231
+ "invoice_id": invoice_id,
232
+ "sort": sort,
233
+ "sort_direction": sort_direction,
234
+ "page_token": page_token
235
+ }.compact
236
+ req.url "#{@request_client.get_url(environment: CandidApi,
237
+ request_options: request_options)}/api/third-party-payer-payments/v1"
238
+ end
239
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentsPage.from_json(json_object: response.body)
240
+ end
241
+ end
242
+
243
+ # Retrieves a previously created third party payer payment by its
244
+ # `third_party_payer_payment_id`.
245
+ #
246
+ # @param third_party_payer_payment_id [String]
247
+ # @param request_options [CandidApiClient::RequestOptions]
248
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
249
+ # @example
250
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
251
+ # api.third_party_payer_payments.v_1.get(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
252
+ def get(third_party_payer_payment_id:, request_options: nil)
253
+ Async do
254
+ response = @request_client.conn.get do |req|
255
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
256
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
257
+ req.headers = {
258
+ **(req.headers || {}),
259
+ **@request_client.get_headers,
260
+ **(request_options&.additional_headers || {})
261
+ }.compact
262
+ req.url "#{@request_client.get_url(environment: CandidApi,
263
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
264
+ end
265
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
266
+ end
267
+ end
268
+
269
+ # @param request [Hash] Request of type CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentCreate, as a Hash
270
+ # * :third_party_payer_id (String)
271
+ # * :amount_cents (Integer)
272
+ # * :payment_timestamp (DateTime)
273
+ # * :payment_note (String)
274
+ # * :check_number (String)
275
+ # * :allocations (Array<CandidApiClient::Financials::Types::AllocationCreate>)
276
+ # * :invoice_id (String)
277
+ # @param request_options [CandidApiClient::RequestOptions]
278
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
279
+ # @example
280
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
281
+ # api.third_party_payer_payments.v_1.create(request: { third_party_payer_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", amount_cents: 1, payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), payment_note: "string", check_number: "string", allocations: [{ }], invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" })
282
+ def create(request:, request_options: nil)
283
+ Async do
284
+ response = @request_client.conn.post do |req|
285
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
286
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
287
+ req.headers = {
288
+ **(req.headers || {}),
289
+ **@request_client.get_headers,
290
+ **(request_options&.additional_headers || {})
291
+ }.compact
292
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
293
+ req.url "#{@request_client.get_url(environment: CandidApi,
294
+ request_options: request_options)}/api/third-party-payer-payments/v1"
295
+ end
296
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
297
+ end
298
+ end
299
+
300
+ # @param third_party_payer_payment_id [String]
301
+ # @param payment_timestamp [DateTime]
302
+ # @param payment_note [CandidApiClient::Financials::Types::NoteUpdate]
303
+ # @param invoice_id [CandidApiClient::Financials::Types::InvoiceUpdate]
304
+ # @param request_options [CandidApiClient::RequestOptions]
305
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
306
+ # @example
307
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
308
+ # api.third_party_payer_payments.v_1.update(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", payment_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z))
309
+ def update(third_party_payer_payment_id:, payment_timestamp: nil, payment_note: nil, invoice_id: nil,
310
+ request_options: nil)
311
+ Async do
312
+ response = @request_client.conn.patch do |req|
313
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
314
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
315
+ req.headers = {
316
+ **(req.headers || {}),
317
+ **@request_client.get_headers,
318
+ **(request_options&.additional_headers || {})
319
+ }.compact
320
+ req.body = {
321
+ **(request_options&.additional_body_parameters || {}),
322
+ payment_timestamp: payment_timestamp,
323
+ payment_note: payment_note,
324
+ invoice_id: invoice_id
325
+ }.compact
326
+ req.url "#{@request_client.get_url(environment: CandidApi,
327
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
328
+ end
329
+ CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment.from_json(json_object: response.body)
330
+ end
331
+ end
332
+
333
+ # Deletes the third party payer payment record matching the provided
334
+ # `third_party_payer_payment_id`.
335
+ #
336
+ # @param third_party_payer_payment_id [String]
337
+ # @param request_options [CandidApiClient::RequestOptions]
338
+ # @return [Void]
339
+ # @example
340
+ # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
341
+ # api.third_party_payer_payments.v_1.delete(third_party_payer_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
342
+ def delete(third_party_payer_payment_id:, request_options: nil)
343
+ Async do
344
+ @request_client.conn.delete do |req|
345
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
346
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
347
+ req.headers = {
348
+ **(req.headers || {}),
349
+ **@request_client.get_headers,
350
+ **(request_options&.additional_headers || {})
351
+ }.compact
352
+ req.url "#{@request_client.get_url(environment: CandidApi,
353
+ request_options: request_options)}/api/third-party-payer-payments/v1/#{third_party_payer_payment_id}"
354
+ end
355
+ end
356
+ end
357
+ end
358
+ end
359
+ end
360
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../third_party_payers/v_1/types/third_party_payer"
4
+ require "date"
5
+ require_relative "../../../financials/types/allocation"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module CandidApiClient
10
+ module ThirdPartyPayerPayments
11
+ module V1
12
+ module Types
13
+ class ThirdPartyPayerPayment
14
+ # @return [String]
15
+ attr_reader :third_party_payer_payment_id
16
+ # @return [CandidApiClient::ThirdPartyPayers::V1::Types::ThirdPartyPayer]
17
+ attr_reader :third_party_payer
18
+ # @return [Integer]
19
+ attr_reader :amount_cents
20
+ # @return [String]
21
+ attr_reader :check_number
22
+ # @return [DateTime]
23
+ attr_reader :payment_timestamp
24
+ # @return [String]
25
+ attr_reader :payment_note
26
+ # @return [Array<CandidApiClient::Financials::Types::Allocation>]
27
+ attr_reader :allocations
28
+ # @return [String]
29
+ attr_reader :invoice_id
30
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
31
+ attr_reader :additional_properties
32
+ # @return [Object]
33
+ attr_reader :_field_set
34
+ protected :_field_set
35
+
36
+ OMIT = Object.new
37
+
38
+ # @param third_party_payer_payment_id [String]
39
+ # @param third_party_payer [CandidApiClient::ThirdPartyPayers::V1::Types::ThirdPartyPayer]
40
+ # @param amount_cents [Integer]
41
+ # @param check_number [String]
42
+ # @param payment_timestamp [DateTime]
43
+ # @param payment_note [String]
44
+ # @param allocations [Array<CandidApiClient::Financials::Types::Allocation>]
45
+ # @param invoice_id [String]
46
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
47
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
48
+ def initialize(third_party_payer_payment_id:, third_party_payer:, amount_cents:, allocations:, check_number: OMIT,
49
+ payment_timestamp: OMIT, payment_note: OMIT, invoice_id: OMIT, additional_properties: nil)
50
+ @third_party_payer_payment_id = third_party_payer_payment_id
51
+ @third_party_payer = third_party_payer
52
+ @amount_cents = amount_cents
53
+ @check_number = check_number if check_number != OMIT
54
+ @payment_timestamp = payment_timestamp if payment_timestamp != OMIT
55
+ @payment_note = payment_note if payment_note != OMIT
56
+ @allocations = allocations
57
+ @invoice_id = invoice_id if invoice_id != OMIT
58
+ @additional_properties = additional_properties
59
+ @_field_set = {
60
+ "third_party_payer_payment_id": third_party_payer_payment_id,
61
+ "third_party_payer": third_party_payer,
62
+ "amount_cents": amount_cents,
63
+ "check_number": check_number,
64
+ "payment_timestamp": payment_timestamp,
65
+ "payment_note": payment_note,
66
+ "allocations": allocations,
67
+ "invoice_id": invoice_id
68
+ }.reject do |_k, v|
69
+ v == OMIT
70
+ end
71
+ end
72
+
73
+ # Deserialize a JSON object to an instance of ThirdPartyPayerPayment
74
+ #
75
+ # @param json_object [String]
76
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPayment]
77
+ def self.from_json(json_object:)
78
+ struct = JSON.parse(json_object, object_class: OpenStruct)
79
+ parsed_json = JSON.parse(json_object)
80
+ third_party_payer_payment_id = struct["third_party_payer_payment_id"]
81
+ if parsed_json["third_party_payer"].nil?
82
+ third_party_payer = nil
83
+ else
84
+ third_party_payer = parsed_json["third_party_payer"].to_json
85
+ third_party_payer = CandidApiClient::ThirdPartyPayers::V1::Types::ThirdPartyPayer.from_json(json_object: third_party_payer)
86
+ end
87
+ amount_cents = struct["amount_cents"]
88
+ check_number = struct["check_number"]
89
+ payment_timestamp = unless parsed_json["payment_timestamp"].nil?
90
+ DateTime.parse(parsed_json["payment_timestamp"])
91
+ end
92
+ payment_note = struct["payment_note"]
93
+ allocations = parsed_json["allocations"]&.map do |item|
94
+ item = item.to_json
95
+ CandidApiClient::Financials::Types::Allocation.from_json(json_object: item)
96
+ end
97
+ invoice_id = struct["invoice_id"]
98
+ new(
99
+ third_party_payer_payment_id: third_party_payer_payment_id,
100
+ third_party_payer: third_party_payer,
101
+ amount_cents: amount_cents,
102
+ check_number: check_number,
103
+ payment_timestamp: payment_timestamp,
104
+ payment_note: payment_note,
105
+ allocations: allocations,
106
+ invoice_id: invoice_id,
107
+ additional_properties: struct
108
+ )
109
+ end
110
+
111
+ # Serialize an instance of ThirdPartyPayerPayment to a JSON object
112
+ #
113
+ # @return [String]
114
+ def to_json(*_args)
115
+ @_field_set&.to_json
116
+ end
117
+
118
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
119
+ # hash and check each fields type against the current object's property
120
+ # definitions.
121
+ #
122
+ # @param obj [Object]
123
+ # @return [Void]
124
+ def self.validate_raw(obj:)
125
+ obj.third_party_payer_payment_id.is_a?(String) != false || raise("Passed value for field obj.third_party_payer_payment_id is not the expected type, validation failed.")
126
+ CandidApiClient::ThirdPartyPayers::V1::Types::ThirdPartyPayer.validate_raw(obj: obj.third_party_payer)
127
+ obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.")
128
+ obj.check_number&.is_a?(String) != false || raise("Passed value for field obj.check_number is not the expected type, validation failed.")
129
+ obj.payment_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.payment_timestamp is not the expected type, validation failed.")
130
+ obj.payment_note&.is_a?(String) != false || raise("Passed value for field obj.payment_note is not the expected type, validation failed.")
131
+ obj.allocations.is_a?(Array) != false || raise("Passed value for field obj.allocations is not the expected type, validation failed.")
132
+ obj.invoice_id&.is_a?(String) != false || raise("Passed value for field obj.invoice_id is not the expected type, validation failed.")
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require_relative "../../../financials/types/allocation_create"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module CandidApiClient
9
+ module ThirdPartyPayerPayments
10
+ module V1
11
+ module Types
12
+ class ThirdPartyPayerPaymentCreate
13
+ # @return [String]
14
+ attr_reader :third_party_payer_id
15
+ # @return [Integer]
16
+ attr_reader :amount_cents
17
+ # @return [DateTime]
18
+ attr_reader :payment_timestamp
19
+ # @return [String]
20
+ attr_reader :payment_note
21
+ # @return [String]
22
+ attr_reader :check_number
23
+ # @return [Array<CandidApiClient::Financials::Types::AllocationCreate>]
24
+ attr_reader :allocations
25
+ # @return [String]
26
+ attr_reader :invoice_id
27
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
28
+ attr_reader :additional_properties
29
+ # @return [Object]
30
+ attr_reader :_field_set
31
+ protected :_field_set
32
+
33
+ OMIT = Object.new
34
+
35
+ # @param third_party_payer_id [String]
36
+ # @param amount_cents [Integer]
37
+ # @param payment_timestamp [DateTime]
38
+ # @param payment_note [String]
39
+ # @param check_number [String]
40
+ # @param allocations [Array<CandidApiClient::Financials::Types::AllocationCreate>]
41
+ # @param invoice_id [String]
42
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
43
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentCreate]
44
+ def initialize(third_party_payer_id:, amount_cents:, allocations:, payment_timestamp: OMIT, payment_note: OMIT,
45
+ check_number: OMIT, invoice_id: OMIT, additional_properties: nil)
46
+ @third_party_payer_id = third_party_payer_id
47
+ @amount_cents = amount_cents
48
+ @payment_timestamp = payment_timestamp if payment_timestamp != OMIT
49
+ @payment_note = payment_note if payment_note != OMIT
50
+ @check_number = check_number if check_number != OMIT
51
+ @allocations = allocations
52
+ @invoice_id = invoice_id if invoice_id != OMIT
53
+ @additional_properties = additional_properties
54
+ @_field_set = {
55
+ "third_party_payer_id": third_party_payer_id,
56
+ "amount_cents": amount_cents,
57
+ "payment_timestamp": payment_timestamp,
58
+ "payment_note": payment_note,
59
+ "check_number": check_number,
60
+ "allocations": allocations,
61
+ "invoice_id": invoice_id
62
+ }.reject do |_k, v|
63
+ v == OMIT
64
+ end
65
+ end
66
+
67
+ # Deserialize a JSON object to an instance of ThirdPartyPayerPaymentCreate
68
+ #
69
+ # @param json_object [String]
70
+ # @return [CandidApiClient::ThirdPartyPayerPayments::V1::Types::ThirdPartyPayerPaymentCreate]
71
+ def self.from_json(json_object:)
72
+ struct = JSON.parse(json_object, object_class: OpenStruct)
73
+ parsed_json = JSON.parse(json_object)
74
+ third_party_payer_id = struct["third_party_payer_id"]
75
+ amount_cents = struct["amount_cents"]
76
+ payment_timestamp = unless parsed_json["payment_timestamp"].nil?
77
+ DateTime.parse(parsed_json["payment_timestamp"])
78
+ end
79
+ payment_note = struct["payment_note"]
80
+ check_number = struct["check_number"]
81
+ allocations = parsed_json["allocations"]&.map do |item|
82
+ item = item.to_json
83
+ CandidApiClient::Financials::Types::AllocationCreate.from_json(json_object: item)
84
+ end
85
+ invoice_id = struct["invoice_id"]
86
+ new(
87
+ third_party_payer_id: third_party_payer_id,
88
+ amount_cents: amount_cents,
89
+ payment_timestamp: payment_timestamp,
90
+ payment_note: payment_note,
91
+ check_number: check_number,
92
+ allocations: allocations,
93
+ invoice_id: invoice_id,
94
+ additional_properties: struct
95
+ )
96
+ end
97
+
98
+ # Serialize an instance of ThirdPartyPayerPaymentCreate to a JSON object
99
+ #
100
+ # @return [String]
101
+ def to_json(*_args)
102
+ @_field_set&.to_json
103
+ end
104
+
105
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
106
+ # hash and check each fields type against the current object's property
107
+ # definitions.
108
+ #
109
+ # @param obj [Object]
110
+ # @return [Void]
111
+ def self.validate_raw(obj:)
112
+ obj.third_party_payer_id.is_a?(String) != false || raise("Passed value for field obj.third_party_payer_id is not the expected type, validation failed.")
113
+ obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.")
114
+ obj.payment_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.payment_timestamp is not the expected type, validation failed.")
115
+ obj.payment_note&.is_a?(String) != false || raise("Passed value for field obj.payment_note is not the expected type, validation failed.")
116
+ obj.check_number&.is_a?(String) != false || raise("Passed value for field obj.check_number is not the expected type, validation failed.")
117
+ obj.allocations.is_a?(Array) != false || raise("Passed value for field obj.allocations is not the expected type, validation failed.")
118
+ obj.invoice_id&.is_a?(String) != false || raise("Passed value for field obj.invoice_id is not the expected type, validation failed.")
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end