univapay-client-sdk 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -3
  3. data/lib/univapay_client_sdk/apis/base_api.rb +1 -1
  4. data/lib/univapay_client_sdk/apis/charges_api.rb +10 -7
  5. data/lib/univapay_client_sdk/apis/checkout_api.rb +58 -0
  6. data/lib/univapay_client_sdk/apis/stores_api.rb +63 -0
  7. data/lib/univapay_client_sdk/apis/subscriptions_api.rb +139 -1
  8. data/lib/univapay_client_sdk/apis/transaction_history_api.rb +349 -0
  9. data/lib/univapay_client_sdk/apis/transaction_tokens_api.rb +205 -8
  10. data/lib/univapay_client_sdk/client.rb +12 -0
  11. data/lib/univapay_client_sdk/models/bank_transfer_transaction_token.rb +256 -0
  12. data/lib/univapay_client_sdk/models/base_online_data.rb +5 -1
  13. data/lib/univapay_client_sdk/models/base_online_data_brand.rb +78 -2
  14. data/lib/univapay_client_sdk/models/card_limit.rb +108 -0
  15. data/lib/univapay_client_sdk/models/card_transaction_token.rb +256 -0
  16. data/lib/univapay_client_sdk/models/charge_capture_request.rb +14 -9
  17. data/lib/univapay_client_sdk/models/charge_create_request.rb +6 -1
  18. data/lib/univapay_client_sdk/models/charge_create_request_three_ds.rb +94 -6
  19. data/lib/univapay_client_sdk/models/charge_create_request_three_ds_mode.rb +15 -1
  20. data/lib/univapay_client_sdk/models/checkout_bank_transfer_configuration.rb +342 -0
  21. data/lib/univapay_client_sdk/models/checkout_bank_transfer_match_amount.rb +44 -0
  22. data/lib/univapay_client_sdk/models/checkout_card_configuration.rb +296 -0
  23. data/lib/univapay_client_sdk/models/checkout_convenience_configuration.rb +98 -0
  24. data/lib/univapay_client_sdk/models/checkout_ec_configuration.rb +88 -0
  25. data/lib/univapay_client_sdk/models/checkout_ec_email_configuration.rb +75 -0
  26. data/lib/univapay_client_sdk/models/checkout_ec_products_configuration.rb +75 -0
  27. data/lib/univapay_client_sdk/models/checkout_info.rb +333 -0
  28. data/lib/univapay_client_sdk/models/checkout_installment_card_processor.rb +86 -0
  29. data/lib/univapay_client_sdk/models/checkout_installments_configuration.rb +140 -0
  30. data/lib/univapay_client_sdk/models/checkout_mode.rb +42 -0
  31. data/lib/univapay_client_sdk/models/checkout_money_amount.rb +96 -0
  32. data/lib/univapay_client_sdk/models/checkout_online_configuration.rb +75 -0
  33. data/lib/univapay_client_sdk/models/checkout_paidy_configuration.rb +75 -0
  34. data/lib/univapay_client_sdk/models/checkout_payment_type.rb +60 -0
  35. data/lib/univapay_client_sdk/models/checkout_qr_scan_configuration.rb +94 -0
  36. data/lib/univapay_client_sdk/models/checkout_recurring_token_privilege.rb +43 -0
  37. data/lib/univapay_client_sdk/models/checkout_subscription_configuration.rb +75 -0
  38. data/lib/univapay_client_sdk/models/checkout_subscription_plan_configuration.rb +137 -0
  39. data/lib/univapay_client_sdk/models/checkout_supported_brand.rb +244 -0
  40. data/lib/univapay_client_sdk/models/checkout_theme.rb +76 -0
  41. data/lib/univapay_client_sdk/models/checkout_theme_colors.rb +153 -0
  42. data/lib/univapay_client_sdk/models/create_customer_id_request.rb +75 -0
  43. data/lib/univapay_client_sdk/models/create_customer_id_response.rb +77 -0
  44. data/lib/univapay_client_sdk/models/enable_token_three_ds_request.rb +78 -0
  45. data/lib/univapay_client_sdk/models/expiration_time_shift.rb +87 -0
  46. data/lib/univapay_client_sdk/models/konbini_transaction_token.rb +256 -0
  47. data/lib/univapay_client_sdk/models/online_transaction_token.rb +256 -0
  48. data/lib/univapay_client_sdk/models/paidy_transaction_token.rb +256 -0
  49. data/lib/univapay_client_sdk/models/qr_merchant_transaction_token.rb +257 -0
  50. data/lib/univapay_client_sdk/models/qr_scan_transaction_token.rb +257 -0
  51. data/lib/univapay_client_sdk/models/recurring_cvv_confirmation.rb +99 -0
  52. data/lib/univapay_client_sdk/models/simulation_plan_settings_type.rb +40 -0
  53. data/lib/univapay_client_sdk/models/subscription_create_request.rb +6 -1
  54. data/lib/univapay_client_sdk/models/subscription_simulation_payment.rb +169 -0
  55. data/lib/univapay_client_sdk/models/subscription_simulation_period.rb +61 -0
  56. data/lib/univapay_client_sdk/models/subscription_simulation_plan_settings.rb +100 -0
  57. data/lib/univapay_client_sdk/models/subscription_simulation_request.rb +177 -0
  58. data/lib/univapay_client_sdk/models/subscription_update_request.rb +65 -5
  59. data/lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb +23 -17
  60. data/lib/univapay_client_sdk/models/terminate_with_status.rb +37 -0
  61. data/lib/univapay_client_sdk/models/token_create_online_data.rb +5 -1
  62. data/lib/univapay_client_sdk/models/token_create_paidy_data.rb +121 -0
  63. data/lib/univapay_client_sdk/models/token_create_paidy_data_shipping_address.rb +129 -0
  64. data/lib/univapay_client_sdk/models/token_create_qr_merchant_data.rb +91 -0
  65. data/lib/univapay_client_sdk/models/token_create_qr_scan_data.rb +91 -0
  66. data/lib/univapay_client_sdk/models/token_response_online_data.rb +5 -1
  67. data/lib/univapay_client_sdk/models/token_response_paidy_data.rb +113 -0
  68. data/lib/univapay_client_sdk/models/token_response_paidy_data_shipping_address.rb +130 -0
  69. data/lib/univapay_client_sdk/models/token_response_qr_merchant_data.rb +105 -0
  70. data/lib/univapay_client_sdk/models/token_response_qr_scan_data.rb +92 -0
  71. data/lib/univapay_client_sdk/models/token_webhook_event.rb +7 -3
  72. data/lib/univapay_client_sdk/models/transaction_history_charge_type.rb +36 -0
  73. data/lib/univapay_client_sdk/models/transaction_history_item.rb +302 -0
  74. data/lib/univapay_client_sdk/models/transaction_history_list.rb +120 -0
  75. data/lib/univapay_client_sdk/models/transaction_history_mode.rb +42 -0
  76. data/lib/univapay_client_sdk/models/transaction_history_payment_type.rb +60 -0
  77. data/lib/univapay_client_sdk/models/transaction_history_refund.rb +127 -0
  78. data/lib/univapay_client_sdk/models/transaction_history_refund_reason.rb +56 -0
  79. data/lib/univapay_client_sdk/models/transaction_history_refund_status.rb +44 -0
  80. data/lib/univapay_client_sdk/models/transaction_history_service_provider.rb +96 -0
  81. data/lib/univapay_client_sdk/models/transaction_history_status.rb +57 -0
  82. data/lib/univapay_client_sdk/models/transaction_history_type.rb +36 -0
  83. data/lib/univapay_client_sdk/models/transaction_history_user_data.rb +214 -0
  84. data/lib/univapay_client_sdk/models/transaction_token_active_filter.rb +40 -0
  85. data/lib/univapay_client_sdk/models/{transaction_token.rb → transaction_token_base.rb} +31 -52
  86. data/lib/univapay_client_sdk/models/transaction_token_create_request_payment_type.rb +13 -1
  87. data/lib/univapay_client_sdk/models/transaction_token_list_type.rb +37 -0
  88. data/lib/univapay_client_sdk/models/transaction_token_payment_type.rb +9 -1
  89. data/lib/univapay_client_sdk/utilities/union_type_lookup.rb +70 -7
  90. data/lib/univapay_client_sdk.rb +76 -1
  91. data/test/apis/test_charges_api.rb +5 -4
  92. data/test/apis/test_checkout_api.rb +82 -0
  93. data/test/apis/test_merchants_api.rb +15 -1
  94. data/test/apis/test_stores_api.rb +42 -1
  95. data/test/apis/test_subscriptions_api.rb +144 -47
  96. data/test/apis/test_transaction_history_api.rb +180 -0
  97. data/test/apis/test_transaction_tokens_api.rb +106 -3
  98. data/test/events/webhooks/test_token_handler.rb +224 -0
  99. metadata +70 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60bb87fb05403484609586399d911107d01d8375c21bde02a4a815c97e129fcc
4
- data.tar.gz: 720da5f2d2dcd82ae63787f450ff9eb9b194fd316249ff7b8c9a64033b887e51
3
+ metadata.gz: 351a468b95fbc6680edd54b2a81ae7fd7ae67110cfd6ccc1461534816a8cd701
4
+ data.tar.gz: 952a7897e0a5a0b401837cefd9080850e33d1b622e652b57b24505fb25bea2e5
5
5
  SHA512:
6
- metadata.gz: bdb9e959c262b21e07263734d985a1e7dc5824de8faee747106571d769e79aa6b72dfcabd14af976f36d1f6d90d4ecd93410e82e7ce1e0838f7c40456ac89f21
7
- data.tar.gz: 184f32bc88f3c96fce994276cf357f70eb876a4793b278b3d5618c19c8164e390e3b54aba03da08a8592ca4de5cfa257bfc9cca448eca6fa9c22f27834a12f4f
6
+ metadata.gz: 9d2557bf0488aad54a3c6f75b58ae884162fe5643c820923f8d98bbac421ad60385b063ccab45080dd69aa9e14c803d2b46a97997dc200c10d9cf9e870cc246f
7
+ data.tar.gz: 1e984113af71cfa604ce77fbd89d5d3ab1878b963594f0a681270b6da1dad1fca6b1db12faf33261704e89e5f5118e2349ad3bd36fb25e0495426f0648ff50dc
data/README.md CHANGED
@@ -36,16 +36,16 @@ We will assume that all requests are going to originate from a backend server th
36
36
  Install the gem from the command line:
37
37
 
38
38
  ```bash
39
- gem install univapay-client-sdk -v 1.0.2
39
+ gem install univapay-client-sdk -v 1.1.0
40
40
  ```
41
41
 
42
42
  Or add the gem to your Gemfile and run `bundle`:
43
43
 
44
44
  ```ruby
45
- gem 'univapay-client-sdk', '1.0.2'
45
+ gem 'univapay-client-sdk', '1.1.0'
46
46
  ```
47
47
 
48
- For additional gem details, see the [RubyGems page for the univapay-client-sdk gem](https://rubygems.org/gems/univapay-client-sdk/versions/1.0.2).
48
+ For additional gem details, see the [RubyGems page for the univapay-client-sdk gem](https://rubygems.org/gems/univapay-client-sdk/versions/1.1.0).
49
49
 
50
50
  ## IRB Console Usage
51
51
 
@@ -173,6 +173,7 @@ This API uses the following authentication schemes.
173
173
 
174
174
  * [Transaction Tokens](doc/controllers/transaction-tokens.md)
175
175
  * [Direct Debit](doc/controllers/direct-debit.md)
176
+ * [Transaction History](doc/controllers/transaction-history.md)
176
177
  * [Charges](doc/controllers/charges.md)
177
178
  * [Refunds](doc/controllers/refunds.md)
178
179
  * [Subscriptions](doc/controllers/subscriptions.md)
@@ -180,6 +181,7 @@ This API uses the following authentication schemes.
180
181
  * [Merchants](doc/controllers/merchants.md)
181
182
  * [Stores](doc/controllers/stores.md)
182
183
  * [Webhooks](doc/controllers/webhooks.md)
184
+ * [Checkout](doc/controllers/checkout.md)
183
185
 
184
186
  ## Webhooks
185
187
 
@@ -10,7 +10,7 @@ module UnivapayClientSdk
10
10
  attr_accessor :config, :http_call_back
11
11
 
12
12
  def self.user_agent
13
- 'Ruby-SDK/1.0.2 (OS: {os-info}, Engine: {engine}/{engine-version})'
13
+ 'Ruby-SDK/1.1.0 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
14
  end
15
15
 
16
16
  def self.user_agent_parameters
@@ -427,21 +427,25 @@ module UnivapayClientSdk
427
427
 
428
428
  # Captures a previously authorized charge (where `capture` was set to false
429
429
  # during creation). The capture amount must be less than or equal to the
430
- # authorized amount, and the currency must match.
430
+ # authorized amount, and the currency must match. The request body — and
431
+ # both of its fields — is optional: if omitted entirely, the full
432
+ # outstanding authorized amount (in the originally requested currency) is
433
+ # captured.
431
434
  # @param [UUID | String] store_id Required parameter: The unique identifier
432
435
  # of the store.
433
436
  # @param [UUID | String] id Required parameter: The unique identifier of the
434
437
  # resource.
435
- # @param [ChargeCaptureRequest] body Required parameter: Request payload for
436
- # capturing an authorized charge.
437
438
  # @param [String] idempotency_key Optional parameter: An optional
438
439
  # idempotency key to prevent double charges and duplicate operations. We
439
440
  # recommend a randomly generated UUID (v4).
441
+ # @param [ChargeCaptureRequest] body Optional parameter: Optional request
442
+ # payload for capturing an authorized charge. Omit entirely to capture the
443
+ # full outstanding authorized amount.
440
444
  # @return [ApiResponse] Complete http response with raw body and status code.
441
445
  def capture_charge(store_id,
442
446
  id,
443
- body,
444
- idempotency_key: nil)
447
+ idempotency_key: nil,
448
+ body: nil)
445
449
  @api_call
446
450
  .request(new_request_builder(HttpMethodEnum::POST,
447
451
  '/stores/{storeId}/charges/{id}/capture',
@@ -453,9 +457,8 @@ module UnivapayClientSdk
453
457
  .is_required(true)
454
458
  .should_encode(true))
455
459
  .header_param(new_parameter('application/json', key: 'Content-Type'))
456
- .body_param(new_parameter(body)
457
- .is_required(true))
458
460
  .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
461
+ .body_param(new_parameter(body))
459
462
  .header_param(new_parameter('application/json', key: 'accept'))
460
463
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
461
464
  .auth(Single.new('JWT_TOKEN')))
@@ -0,0 +1,58 @@
1
+ # univapay_client_sdk
2
+ #
3
+ # This file was automatically generated for Univapay
4
+ # by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module UnivapayClientSdk
7
+ # CheckoutApi
8
+ class CheckoutApi < BaseApi
9
+ # Returns the merchant's checkout configuration: enabled payment methods and
10
+ # their limits, installment/subscription plan settings, convenience-store
11
+ # and bank-transfer settings, widget theme, and per-brand feature support.
12
+ # Resolved entirely from the bearer credential — takes no parameters.
13
+ # @return [ApiResponse] Complete http response with raw body and status code.
14
+ def get_checkout_info
15
+ @api_call
16
+ .request(new_request_builder(HttpMethodEnum::GET,
17
+ '/checkout_info',
18
+ Server::DEFAULT)
19
+ .header_param(new_parameter('application/json', key: 'accept'))
20
+ .auth(Single.new('JWT_TOKEN')))
21
+ .response(new_response_handler
22
+ .deserializer(APIHelper.method(:custom_type_deserializer))
23
+ .deserialize_into(CheckoutInfo.method(:from_hash))
24
+ .is_api_response(true)
25
+ .local_error_template('401',
26
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
27
+ ApiErrorException)
28
+ .local_error_template('403',
29
+ 'HTTP 403 Forbidden: {$response.body#/code}',
30
+ ApiErrorException)
31
+ .local_error_template('429',
32
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
33
+ APIException)
34
+ .local_error_template('400',
35
+ 'HTTP 400 Bad Request: {$response.body#/code}',
36
+ APIException)
37
+ .local_error_template('404',
38
+ 'HTTP 404 Not Found: {$response.body#/code}',
39
+ APIException)
40
+ .local_error_template('409',
41
+ 'HTTP 409 Conflict: {$response.body#/code}',
42
+ APIException)
43
+ .local_error_template('500',
44
+ 'HTTP 500 Server Error: {$response.body#/code}',
45
+ APIException)
46
+ .local_error_template('503',
47
+ 'HTTP 503 Unavailable: {$response.body#/code}',
48
+ APIException)
49
+ .local_error_template('504',
50
+ 'HTTP 504 Timeout: {$response.body#/code}',
51
+ APIException)
52
+ .local_error_template('default',
53
+ 'HTTP {$statusCode}: {$response.body#/code}',
54
+ APIException))
55
+ .execute
56
+ end
57
+ end
58
+ end
@@ -122,5 +122,68 @@ module UnivapayClientSdk
122
122
  APIException))
123
123
  .execute
124
124
  end
125
+
126
+ # Derives a deterministic, store-scoped UUID from a local customer
127
+ # identifier supplied by the merchant. Calling this endpoint again with the
128
+ # same `customer_id` for the same store always returns the same UUID — the
129
+ # operation has no side effects (nothing is persisted), so it is safe to
130
+ # call repeatedly and does not require an `Idempotency-Key`. App Token
131
+ # Secret is required.
132
+ # @param [UUID | String] store_id Required parameter: The unique identifier
133
+ # of the store.
134
+ # @param [CreateCustomerIdRequest] body Required parameter: Request payload
135
+ # for deriving a customer ID.
136
+ # @return [ApiResponse] Complete http response with raw body and status code.
137
+ def create_customer_id(store_id,
138
+ body)
139
+ @api_call
140
+ .request(new_request_builder(HttpMethodEnum::POST,
141
+ '/stores/{storeId}/create_customer_id',
142
+ Server::DEFAULT)
143
+ .template_param(new_parameter(store_id, key: 'storeId')
144
+ .is_required(true)
145
+ .should_encode(true))
146
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
147
+ .body_param(new_parameter(body)
148
+ .is_required(true))
149
+ .header_param(new_parameter('application/json', key: 'accept'))
150
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
151
+ .auth(Single.new('JWT_TOKEN')))
152
+ .response(new_response_handler
153
+ .deserializer(APIHelper.method(:custom_type_deserializer))
154
+ .deserialize_into(CreateCustomerIdResponse.method(:from_hash))
155
+ .is_api_response(true)
156
+ .local_error_template('400',
157
+ 'HTTP 400 Bad Request: {$response.body#/code}',
158
+ ApiErrorException)
159
+ .local_error_template('401',
160
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
161
+ ApiErrorException)
162
+ .local_error_template('403',
163
+ 'HTTP 403 Forbidden: {$response.body#/code}',
164
+ ApiErrorException)
165
+ .local_error_template('404',
166
+ 'HTTP 404 Not Found: {$response.body#/code}',
167
+ ApiErrorException)
168
+ .local_error_template('429',
169
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
170
+ APIException)
171
+ .local_error_template('409',
172
+ 'HTTP 409 Conflict: {$response.body#/code}',
173
+ APIException)
174
+ .local_error_template('500',
175
+ 'HTTP 500 Server Error: {$response.body#/code}',
176
+ APIException)
177
+ .local_error_template('503',
178
+ 'HTTP 503 Unavailable: {$response.body#/code}',
179
+ APIException)
180
+ .local_error_template('504',
181
+ 'HTTP 504 Timeout: {$response.body#/code}',
182
+ APIException)
183
+ .local_error_template('default',
184
+ 'HTTP {$statusCode}: {$response.body#/code}',
185
+ APIException))
186
+ .execute
187
+ end
125
188
  end
126
189
  end
@@ -63,6 +63,11 @@ module UnivapayClientSdk
63
63
  end
64
64
 
65
65
  # Lists all subscriptions across all stores.
66
+ # @param [String] search Optional parameter: Search by metadata values.
67
+ # @param [SubscriptionStatus] status Optional parameter: Filter
68
+ # subscriptions by current status.
69
+ # @param [ChargeMode] mode Optional parameter: Filter subscriptions by
70
+ # processing mode.
66
71
  # @param [Integer] limit Optional parameter: Maximum number of resources to
67
72
  # return in one page.
68
73
  # @param [UUID | String] cursor Optional parameter: Cursor pointing to the
@@ -70,13 +75,19 @@ module UnivapayClientSdk
70
75
  # @param [CursorDirectionQuery] cursor_direction Optional parameter:
71
76
  # Pagination direction relative to the supplied cursor.
72
77
  # @return [ApiResponse] Complete http response with raw body and status code.
73
- def list_all_subscriptions(limit: 10,
78
+ def list_all_subscriptions(search: nil,
79
+ status: nil,
80
+ mode: nil,
81
+ limit: 10,
74
82
  cursor: nil,
75
83
  cursor_direction: CursorDirectionQuery::DESC)
76
84
  @api_call
77
85
  .request(new_request_builder(HttpMethodEnum::GET,
78
86
  '/subscriptions',
79
87
  Server::DEFAULT)
88
+ .query_param(new_parameter(search, key: 'search'))
89
+ .query_param(new_parameter(status, key: 'status'))
90
+ .query_param(new_parameter(mode, key: 'mode'))
80
91
  .query_param(new_parameter(limit, key: 'limit'))
81
92
  .query_param(new_parameter(cursor, key: 'cursor'))
82
93
  .query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
@@ -119,6 +130,66 @@ module UnivapayClientSdk
119
130
  .execute
120
131
  end
121
132
 
133
+ # Simulates the payment schedule that a subscription would follow, without
134
+ # creating a live subscription or a transaction token. Returns a bare array
135
+ # of the scheduled payments that would result from the given amount,
136
+ # currency, period (or cyclical period), and plan settings.
137
+ # @param [String] idempotency_key Optional parameter: An optional
138
+ # idempotency key to prevent double charges and duplicate operations. We
139
+ # recommend a randomly generated UUID (v4).
140
+ # @param [SubscriptionSimulationRequest] body Optional parameter:
141
+ # Subscription Plan Simulation request
142
+ # @return [ApiResponse] Complete http response with raw body and status code.
143
+ def simulate_subscription_plan(idempotency_key: nil,
144
+ body: nil)
145
+ @api_call
146
+ .request(new_request_builder(HttpMethodEnum::POST,
147
+ '/subscriptions/simulate_plan',
148
+ Server::DEFAULT)
149
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
150
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
151
+ .body_param(new_parameter(body))
152
+ .header_param(new_parameter('application/json', key: 'accept'))
153
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
154
+ .auth(Single.new('JWT_TOKEN')))
155
+ .response(new_response_handler
156
+ .deserializer(APIHelper.method(:custom_type_deserializer))
157
+ .deserialize_into(SubscriptionSimulationPayment.method(:from_hash))
158
+ .is_api_response(true)
159
+ .is_response_array(true)
160
+ .local_error_template('400',
161
+ 'HTTP 400 Bad Request: {$response.body#/code}',
162
+ ApiErrorException)
163
+ .local_error_template('401',
164
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
165
+ ApiErrorException)
166
+ .local_error_template('403',
167
+ 'HTTP 403 Forbidden: {$response.body#/code}',
168
+ ApiErrorException)
169
+ .local_error_template('429',
170
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
171
+ APIException)
172
+ .local_error_template('404',
173
+ 'HTTP 404 Not Found: {$response.body#/code}',
174
+ APIException)
175
+ .local_error_template('409',
176
+ 'HTTP 409 Conflict: {$response.body#/code}',
177
+ APIException)
178
+ .local_error_template('500',
179
+ 'HTTP 500 Server Error: {$response.body#/code}',
180
+ APIException)
181
+ .local_error_template('503',
182
+ 'HTTP 503 Unavailable: {$response.body#/code}',
183
+ APIException)
184
+ .local_error_template('504',
185
+ 'HTTP 504 Timeout: {$response.body#/code}',
186
+ APIException)
187
+ .local_error_template('default',
188
+ 'HTTP {$statusCode}: {$response.body#/code}',
189
+ APIException))
190
+ .execute
191
+ end
192
+
122
193
  # Lists all subscriptions for a specific store.
123
194
  # @param [UUID | String] store_id Required parameter: The unique identifier
124
195
  # of the store.
@@ -193,6 +264,73 @@ module UnivapayClientSdk
193
264
  .execute
194
265
  end
195
266
 
267
+ # Simulates the payment schedule that a subscription would follow for a
268
+ # specific store, without creating a live subscription or a transaction
269
+ # token. Returns a bare array of the scheduled payments that would result
270
+ # from the given amount, currency, period (or cyclical period), and plan
271
+ # settings.
272
+ # @param [UUID | String] store_id Required parameter: The unique identifier
273
+ # of the store.
274
+ # @param [String] idempotency_key Optional parameter: An optional
275
+ # idempotency key to prevent double charges and duplicate operations. We
276
+ # recommend a randomly generated UUID (v4).
277
+ # @param [SubscriptionSimulationRequest] body Optional parameter:
278
+ # Subscription Plan Simulation request
279
+ # @return [ApiResponse] Complete http response with raw body and status code.
280
+ def simulate_store_subscription_plan(store_id,
281
+ idempotency_key: nil,
282
+ body: nil)
283
+ @api_call
284
+ .request(new_request_builder(HttpMethodEnum::POST,
285
+ '/stores/{storeId}/subscriptions/simulate_plan',
286
+ Server::DEFAULT)
287
+ .template_param(new_parameter(store_id, key: 'storeId')
288
+ .is_required(true)
289
+ .should_encode(true))
290
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
291
+ .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
292
+ .body_param(new_parameter(body))
293
+ .header_param(new_parameter('application/json', key: 'accept'))
294
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
295
+ .auth(Single.new('JWT_TOKEN')))
296
+ .response(new_response_handler
297
+ .deserializer(APIHelper.method(:custom_type_deserializer))
298
+ .deserialize_into(SubscriptionSimulationPayment.method(:from_hash))
299
+ .is_api_response(true)
300
+ .is_response_array(true)
301
+ .local_error_template('400',
302
+ 'HTTP 400 Bad Request: {$response.body#/code}',
303
+ ApiErrorException)
304
+ .local_error_template('401',
305
+ 'HTTP 401 Unauthorized: {$response.body#/code}',
306
+ ApiErrorException)
307
+ .local_error_template('403',
308
+ 'HTTP 403 Forbidden: {$response.body#/code}',
309
+ ApiErrorException)
310
+ .local_error_template('429',
311
+ 'HTTP 429 Rate Limited: {$response.body#/code}',
312
+ APIException)
313
+ .local_error_template('404',
314
+ 'HTTP 404 Not Found: {$response.body#/code}',
315
+ APIException)
316
+ .local_error_template('409',
317
+ 'HTTP 409 Conflict: {$response.body#/code}',
318
+ APIException)
319
+ .local_error_template('500',
320
+ 'HTTP 500 Server Error: {$response.body#/code}',
321
+ APIException)
322
+ .local_error_template('503',
323
+ 'HTTP 503 Unavailable: {$response.body#/code}',
324
+ APIException)
325
+ .local_error_template('504',
326
+ 'HTTP 504 Timeout: {$response.body#/code}',
327
+ APIException)
328
+ .local_error_template('default',
329
+ 'HTTP {$statusCode}: {$response.body#/code}',
330
+ APIException))
331
+ .execute
332
+ end
333
+
196
334
  # Retrieves the details of an existing subscription. Supports internal
197
335
  # polling to wait for status changes.
198
336
  # @param [UUID | String] store_id Required parameter: The unique identifier