payabli 3.0.7 → 3.0.8
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/.fern/metadata.json +7 -6
- data/lib/payabli/bill/client.rb +8 -2
- data/lib/payabli/billing/client.rb +129 -0
- data/lib/payabli/billing/types/get_profile_billing_request_entity_type.rb +16 -0
- data/lib/payabli/billing/types/get_profile_billing_request_service_group.rb +14 -0
- data/lib/payabli/billing/types/list_billing_profiles_request.rb +23 -0
- data/lib/payabli/boarding/client.rb +4 -1
- data/lib/payabli/client.rb +6 -1
- data/lib/payabli/customer/client.rb +4 -1
- data/lib/payabli/hosted_payment_pages/client.rb +4 -1
- data/lib/payabli/internal/http/raw_client.rb +15 -2
- data/lib/payabli/internal/json/request.rb +7 -5
- data/lib/payabli/line_item/client.rb +4 -1
- data/lib/payabli/money_in/client.rb +55 -8
- data/lib/payabli/notification/client.rb +8 -5
- data/lib/payabli/ocr/client.rb +8 -2
- data/lib/payabli/organization/client.rb +5 -5
- data/lib/payabli/organization/types/organization_data.rb +2 -2
- data/lib/payabli/payment_link/client.rb +8 -2
- data/lib/payabli/paypoint/client.rb +4 -1
- data/lib/payabli/types/auth_capture_payout_response_data.rb +1 -1
- data/lib/payabli/types/billable_event.rb +29 -0
- data/lib/payabli/types/billing_entity.rb +13 -0
- data/lib/payabli/types/billing_entity_named.rb +13 -0
- data/lib/payabli/types/billing_profile_query_response.rb +14 -0
- data/lib/payabli/types/billing_profile_record.rb +32 -0
- data/lib/payabli/types/billing_profile_response.rb +31 -0
- data/lib/payabli/types/billing_profile_summary.rb +16 -0
- data/lib/payabli/types/collection_schedule_value.rb +23 -0
- data/lib/payabli/types/device_query_record.rb +8 -0
- data/lib/payabli/types/entities_assigned.rb +17 -0
- data/lib/payabli/types/entity_type_name.rb +17 -0
- data/lib/payabli/types/entity_type_value.rb +23 -0
- data/lib/payabli/types/event_group_value.rb +23 -0
- data/lib/payabli/types/event_source_value.rb +23 -0
- data/lib/payabli/types/event_type_value.rb +23 -0
- data/lib/payabli/types/fee_schedule.rb +47 -0
- data/lib/payabli/types/fee_type_name.rb +12 -0
- data/lib/payabli/types/fee_type_value.rb +23 -0
- data/lib/payabli/types/passthrough_value.rb +23 -0
- data/lib/payabli/types/query_payout_transaction_records_item.rb +2 -0
- data/lib/payabli/types/query_payout_transaction_records_item_allowed_actions_item.rb +13 -0
- data/lib/payabli/types/region_type_value.rb +23 -0
- data/lib/payabli/types/service_group_value.rb +23 -0
- data/lib/payabli/types/service_type_value.rb +23 -0
- data/lib/payabli/types/service_value.rb +23 -0
- data/lib/payabli/types/service_vertical_name.rb +13 -0
- data/lib/payabli/user/client.rb +8 -2
- data/lib/payabli/vendor/client.rb +8 -2
- data/lib/payabli/version.rb +1 -1
- data/lib/payabli.rb +28 -0
- data/reference.md +552 -417
- data/wiremock/wiremock-mappings.json +85 -9
- metadata +30 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cea61d10b3cafacb06c10380c78c3614ef5567afe7daeca9b59b6395da35140
|
|
4
|
+
data.tar.gz: 2583dd669a4c9927bbd4d70cde26346ae9fc8767e1cffe63e51392cc377305e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c9f0e871ea5bea7767c60a3adc6a3aef47e847288bf9a956500219b65e11f5154a826ecc67f8a52d017e01a3258fb945b7ae4cd22370a7cb02de6c719f363f1
|
|
7
|
+
data.tar.gz: f2bea200f260b7ab5b473647131f29711b24bee0cf42cb9ebffbb73a45a4895b4ff4c7271a3f97437e45317e583b288b54d1d212905af8fe2af9ab760dd2873f
|
data/.fern/metadata.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cliVersion": "5.
|
|
2
|
+
"cliVersion": "5.95.1",
|
|
3
3
|
"generatorName": "fernapi/fern-ruby-sdk",
|
|
4
|
-
"generatorVersion": "1.
|
|
4
|
+
"generatorVersion": "1.23.0",
|
|
5
5
|
"generatorConfig": {
|
|
6
6
|
"enableWireTests": true,
|
|
7
|
-
"rubocopVariableNumberStyle": "snake_case"
|
|
7
|
+
"rubocopVariableNumberStyle": "snake_case",
|
|
8
|
+
"respectOptionalRequestBody": true
|
|
8
9
|
},
|
|
9
|
-
"originGitCommit": "
|
|
10
|
+
"originGitCommit": "c0d928adb5a06dd2f0f02ec1e68e0159c230e3b6",
|
|
10
11
|
"originGitCommitIsDirty": true,
|
|
11
12
|
"invokedBy": "ci",
|
|
12
|
-
"requestedVersion": "3.0.
|
|
13
|
+
"requestedVersion": "3.0.8",
|
|
13
14
|
"ciProvider": "github",
|
|
14
|
-
"sdkVersion": "3.0.
|
|
15
|
+
"sdkVersion": "3.0.8"
|
|
15
16
|
}
|
data/lib/payabli/bill/client.rb
CHANGED
|
@@ -152,13 +152,16 @@ module Payabli
|
|
|
152
152
|
# @return [Payabli::Types::EditBillResponse]
|
|
153
153
|
def edit_bill(request_options: {}, **params)
|
|
154
154
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
155
|
+
path_param_names = %i[id_bill]
|
|
156
|
+
body_params = params.except(*path_param_names)
|
|
157
|
+
|
|
155
158
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
156
159
|
request = Payabli::Internal::JSON::Request.new(
|
|
157
160
|
base_url: request_options[:base_url],
|
|
158
161
|
method: "PUT",
|
|
159
162
|
path: "Bill/#{URI.encode_uri_component(params[:id_bill].to_s)}",
|
|
160
163
|
headers: headers,
|
|
161
|
-
body: Payabli::Types::BillOutData.new(
|
|
164
|
+
body: Payabli::Types::BillOutData.new(body_params).to_h,
|
|
162
165
|
request_options: request_options
|
|
163
166
|
)
|
|
164
167
|
begin
|
|
@@ -389,13 +392,16 @@ module Payabli
|
|
|
389
392
|
# @return [Payabli::Types::ModifyApprovalBillResponse]
|
|
390
393
|
def modify_approval_bill(request_options: {}, **params)
|
|
391
394
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
395
|
+
path_param_names = %i[id_bill]
|
|
396
|
+
body_params = params.except(*path_param_names)
|
|
397
|
+
|
|
392
398
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
393
399
|
request = Payabli::Internal::JSON::Request.new(
|
|
394
400
|
base_url: request_options[:base_url],
|
|
395
401
|
method: "PUT",
|
|
396
402
|
path: "Bill/approval/#{URI.encode_uri_component(params[:id_bill].to_s)}",
|
|
397
403
|
headers: headers,
|
|
398
|
-
body:
|
|
404
|
+
body: body_params,
|
|
399
405
|
request_options: request_options
|
|
400
406
|
)
|
|
401
407
|
begin
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Billing
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Payabli::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Returns every billing profile that belongs to an organization. This is
|
|
14
|
+
# the data behind the Profile Library table in the Payabli Portal.
|
|
15
|
+
#
|
|
16
|
+
# Requires a token with the `billing_profile_read` permission; a token
|
|
17
|
+
# without it gets `403 Forbidden`.
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [Hash]
|
|
20
|
+
# @param params [Hash]
|
|
21
|
+
# @option request_options [String] :base_url
|
|
22
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
23
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
24
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
25
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
26
|
+
# @option params [Integer] :org_id
|
|
27
|
+
# @option params [String, nil] :profile_name
|
|
28
|
+
# @option params [Integer, nil] :fee_type
|
|
29
|
+
# @option params [Integer, nil] :service_vertical
|
|
30
|
+
# @option params [Integer, nil] :profile_id
|
|
31
|
+
# @option params [Integer, nil] :limit_record
|
|
32
|
+
# @option params [Integer, nil] :from_record
|
|
33
|
+
#
|
|
34
|
+
# @example
|
|
35
|
+
# client.billing.list_profiles(
|
|
36
|
+
# org_id: 123,
|
|
37
|
+
# limit_record: 20,
|
|
38
|
+
# from_record: 0
|
|
39
|
+
# )
|
|
40
|
+
#
|
|
41
|
+
# @return [Payabli::Types::BillingProfileQueryResponse]
|
|
42
|
+
def list_profiles(request_options: {}, **params)
|
|
43
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
44
|
+
query_params = {}
|
|
45
|
+
query_params["profileName"] = params[:profile_name] if params.key?(:profile_name)
|
|
46
|
+
query_params["feeType"] = params[:fee_type] if params.key?(:fee_type)
|
|
47
|
+
query_params["serviceVertical"] = params[:service_vertical] if params.key?(:service_vertical)
|
|
48
|
+
query_params["profileId"] = params[:profile_id] if params.key?(:profile_id)
|
|
49
|
+
query_params["limitRecord"] = params[:limit_record] if params.key?(:limit_record)
|
|
50
|
+
query_params["fromRecord"] = params[:from_record] if params.key?(:from_record)
|
|
51
|
+
|
|
52
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
53
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
54
|
+
base_url: request_options[:base_url],
|
|
55
|
+
method: "GET",
|
|
56
|
+
path: "billing/configuration/org/#{URI.encode_uri_component(params[:org_id].to_s)}",
|
|
57
|
+
headers: headers,
|
|
58
|
+
query: query_params,
|
|
59
|
+
request_options: request_options
|
|
60
|
+
)
|
|
61
|
+
begin
|
|
62
|
+
response = @client.send(request)
|
|
63
|
+
rescue Net::HTTPRequestTimeout
|
|
64
|
+
raise Payabli::Errors::TimeoutError
|
|
65
|
+
end
|
|
66
|
+
code = response.code.to_i
|
|
67
|
+
if code.between?(200, 299)
|
|
68
|
+
Payabli::Types::BillingProfileQueryResponse.load(response.body)
|
|
69
|
+
else
|
|
70
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
71
|
+
raise error_class.new(response.body, code: code)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Returns the billing profile currently assigned to an entity, including
|
|
76
|
+
# its billable events and fee schedules. Use it to read the pricing terms
|
|
77
|
+
# in effect for an organization, paypoint, template, or application.
|
|
78
|
+
#
|
|
79
|
+
# Requires a token with the `billing_profile_read` permission and access
|
|
80
|
+
# to the requested entity; otherwise the call gets `403 Forbidden`.
|
|
81
|
+
#
|
|
82
|
+
# If the entity exists but has no profile assigned, the call returns
|
|
83
|
+
# `404 Not Found`.
|
|
84
|
+
#
|
|
85
|
+
# @param request_options [Hash]
|
|
86
|
+
# @param params [Hash]
|
|
87
|
+
# @option request_options [String] :base_url
|
|
88
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
89
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
90
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
91
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
92
|
+
# @option params [Payabli::Billing::Types::GetProfileBillingRequestServiceGroup] :service_group
|
|
93
|
+
# @option params [Payabli::Billing::Types::GetProfileBillingRequestEntityType] :entity_type
|
|
94
|
+
# @option params [Integer] :entity_id
|
|
95
|
+
#
|
|
96
|
+
# @example
|
|
97
|
+
# client.billing.get_profile(
|
|
98
|
+
# service_group: "PayIn",
|
|
99
|
+
# entity_type: "Organization",
|
|
100
|
+
# entity_id: 123
|
|
101
|
+
# )
|
|
102
|
+
#
|
|
103
|
+
# @return [Payabli::Types::BillingProfileResponse]
|
|
104
|
+
def get_profile(request_options: {}, **params)
|
|
105
|
+
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
106
|
+
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
107
|
+
request = Payabli::Internal::JSON::Request.new(
|
|
108
|
+
base_url: request_options[:base_url],
|
|
109
|
+
method: "GET",
|
|
110
|
+
path: "billing/configuration/#{URI.encode_uri_component(params[:service_group].to_s)}/#{URI.encode_uri_component(params[:entity_type].to_s)}/#{URI.encode_uri_component(params[:entity_id].to_s)}",
|
|
111
|
+
headers: headers,
|
|
112
|
+
request_options: request_options
|
|
113
|
+
)
|
|
114
|
+
begin
|
|
115
|
+
response = @client.send(request)
|
|
116
|
+
rescue Net::HTTPRequestTimeout
|
|
117
|
+
raise Payabli::Errors::TimeoutError
|
|
118
|
+
end
|
|
119
|
+
code = response.code.to_i
|
|
120
|
+
if code.between?(200, 299)
|
|
121
|
+
Payabli::Types::BillingProfileResponse.load(response.body)
|
|
122
|
+
else
|
|
123
|
+
error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
|
|
124
|
+
raise error_class.new(response.body, code: code)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
module GetProfileBillingRequestEntityType
|
|
7
|
+
extend Payabli::Internal::Types::Enum
|
|
8
|
+
|
|
9
|
+
ORGANIZATION = "Organization"
|
|
10
|
+
PAYPOINT = "Paypoint"
|
|
11
|
+
TEMPLATE = "Template"
|
|
12
|
+
APPLICATION = "Application"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Payabli
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class ListBillingProfilesRequest < Internal::Types::Model
|
|
7
|
+
field :org_id, -> { Integer }, optional: false, nullable: false, api_name: "orgId"
|
|
8
|
+
|
|
9
|
+
field :profile_name, -> { String }, optional: true, nullable: false, api_name: "profileName"
|
|
10
|
+
|
|
11
|
+
field :fee_type, -> { Integer }, optional: true, nullable: false, api_name: "feeType"
|
|
12
|
+
|
|
13
|
+
field :service_vertical, -> { Integer }, optional: true, nullable: false, api_name: "serviceVertical"
|
|
14
|
+
|
|
15
|
+
field :profile_id, -> { Integer }, optional: true, nullable: false, api_name: "profileId"
|
|
16
|
+
|
|
17
|
+
field :limit_record, -> { Integer }, optional: true, nullable: false, api_name: "limitRecord"
|
|
18
|
+
|
|
19
|
+
field :from_record, -> { Integer }, optional: true, nullable: false, api_name: "fromRecord"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -187,13 +187,16 @@ module Payabli
|
|
|
187
187
|
# @return [Payabli::Types::PayabliApiResponse00Responsedatanonobject]
|
|
188
188
|
def update_application(request_options: {}, **params)
|
|
189
189
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
190
|
+
path_param_names = %i[app_id]
|
|
191
|
+
body_params = params.except(*path_param_names)
|
|
192
|
+
|
|
190
193
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
191
194
|
request = Payabli::Internal::JSON::Request.new(
|
|
192
195
|
base_url: request_options[:base_url],
|
|
193
196
|
method: "PUT",
|
|
194
197
|
path: "Boarding/app/#{URI.encode_uri_component(params[:app_id].to_s)}",
|
|
195
198
|
headers: headers,
|
|
196
|
-
body: Payabli::Types::ApplicationData.new(
|
|
199
|
+
body: Payabli::Types::ApplicationData.new(body_params).to_h,
|
|
197
200
|
request_options: request_options
|
|
198
201
|
)
|
|
199
202
|
begin
|
data/lib/payabli/client.rb
CHANGED
|
@@ -32,7 +32,7 @@ module Payabli
|
|
|
32
32
|
@raw_client = Payabli::Internal::Http::RawClient.new(
|
|
33
33
|
base_url: base_url || Payabli::Environment::SANDBOX,
|
|
34
34
|
headers: {
|
|
35
|
-
"User-Agent" => "payabli/3.0.
|
|
35
|
+
"User-Agent" => "payabli/3.0.8",
|
|
36
36
|
"X-Fern-Language" => "Ruby"
|
|
37
37
|
},
|
|
38
38
|
auth_provider: Payabli::Internal::RoutingAuthProvider.new(
|
|
@@ -212,5 +212,10 @@ module Payabli
|
|
|
212
212
|
def case_management
|
|
213
213
|
@case_management ||= Payabli::CaseManagement::Client.new(client: @raw_client)
|
|
214
214
|
end
|
|
215
|
+
|
|
216
|
+
# @return [Payabli::Billing::Client]
|
|
217
|
+
def billing
|
|
218
|
+
@billing ||= Payabli::Billing::Client.new(client: @raw_client)
|
|
219
|
+
end
|
|
215
220
|
end
|
|
216
221
|
end
|
|
@@ -146,13 +146,16 @@ module Payabli
|
|
|
146
146
|
# @return [Payabli::Types::PayabliApiResponse00Responsedatanonobject]
|
|
147
147
|
def update_customer(request_options: {}, **params)
|
|
148
148
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
149
|
+
path_param_names = %i[customer_id]
|
|
150
|
+
body_params = params.except(*path_param_names)
|
|
151
|
+
|
|
149
152
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
150
153
|
request = Payabli::Internal::JSON::Request.new(
|
|
151
154
|
base_url: request_options[:base_url],
|
|
152
155
|
method: "PUT",
|
|
153
156
|
path: "Customer/#{URI.encode_uri_component(params[:customer_id].to_s)}",
|
|
154
157
|
headers: headers,
|
|
155
|
-
body: Payabli::Types::CustomerData.new(
|
|
158
|
+
body: Payabli::Types::CustomerData.new(body_params).to_h,
|
|
156
159
|
request_options: request_options
|
|
157
160
|
)
|
|
158
161
|
begin
|
|
@@ -127,13 +127,16 @@ module Payabli
|
|
|
127
127
|
# @return [Payabli::Types::PayabliApiResponse00Responsedatanonobject]
|
|
128
128
|
def save_page(request_options: {}, **params)
|
|
129
129
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
130
|
+
path_param_names = %i[entry subdomain]
|
|
131
|
+
body_params = params.except(*path_param_names)
|
|
132
|
+
|
|
130
133
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
131
134
|
request = Payabli::Internal::JSON::Request.new(
|
|
132
135
|
base_url: request_options[:base_url],
|
|
133
136
|
method: "PUT",
|
|
134
137
|
path: "Paypoint/#{URI.encode_uri_component(params[:entry].to_s)}/#{URI.encode_uri_component(params[:subdomain].to_s)}",
|
|
135
138
|
headers: headers,
|
|
136
|
-
body: Payabli::Types::PayabliPages.new(
|
|
139
|
+
body: Payabli::Types::PayabliPages.new(body_params).to_h,
|
|
137
140
|
request_options: request_options
|
|
138
141
|
)
|
|
139
142
|
begin
|
|
@@ -21,10 +21,13 @@ module Payabli
|
|
|
21
21
|
# @param max_retries [Integer] The number of times to retry a failed request, defaults to 2.
|
|
22
22
|
# @param timeout [Float] The timeout for the request, defaults to 60.0 seconds.
|
|
23
23
|
# @param headers [Hash] The headers for the request.
|
|
24
|
+
# @param overridable_headers [Array<String>] The names of the client-level headers a request
|
|
25
|
+
# may replace via `additional_headers`. Holds the API's global headers; SDK metadata and
|
|
26
|
+
# auth headers are absent from it and so stay protected.
|
|
24
27
|
# @param auth_provider [Object, nil] An optional auth provider responding to
|
|
25
28
|
# `auth_headers`. When present its headers are resolved on every request so
|
|
26
29
|
# token-based schemes (e.g. OAuth) can refresh an expired token mid-session.
|
|
27
|
-
def initialize(base_url:, max_retries: 2, timeout: 60.0, headers: {}, auth_provider: nil)
|
|
30
|
+
def initialize(base_url:, max_retries: 2, timeout: 60.0, headers: {}, overridable_headers: [], auth_provider: nil)
|
|
28
31
|
@base_url = base_url
|
|
29
32
|
@max_retries = max_retries
|
|
30
33
|
@timeout = timeout
|
|
@@ -34,6 +37,7 @@ module Payabli
|
|
|
34
37
|
"X-Fern-SDK-Name": "payabli",
|
|
35
38
|
"X-Fern-SDK-Version": "0.0.1"
|
|
36
39
|
}.merge(headers)
|
|
40
|
+
@overridable_headers = overridable_headers.to_set { |name| name.to_s.downcase }
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
# @param request [Payabli::Internal::Http::BaseRequest] The HTTP request.
|
|
@@ -50,7 +54,7 @@ module Payabli
|
|
|
50
54
|
http_request = build_http_request(
|
|
51
55
|
url:,
|
|
52
56
|
method: request.method,
|
|
53
|
-
headers: request.encode_headers(protected_keys:
|
|
57
|
+
headers: request.encode_headers(protected_keys: protected_header_keys + auth_headers.keys),
|
|
54
58
|
body: request.encode_body,
|
|
55
59
|
auth_headers: auth_headers
|
|
56
60
|
)
|
|
@@ -73,6 +77,15 @@ module Payabli
|
|
|
73
77
|
response
|
|
74
78
|
end
|
|
75
79
|
|
|
80
|
+
# The client-level header names that `additional_headers` must not replace: every default
|
|
81
|
+
# header except the API's global headers, which are overridable per request.
|
|
82
|
+
# @return [Array<Symbol, String>] The protected header names.
|
|
83
|
+
def protected_header_keys
|
|
84
|
+
return @default_headers.keys if @overridable_headers.empty?
|
|
85
|
+
|
|
86
|
+
@default_headers.keys.reject { |name| @overridable_headers.include?(name.to_s.downcase) }
|
|
87
|
+
end
|
|
88
|
+
|
|
76
89
|
# Determines if a request should be retried based on the response status code.
|
|
77
90
|
# @param response [Net::HTTPResponse] The HTTP response.
|
|
78
91
|
# @param attempt [Integer] The current retry attempt (0-indexed).
|
|
@@ -13,21 +13,23 @@ module Payabli
|
|
|
13
13
|
# @param headers [Hash] Additional headers for the request (optional)
|
|
14
14
|
# @param query [Hash] Query parameters for the request (optional)
|
|
15
15
|
# @param body [Object, nil] The JSON request body (optional)
|
|
16
|
+
# @param omit_content_type_without_body [Boolean] When true and no body is present, the
|
|
17
|
+
# Content-Type header is omitted (used for endpoints whose request body is optional)
|
|
16
18
|
# @param request_options [Payabli::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
17
|
-
def initialize(base_url:, path:, method:, headers: {}, query: {}, body: nil, request_options: {})
|
|
19
|
+
def initialize(base_url:, path:, method:, headers: {}, query: {}, body: nil, omit_content_type_without_body: false, request_options: {})
|
|
18
20
|
super(base_url:, path:, method:, headers:, query:, request_options:)
|
|
19
21
|
|
|
20
22
|
@body = body
|
|
23
|
+
@omit_content_type_without_body = omit_content_type_without_body
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
# @return [Hash] The encoded HTTP request headers.
|
|
24
27
|
# @param protected_keys [Array<String>] Header keys set by the SDK client (e.g. auth, metadata)
|
|
25
28
|
# that must not be overridden by additional_headers from request_options.
|
|
26
29
|
def encode_headers(protected_keys: [])
|
|
27
|
-
sdk_headers = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}.merge(@headers)
|
|
30
|
+
sdk_headers = { "Accept" => "application/json" }
|
|
31
|
+
sdk_headers["Content-Type"] = "application/json" unless @omit_content_type_without_body && @body.nil?
|
|
32
|
+
sdk_headers = sdk_headers.merge(@headers)
|
|
31
33
|
merge_additional_headers(sdk_headers, protected_keys:)
|
|
32
34
|
end
|
|
33
35
|
|
|
@@ -128,13 +128,16 @@ module Payabli
|
|
|
128
128
|
# @return [Payabli::Types::PayabliApiResponse6]
|
|
129
129
|
def update_item(request_options: {}, **params)
|
|
130
130
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
131
|
+
path_param_names = %i[line_item_id]
|
|
132
|
+
body_params = params.except(*path_param_names)
|
|
133
|
+
|
|
131
134
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
132
135
|
request = Payabli::Internal::JSON::Request.new(
|
|
133
136
|
base_url: request_options[:base_url],
|
|
134
137
|
method: "PUT",
|
|
135
138
|
path: "LineItem/#{URI.encode_uri_component(params[:line_item_id].to_s)}",
|
|
136
139
|
headers: headers,
|
|
137
|
-
body: Payabli::Types::LineItem.new(
|
|
140
|
+
body: Payabli::Types::LineItem.new(body_params).to_h,
|
|
138
141
|
request_options: request_options
|
|
139
142
|
)
|
|
140
143
|
begin
|
|
@@ -178,13 +178,16 @@ module Payabli
|
|
|
178
178
|
# @return [Payabli::Types::CaptureResponse]
|
|
179
179
|
def capture_auth(request_options: {}, **params)
|
|
180
180
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
181
|
+
path_param_names = %i[trans_id]
|
|
182
|
+
body_params = params.except(*path_param_names)
|
|
183
|
+
|
|
181
184
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
182
185
|
request = Payabli::Internal::JSON::Request.new(
|
|
183
186
|
base_url: request_options[:base_url],
|
|
184
187
|
method: "POST",
|
|
185
188
|
path: "MoneyIn/capture/#{URI.encode_uri_component(params[:trans_id].to_s)}",
|
|
186
189
|
headers: headers,
|
|
187
|
-
body: Payabli::Types::CaptureRequest.new(
|
|
190
|
+
body: Payabli::Types::CaptureRequest.new(body_params).to_h,
|
|
188
191
|
request_options: request_options
|
|
189
192
|
)
|
|
190
193
|
begin
|
|
@@ -946,13 +949,16 @@ module Payabli
|
|
|
946
949
|
# @return [Payabli::Types::V2TransactionResponseWrapper]
|
|
947
950
|
def capturev_2(request_options: {}, **params)
|
|
948
951
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
952
|
+
path_param_names = %i[trans_id]
|
|
953
|
+
body_params = params.except(*path_param_names)
|
|
954
|
+
|
|
949
955
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
950
956
|
request = Payabli::Internal::JSON::Request.new(
|
|
951
957
|
base_url: request_options[:base_url],
|
|
952
958
|
method: "POST",
|
|
953
959
|
path: "v2/MoneyIn/capture/#{URI.encode_uri_component(params[:trans_id].to_s)}",
|
|
954
960
|
headers: headers,
|
|
955
|
-
body: Payabli::Types::CaptureRequest.new(
|
|
961
|
+
body: Payabli::Types::CaptureRequest.new(body_params).to_h,
|
|
956
962
|
request_options: request_options
|
|
957
963
|
)
|
|
958
964
|
begin
|
|
@@ -991,18 +997,40 @@ module Payabli
|
|
|
991
997
|
# @option params [String] :trans_id
|
|
992
998
|
#
|
|
993
999
|
# @example
|
|
994
|
-
# client.money_in.refundv_2(
|
|
1000
|
+
# client.money_in.refundv_2(
|
|
1001
|
+
# trans_id: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
|
|
1002
|
+
# amount: 100,
|
|
1003
|
+
# order_description: "Materials deposit",
|
|
1004
|
+
# refund_details: {
|
|
1005
|
+
# split_refunding: [{
|
|
1006
|
+
# origination_entry_point: "495147f647",
|
|
1007
|
+
# account_id: "187-342",
|
|
1008
|
+
# description: "Refunding undelivered materials",
|
|
1009
|
+
# amount: 60
|
|
1010
|
+
# }, {
|
|
1011
|
+
# origination_entry_point: "8cfec329267",
|
|
1012
|
+
# account_id: "187-343",
|
|
1013
|
+
# description: "Refunding deposit for undelivered materials",
|
|
1014
|
+
# amount: 40
|
|
1015
|
+
# }]
|
|
1016
|
+
# },
|
|
1017
|
+
# source: "api"
|
|
1018
|
+
# )
|
|
995
1019
|
#
|
|
996
1020
|
# @return [Payabli::Types::V2TransactionResponseWrapper]
|
|
997
1021
|
def refundv_2(request_options: {}, **params)
|
|
998
1022
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
1023
|
+
path_param_names = %i[trans_id]
|
|
1024
|
+
body_params = params.except(*path_param_names)
|
|
1025
|
+
|
|
999
1026
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
1000
1027
|
request = Payabli::Internal::JSON::Request.new(
|
|
1001
1028
|
base_url: request_options[:base_url],
|
|
1002
1029
|
method: "POST",
|
|
1003
1030
|
path: "v2/MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}",
|
|
1004
1031
|
headers: headers,
|
|
1005
|
-
body: Payabli::Types::RefundV2Request.new(
|
|
1032
|
+
body: body_params.empty? ? nil : Payabli::Types::RefundV2Request.new(body_params).to_h,
|
|
1033
|
+
omit_content_type_without_body: true,
|
|
1006
1034
|
request_options: request_options
|
|
1007
1035
|
)
|
|
1008
1036
|
begin
|
|
@@ -1026,8 +1054,8 @@ module Payabli
|
|
|
1026
1054
|
# response codes reference](/guides/pay-in-unified-response-codes-reference) for more information.
|
|
1027
1055
|
#
|
|
1028
1056
|
# <Note>
|
|
1029
|
-
#
|
|
1030
|
-
#
|
|
1057
|
+
# For a standard refund, whether full (`amount` set to 0) or partial, send no request body. Include a request body
|
|
1058
|
+
# only to refund a split-funded transaction, with split instructions in `refundDetails`.
|
|
1031
1059
|
# </Note>
|
|
1032
1060
|
#
|
|
1033
1061
|
# @param request_options [Hash]
|
|
@@ -1043,19 +1071,38 @@ module Payabli
|
|
|
1043
1071
|
# @example
|
|
1044
1072
|
# client.money_in.refundv_2_amount(
|
|
1045
1073
|
# trans_id: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
|
|
1046
|
-
# amount:
|
|
1074
|
+
# amount: 70,
|
|
1075
|
+
# order_description: "Materials deposit",
|
|
1076
|
+
# refund_details: {
|
|
1077
|
+
# split_refunding: [{
|
|
1078
|
+
# origination_entry_point: "495147f647",
|
|
1079
|
+
# account_id: "187-342",
|
|
1080
|
+
# description: "Refunding undelivered materials",
|
|
1081
|
+
# amount: 40
|
|
1082
|
+
# }, {
|
|
1083
|
+
# origination_entry_point: "8cfec329267",
|
|
1084
|
+
# account_id: "187-343",
|
|
1085
|
+
# description: "Refunding deposit for undelivered materials",
|
|
1086
|
+
# amount: 30
|
|
1087
|
+
# }]
|
|
1088
|
+
# },
|
|
1089
|
+
# source: "api"
|
|
1047
1090
|
# )
|
|
1048
1091
|
#
|
|
1049
1092
|
# @return [Payabli::Types::V2TransactionResponseWrapper]
|
|
1050
1093
|
def refundv_2_amount(request_options: {}, **params)
|
|
1051
1094
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
1095
|
+
path_param_names = %i[trans_id amount]
|
|
1096
|
+
body_params = params.except(*path_param_names)
|
|
1097
|
+
|
|
1052
1098
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
1053
1099
|
request = Payabli::Internal::JSON::Request.new(
|
|
1054
1100
|
base_url: request_options[:base_url],
|
|
1055
1101
|
method: "POST",
|
|
1056
1102
|
path: "v2/MoneyIn/refund/#{URI.encode_uri_component(params[:trans_id].to_s)}/#{URI.encode_uri_component(params[:amount].to_s)}",
|
|
1057
1103
|
headers: headers,
|
|
1058
|
-
body: Payabli::Types::RefundV2Request.new(
|
|
1104
|
+
body: body_params.empty? ? nil : Payabli::Types::RefundV2Request.new(body_params).to_h,
|
|
1105
|
+
omit_content_type_without_body: true,
|
|
1059
1106
|
request_options: request_options
|
|
1060
1107
|
)
|
|
1061
1108
|
begin
|
|
@@ -10,7 +10,7 @@ module Payabli
|
|
|
10
10
|
@client = client
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
# Create a new notification or
|
|
13
|
+
# Create a new notification or autogenerated report.
|
|
14
14
|
#
|
|
15
15
|
# @param request_options [Hash]
|
|
16
16
|
# @param params [Payabli::Types::AddNotificationRequest]
|
|
@@ -59,7 +59,7 @@ module Payabli
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
# Retrieves a single notification or
|
|
62
|
+
# Retrieves a single notification or autogenerated report's details.
|
|
63
63
|
#
|
|
64
64
|
# @param request_options [Hash]
|
|
65
65
|
# @param params [Hash]
|
|
@@ -98,7 +98,7 @@ module Payabli
|
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
# Update a notification or
|
|
101
|
+
# Update a notification or autogenerated report.
|
|
102
102
|
#
|
|
103
103
|
# @param request_options [Hash]
|
|
104
104
|
# @param params [Payabli::Types::UpdateNotificationRequest]
|
|
@@ -126,13 +126,16 @@ module Payabli
|
|
|
126
126
|
# @return [Payabli::Types::PayabliApiResponseNotifications]
|
|
127
127
|
def update_notification(request_options: {}, **params)
|
|
128
128
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
129
|
+
path_param_names = %i[n_id]
|
|
130
|
+
body_params = params.except(*path_param_names)
|
|
131
|
+
|
|
129
132
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
130
133
|
request = Payabli::Internal::JSON::Request.new(
|
|
131
134
|
base_url: request_options[:base_url],
|
|
132
135
|
method: "PUT",
|
|
133
136
|
path: "Notification/#{URI.encode_uri_component(params[:n_id].to_s)}",
|
|
134
137
|
headers: headers,
|
|
135
|
-
body: Payabli::Types::UpdateNotificationRequest.new(
|
|
138
|
+
body: Payabli::Types::UpdateNotificationRequest.new(body_params).to_h,
|
|
136
139
|
request_options: request_options
|
|
137
140
|
)
|
|
138
141
|
begin
|
|
@@ -149,7 +152,7 @@ module Payabli
|
|
|
149
152
|
end
|
|
150
153
|
end
|
|
151
154
|
|
|
152
|
-
# Deletes a single notification or
|
|
155
|
+
# Deletes a single notification or autogenerated report.
|
|
153
156
|
#
|
|
154
157
|
# @param request_options [Hash]
|
|
155
158
|
# @param params [Hash]
|
data/lib/payabli/ocr/client.rb
CHANGED
|
@@ -30,13 +30,16 @@ module Payabli
|
|
|
30
30
|
# @return [Payabli::Types::PayabliApiResponseOcr]
|
|
31
31
|
def ocr_document_form(request_options: {}, **params)
|
|
32
32
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
33
|
+
path_param_names = %i[type_result]
|
|
34
|
+
body_params = params.except(*path_param_names)
|
|
35
|
+
|
|
33
36
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
34
37
|
request = Payabli::Internal::JSON::Request.new(
|
|
35
38
|
base_url: request_options[:base_url],
|
|
36
39
|
method: "POST",
|
|
37
40
|
path: "Import/ocrDocumentForm/#{URI.encode_uri_component(params[:type_result].to_s)}",
|
|
38
41
|
headers: headers,
|
|
39
|
-
body: Payabli::Types::FileContentImageOnly.new(
|
|
42
|
+
body: Payabli::Types::FileContentImageOnly.new(body_params).to_h,
|
|
40
43
|
request_options: request_options
|
|
41
44
|
)
|
|
42
45
|
begin
|
|
@@ -73,13 +76,16 @@ module Payabli
|
|
|
73
76
|
# @return [Payabli::Types::PayabliApiResponseOcr]
|
|
74
77
|
def ocr_document_json(request_options: {}, **params)
|
|
75
78
|
params = Payabli::Internal::Types::Utils.normalize_keys(params)
|
|
79
|
+
path_param_names = %i[type_result]
|
|
80
|
+
body_params = params.except(*path_param_names)
|
|
81
|
+
|
|
76
82
|
headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
|
|
77
83
|
request = Payabli::Internal::JSON::Request.new(
|
|
78
84
|
base_url: request_options[:base_url],
|
|
79
85
|
method: "POST",
|
|
80
86
|
path: "Import/ocrDocumentJson/#{URI.encode_uri_component(params[:type_result].to_s)}",
|
|
81
87
|
headers: headers,
|
|
82
|
-
body: Payabli::Types::FileContentImageOnly.new(
|
|
88
|
+
body: Payabli::Types::FileContentImageOnly.new(body_params).to_h,
|
|
83
89
|
request_options: request_options
|
|
84
90
|
)
|
|
85
91
|
begin
|