payabli 3.0.7 → 3.0.9

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +7 -6
  3. data/lib/payabli/bill/client.rb +8 -2
  4. data/lib/payabli/billing/client.rb +129 -0
  5. data/lib/payabli/billing/types/get_profile_billing_request_entity_type.rb +16 -0
  6. data/lib/payabli/billing/types/get_profile_billing_request_service_group.rb +14 -0
  7. data/lib/payabli/billing/types/list_billing_profiles_request.rb +23 -0
  8. data/lib/payabli/boarding/client.rb +4 -1
  9. data/lib/payabli/client.rb +11 -1
  10. data/lib/payabli/cloud/client.rb +2 -2
  11. data/lib/payabli/customer/client.rb +4 -1
  12. data/lib/payabli/device/client.rb +63 -0
  13. data/lib/payabli/funding/client.rb +1 -1
  14. data/lib/payabli/hosted_payment_pages/client.rb +4 -1
  15. data/lib/payabli/internal/http/raw_client.rb +15 -2
  16. data/lib/payabli/internal/json/request.rb +7 -5
  17. data/lib/payabli/line_item/client.rb +4 -1
  18. data/lib/payabli/money_in/client.rb +71 -64
  19. data/lib/payabli/money_out/client.rb +2 -4
  20. data/lib/payabli/money_out/types/request_out_authorize.rb +1 -3
  21. data/lib/payabli/notification/client.rb +8 -5
  22. data/lib/payabli/ocr/client.rb +8 -2
  23. data/lib/payabli/organization/client.rb +5 -5
  24. data/lib/payabli/organization/types/organization_data.rb +2 -2
  25. data/lib/payabli/payment_link/client.rb +8 -2
  26. data/lib/payabli/paypoint/client.rb +4 -1
  27. data/lib/payabli/types/auth_capture_payout_response_data.rb +1 -1
  28. data/lib/payabli/types/billable_event.rb +29 -0
  29. data/lib/payabli/types/billing_entity.rb +13 -0
  30. data/lib/payabli/types/billing_entity_named.rb +13 -0
  31. data/lib/payabli/types/billing_profile_query_response.rb +14 -0
  32. data/lib/payabli/types/billing_profile_record.rb +32 -0
  33. data/lib/payabli/types/billing_profile_response.rb +31 -0
  34. data/lib/payabli/types/billing_profile_summary.rb +16 -0
  35. data/lib/payabli/types/collection_schedule_value.rb +23 -0
  36. data/lib/payabli/types/device_challenge_data.rb +12 -0
  37. data/lib/payabli/types/device_challenge_response.rb +21 -0
  38. data/lib/payabli/types/device_query_record.rb +8 -0
  39. data/lib/payabli/types/entities_assigned.rb +17 -0
  40. data/lib/payabli/types/entity_type_name.rb +17 -0
  41. data/lib/payabli/types/entity_type_value.rb +23 -0
  42. data/lib/payabli/types/event_group_value.rb +23 -0
  43. data/lib/payabli/types/event_source_value.rb +23 -0
  44. data/lib/payabli/types/event_type_value.rb +23 -0
  45. data/lib/payabli/types/fee_schedule.rb +47 -0
  46. data/lib/payabli/types/fee_type_name.rb +12 -0
  47. data/lib/payabli/types/{lot_number.rb → fee_type_value.rb} +2 -2
  48. data/lib/payabli/types/methodall.rb +1 -0
  49. data/lib/payabli/types/operation_result.rb +4 -2
  50. data/lib/payabli/types/passthrough_value.rb +23 -0
  51. data/lib/payabli/types/pay_method_cloud.rb +0 -2
  52. data/lib/payabli/types/pay_method_device.rb +14 -0
  53. data/lib/payabli/types/pay_method_device_method.rb +11 -0
  54. data/lib/payabli/types/payment_method.rb +2 -0
  55. data/lib/payabli/types/paypoint_data.rb +2 -0
  56. data/lib/payabli/types/query_payout_transaction_records_item.rb +2 -0
  57. data/lib/payabli/types/query_payout_transaction_records_item_allowed_actions_item.rb +13 -0
  58. data/lib/payabli/types/region_type_value.rb +23 -0
  59. data/lib/payabli/types/request_out_authorize_invoice_data.rb +4 -25
  60. data/lib/payabli/types/request_out_authorize_vendor_data.rb +3 -61
  61. data/lib/payabli/types/service_group_value.rb +23 -0
  62. data/lib/payabli/types/service_type_value.rb +23 -0
  63. data/lib/payabli/types/service_value.rb +23 -0
  64. data/lib/payabli/types/service_vertical_name.rb +13 -0
  65. data/lib/payabli/types/transaction_detail_payment_data.rb +2 -2
  66. data/lib/payabli/types/v_2_transaction_detail_response_data.rb +1 -1
  67. data/lib/payabli/types/v_2_transaction_details.rb +1 -1
  68. data/lib/payabli/user/client.rb +8 -2
  69. data/lib/payabli/vendor/client.rb +8 -2
  70. data/lib/payabli/version.rb +1 -1
  71. data/lib/payabli.rb +33 -2
  72. data/reference.md +690 -531
  73. data/wiremock/wiremock-mappings.json +172 -65
  74. metadata +35 -4
  75. data/lib/payabli/types/request_out_authorize_vendor_billing_data.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c348ce0242faa30e0404200b80d1552188c2a6d953bae3308d44365a45a086e5
4
- data.tar.gz: 96fd899b2ac2c8bc2ec9193f9ba244ba3b500fd746bd8354a1537f9155887284
3
+ metadata.gz: ad3502f5cf3111c45acbb8d04c9a32c6fc14f55609f079c90c8d2ca69f731a58
4
+ data.tar.gz: 40d8407f79b680968de259976c94992a76627d110f4ba53a3c9dff118467077c
5
5
  SHA512:
6
- metadata.gz: 8d1832ec5c195aeb5ee8ab8c220a8c02c5dc9886146cfa1c76eca077636e9e83f23c87eb797485734d6b72df6299dec8c93eff9562c645e3098597b731a72081
7
- data.tar.gz: 4cefd412ad3e15177f5f376e571179c7cbea0ad91ef33b24712a3659262f920eaee66f71150c34b1bcd33c59943ab37a658a5c58307e83d2b3dccc869344f09f
6
+ metadata.gz: 9290d8e53104b1de9c6fce591411ff014e26dbceb885dcb7944d29a3214be2b9e9c772efc36c2c5851df0ec69a6471bf68c6bf10935b46a5dd60245733139e29
7
+ data.tar.gz: 7ba662ae69d56a47adfd31406c2ed7adc3b52e35cb791181ae4188cd55e8aa196c2576f54abf983263a8ec7ad510bbcfde3297b708880b041799ea5c1e1602c1
data/.fern/metadata.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
- "cliVersion": "5.56.0",
2
+ "cliVersion": "5.98.1",
3
3
  "generatorName": "fernapi/fern-ruby-sdk",
4
- "generatorVersion": "1.20.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": "85dc6dd780991f47e9c2d71ad221647a62bccf93",
10
+ "originGitCommit": "aa2ca5e48aaac43d3a95cb68a4326a796855ec16",
10
11
  "originGitCommitIsDirty": true,
11
12
  "invokedBy": "ci",
12
- "requestedVersion": "3.0.7",
13
+ "requestedVersion": "3.0.9",
13
14
  "ciProvider": "github",
14
- "sdkVersion": "3.0.7"
15
+ "sdkVersion": "3.0.9"
15
16
  }
@@ -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(params).to_h,
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: params,
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,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payabli
4
+ module Billing
5
+ module Types
6
+ module GetProfileBillingRequestServiceGroup
7
+ extend Payabli::Internal::Types::Enum
8
+
9
+ PAY_IN = "PayIn"
10
+ PAY_OUT = "PayOut"
11
+ end
12
+ end
13
+ end
14
+ 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(params).to_h,
199
+ body: Payabli::Types::ApplicationData.new(body_params).to_h,
197
200
  request_options: request_options
198
201
  )
199
202
  begin
@@ -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.7",
35
+ "User-Agent" => "payabli/3.0.9",
36
36
  "X-Fern-Language" => "Ruby"
37
37
  },
38
38
  auth_provider: Payabli::Internal::RoutingAuthProvider.new(
@@ -123,6 +123,11 @@ module Payabli
123
123
  @notificationlogs ||= Payabli::Notificationlogs::Client.new(client: @raw_client)
124
124
  end
125
125
 
126
+ # @return [Payabli::Device::Client]
127
+ def device
128
+ @device ||= Payabli::Device::Client.new(client: @raw_client)
129
+ end
130
+
126
131
  # @return [Payabli::Cloud::Client]
127
132
  def cloud
128
133
  @cloud ||= Payabli::Cloud::Client.new(client: @raw_client)
@@ -212,5 +217,10 @@ module Payabli
212
217
  def case_management
213
218
  @case_management ||= Payabli::CaseManagement::Client.new(client: @raw_client)
214
219
  end
220
+
221
+ # @return [Payabli::Billing::Client]
222
+ def billing
223
+ @billing ||= Payabli::Billing::Client.new(client: @raw_client)
224
+ end
215
225
  end
216
226
  end
@@ -149,8 +149,8 @@ module Payabli
149
149
  end
150
150
  end
151
151
 
152
- # Use [List devices by paypoint](/developers/api-reference/cloud/get-list-of-devices-for-a-paypoint) instead,
153
- # which supports filters, sorting, and pagination.
152
+ # Use [List devices by paypoint](/developers/api-reference/get-list-of-devices-for-a-paypoint) instead, which
153
+ # supports filters, sorting, and pagination.
154
154
  #
155
155
  # Get a list of cloud devices registered to an entrypoint.
156
156
  #
@@ -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(params).to_h,
158
+ body: Payabli::Types::CustomerData.new(body_params).to_h,
156
159
  request_options: request_options
157
160
  )
158
161
  begin
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payabli
4
+ module Device
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
+ # Generates a one-time, 6-digit verification code for activating a
14
+ # semi-integrated card-present device in a paypoint. After calling this endpoint, an operator enters the returned
15
+ # code
16
+ # on the device's terminal, along with a device name, to register the
17
+ # device to the paypoint resolved from `{entry}`.
18
+ #
19
+ # A code expires 5 minutes after it's issued. A paypoint can have several
20
+ # codes active at once — for example, when activating a batch of devices —
21
+ # and a code binds to whichever device enters it first.
22
+ #
23
+ # Authenticate with an OAuth2 Bearer token that has the `device_registry` scope.
24
+ #
25
+ # @param request_options [Hash]
26
+ # @param params [Hash]
27
+ # @option request_options [String] :base_url
28
+ # @option request_options [Hash{String => Object}] :additional_headers
29
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
30
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
31
+ # @option request_options [Integer] :timeout_in_seconds
32
+ # @option params [String] :entry
33
+ #
34
+ # @example
35
+ # client.device.challenge(entry: "8cfec329267")
36
+ #
37
+ # @return [Payabli::Types::DeviceChallengeResponse]
38
+ def challenge(request_options: {}, **params)
39
+ params = Payabli::Internal::Types::Utils.normalize_keys(params)
40
+ headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
41
+ request = Payabli::Internal::JSON::Request.new(
42
+ base_url: request_options[:base_url],
43
+ method: "POST",
44
+ path: "Device/challenge/#{URI.encode_uri_component(params[:entry].to_s)}",
45
+ headers: headers,
46
+ request_options: request_options
47
+ )
48
+ begin
49
+ response = @client.send(request)
50
+ rescue Net::HTTPRequestTimeout
51
+ raise Payabli::Errors::TimeoutError
52
+ end
53
+ code = response.code.to_i
54
+ if code.between?(200, 299)
55
+ Payabli::Types::DeviceChallengeResponse.load(response.body)
56
+ else
57
+ error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
58
+ raise error_class.new(response.body, code: code)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -23,7 +23,7 @@ module Payabli
23
23
  #
24
24
  # @example
25
25
  # client.funding.deposit_funds(
26
- # amount: 10,
26
+ # amount: 1500,
27
27
  # entrypoint: "48acde49",
28
28
  # account_id: "333"
29
29
  # )
@@ -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(params).to_h,
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: @default_headers.keys + auth_headers.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
- "Content-Type" => "application/json",
29
- "Accept" => "application/json"
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(params).to_h,
140
+ body: Payabli::Types::LineItem.new(body_params).to_h,
138
141
  request_options: request_options
139
142
  )
140
143
  begin