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