payzu-pix 2.0.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 (172) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +231 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccountApi.md +141 -0
  6. data/docs/ApiErrorDetailsInner.md +20 -0
  7. data/docs/BankStatement.md +42 -0
  8. data/docs/BankStatementListResponse.md +20 -0
  9. data/docs/BankStatementListResponsePagination.md +22 -0
  10. data/docs/CallbackDetail.md +34 -0
  11. data/docs/CallbackListResponse.md +20 -0
  12. data/docs/CallbackListResponsePagination.md +22 -0
  13. data/docs/CallbackSecretResponse.md +20 -0
  14. data/docs/CallbacksApi.md +587 -0
  15. data/docs/Defense.md +30 -0
  16. data/docs/DefenseFilesInner.md +24 -0
  17. data/docs/DefenseHistoryEntry.md +28 -0
  18. data/docs/DefenseHistoryEntryFilesInner.md +22 -0
  19. data/docs/DepositPending.md +62 -0
  20. data/docs/DepositPendingListResponse.md +24 -0
  21. data/docs/DictConsultResponse.md +30 -0
  22. data/docs/DownloadUserReport200Response.md +20 -0
  23. data/docs/EnqueuedCallback.md +18 -0
  24. data/docs/EnqueuedCallbackEnqueued.md +22 -0
  25. data/docs/EnqueuedCallbackItem.md +22 -0
  26. data/docs/ErrorResponse.md +32 -0
  27. data/docs/GetUser200Response.md +46 -0
  28. data/docs/GetUser200ResponseDailyWithdrawLimit.md +24 -0
  29. data/docs/GetUser200ResponseServiceFee.md +28 -0
  30. data/docs/GetUserBalance200Response.md +20 -0
  31. data/docs/GetUserTransactionById200Response.md +94 -0
  32. data/docs/GetUserTransactionById200ResponseAllOfCallbackLogInner.md +26 -0
  33. data/docs/GetUserTransactionById200ResponseAllOfInfractionInner.md +24 -0
  34. data/docs/GetUserTransactions200Response.md +22 -0
  35. data/docs/InfractionDetail.md +40 -0
  36. data/docs/InfractionDetailTransaction.md +30 -0
  37. data/docs/InfractionListResponse.md +20 -0
  38. data/docs/InfractionListResponsePagination.md +24 -0
  39. data/docs/InfractionsApi.md +413 -0
  40. data/docs/InternalTransferApi.md +153 -0
  41. data/docs/KeysAndDICTApi.md +217 -0
  42. data/docs/ListUserReports200Response.md +22 -0
  43. data/docs/PixKeyInfo.md +36 -0
  44. data/docs/PixOperationsApi.md +299 -0
  45. data/docs/PostInternalTransferRequest.md +30 -0
  46. data/docs/PostPixQrcodeReadRequest.md +18 -0
  47. data/docs/PostPixRequest.md +32 -0
  48. data/docs/PostUserReportRequest.md +24 -0
  49. data/docs/PostWithdrawQrcodeRequest.md +28 -0
  50. data/docs/PostWithdrawRequest.md +30 -0
  51. data/docs/ProofResponse.md +18 -0
  52. data/docs/QRCodeReadResponse.md +38 -0
  53. data/docs/Refund.md +34 -0
  54. data/docs/RefundRequest.md +22 -0
  55. data/docs/RefundsApi.md +79 -0
  56. data/docs/ReportJob.md +30 -0
  57. data/docs/ReportJobAccepted.md +30 -0
  58. data/docs/ReportJobDetail.md +30 -0
  59. data/docs/ReportsApi.md +881 -0
  60. data/docs/ResendUserCallbackSingle200Response.md +18 -0
  61. data/docs/ResendUserCallbacks200Response.md +20 -0
  62. data/docs/ResendUserCallbacksRequest.md +28 -0
  63. data/docs/ResendWebhookCallbacksRequest.md +30 -0
  64. data/docs/RotateCallbackSecretResponse.md +18 -0
  65. data/docs/RotateSecretResponse.md +18 -0
  66. data/docs/SentWebhookDetail.md +40 -0
  67. data/docs/SentWebhookDetailResponse.md +18 -0
  68. data/docs/SentWebhooksQuantity.md +18 -0
  69. data/docs/Summary.md +26 -0
  70. data/docs/SummaryBlock.md +24 -0
  71. data/docs/SummaryBlockGroupedInner.md +20 -0
  72. data/docs/SummaryBlockStatuses.md +26 -0
  73. data/docs/SummaryStatus.md +22 -0
  74. data/docs/Transaction.md +90 -0
  75. data/docs/TransactionWithRefunds.md +92 -0
  76. data/docs/Webhook.md +30 -0
  77. data/docs/WebhookCreateRequest.md +24 -0
  78. data/docs/WebhookEventType.md +15 -0
  79. data/docs/WebhookListResponse.md +18 -0
  80. data/docs/WebhookUpdateRequest.md +22 -0
  81. data/docs/WebhookWithSecret.md +32 -0
  82. data/docs/WebhooksApi.md +574 -0
  83. data/docs/WithdrawalsApi.md +299 -0
  84. data/git_push.sh +57 -0
  85. data/lib/payzu-pix/api/account_api.rb +136 -0
  86. data/lib/payzu-pix/api/callbacks_api.rb +577 -0
  87. data/lib/payzu-pix/api/infractions_api.rb +452 -0
  88. data/lib/payzu-pix/api/internal_transfer_api.rb +164 -0
  89. data/lib/payzu-pix/api/keys_and_dict_api.rb +234 -0
  90. data/lib/payzu-pix/api/pix_operations_api.rb +300 -0
  91. data/lib/payzu-pix/api/refunds_api.rb +96 -0
  92. data/lib/payzu-pix/api/reports_api.rb +968 -0
  93. data/lib/payzu-pix/api/webhooks_api.rb +542 -0
  94. data/lib/payzu-pix/api/withdrawals_api.rb +305 -0
  95. data/lib/payzu-pix/api_client.rb +441 -0
  96. data/lib/payzu-pix/api_error.rb +58 -0
  97. data/lib/payzu-pix/api_model_base.rb +88 -0
  98. data/lib/payzu-pix/configuration.rb +392 -0
  99. data/lib/payzu-pix/models/api_error_details_inner.rb +192 -0
  100. data/lib/payzu-pix/models/bank_statement.rb +296 -0
  101. data/lib/payzu-pix/models/bank_statement_list_response.rb +159 -0
  102. data/lib/payzu-pix/models/bank_statement_list_response_pagination.rb +169 -0
  103. data/lib/payzu-pix/models/callback_detail.rb +228 -0
  104. data/lib/payzu-pix/models/callback_list_response.rb +159 -0
  105. data/lib/payzu-pix/models/callback_list_response_pagination.rb +169 -0
  106. data/lib/payzu-pix/models/callback_secret_response.rb +158 -0
  107. data/lib/payzu-pix/models/defense.rb +234 -0
  108. data/lib/payzu-pix/models/defense_files_inner.rb +179 -0
  109. data/lib/payzu-pix/models/defense_history_entry.rb +225 -0
  110. data/lib/payzu-pix/models/defense_history_entry_files_inner.rb +168 -0
  111. data/lib/payzu-pix/models/deposit_pending.rb +407 -0
  112. data/lib/payzu-pix/models/deposit_pending_list_response.rb +180 -0
  113. data/lib/payzu-pix/models/dict_consult_response.rb +231 -0
  114. data/lib/payzu-pix/models/download_user_report200_response.rb +158 -0
  115. data/lib/payzu-pix/models/enqueued_callback.rb +147 -0
  116. data/lib/payzu-pix/models/enqueued_callback_enqueued.rb +170 -0
  117. data/lib/payzu-pix/models/enqueued_callback_item.rb +190 -0
  118. data/lib/payzu-pix/models/error_response.rb +336 -0
  119. data/lib/payzu-pix/models/get_user200_response.rb +334 -0
  120. data/lib/payzu-pix/models/get_user200_response_daily_withdraw_limit.rb +180 -0
  121. data/lib/payzu-pix/models/get_user200_response_service_fee.rb +199 -0
  122. data/lib/payzu-pix/models/get_user_balance200_response.rb +158 -0
  123. data/lib/payzu-pix/models/get_user_transaction_by_id200_response.rb +595 -0
  124. data/lib/payzu-pix/models/get_user_transaction_by_id200_response_all_of_callback_log_inner.rb +188 -0
  125. data/lib/payzu-pix/models/get_user_transaction_by_id200_response_all_of_infraction_inner.rb +202 -0
  126. data/lib/payzu-pix/models/get_user_transactions200_response.rb +170 -0
  127. data/lib/payzu-pix/models/infraction_detail.rb +293 -0
  128. data/lib/payzu-pix/models/infraction_detail_transaction.rb +213 -0
  129. data/lib/payzu-pix/models/infraction_list_response.rb +159 -0
  130. data/lib/payzu-pix/models/infraction_list_response_pagination.rb +179 -0
  131. data/lib/payzu-pix/models/list_user_reports200_response.rb +170 -0
  132. data/lib/payzu-pix/models/pix_key_info.rb +263 -0
  133. data/lib/payzu-pix/models/post_internal_transfer_request.rb +377 -0
  134. data/lib/payzu-pix/models/post_pix_qrcode_read_request.rb +174 -0
  135. data/lib/payzu-pix/models/post_pix_request.rb +382 -0
  136. data/lib/payzu-pix/models/post_user_report_request.rb +238 -0
  137. data/lib/payzu-pix/models/post_withdraw_qrcode_request.rb +302 -0
  138. data/lib/payzu-pix/models/post_withdraw_request.rb +350 -0
  139. data/lib/payzu-pix/models/proof_response.rb +148 -0
  140. data/lib/payzu-pix/models/qr_code_read_response.rb +283 -0
  141. data/lib/payzu-pix/models/refund.rb +257 -0
  142. data/lib/payzu-pix/models/refund_request.rb +215 -0
  143. data/lib/payzu-pix/models/report_job.rb +234 -0
  144. data/lib/payzu-pix/models/report_job_accepted.rb +237 -0
  145. data/lib/payzu-pix/models/report_job_detail.rb +237 -0
  146. data/lib/payzu-pix/models/resend_user_callback_single200_response.rb +148 -0
  147. data/lib/payzu-pix/models/resend_user_callbacks200_response.rb +158 -0
  148. data/lib/payzu-pix/models/resend_user_callbacks_request.rb +262 -0
  149. data/lib/payzu-pix/models/resend_webhook_callbacks_request.rb +274 -0
  150. data/lib/payzu-pix/models/rotate_callback_secret_response.rb +148 -0
  151. data/lib/payzu-pix/models/rotate_secret_response.rb +148 -0
  152. data/lib/payzu-pix/models/sent_webhook_detail.rb +261 -0
  153. data/lib/payzu-pix/models/sent_webhook_detail_response.rb +164 -0
  154. data/lib/payzu-pix/models/sent_webhooks_quantity.rb +148 -0
  155. data/lib/payzu-pix/models/summary.rb +188 -0
  156. data/lib/payzu-pix/models/summary_block.rb +179 -0
  157. data/lib/payzu-pix/models/summary_block_grouped_inner.rb +158 -0
  158. data/lib/payzu-pix/models/summary_block_statuses.rb +189 -0
  159. data/lib/payzu-pix/models/summary_status.rb +168 -0
  160. data/lib/payzu-pix/models/transaction.rb +588 -0
  161. data/lib/payzu-pix/models/transaction_with_refunds.rb +583 -0
  162. data/lib/payzu-pix/models/webhook.rb +210 -0
  163. data/lib/payzu-pix/models/webhook_create_request.rb +201 -0
  164. data/lib/payzu-pix/models/webhook_event_type.rb +47 -0
  165. data/lib/payzu-pix/models/webhook_list_response.rb +150 -0
  166. data/lib/payzu-pix/models/webhook_update_request.rb +171 -0
  167. data/lib/payzu-pix/models/webhook_with_secret.rb +220 -0
  168. data/lib/payzu-pix/version.rb +15 -0
  169. data/lib/payzu-pix.rb +119 -0
  170. data/payzu-pix.gemspec +41 -0
  171. data/spec/spec_helper.rb +111 -0
  172. metadata +283 -0
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #PayZu Pix API
3
+
4
+ #REST API for Pix operations on the PayZu platform, deposits, withdrawals, internal transfers, infractions, reports, and callback inspection. All amounts are in BRL (reais) unless explicitly noted. Authentication uses a Bearer token issued during onboarding. ## SDKs oficiais - Node.js: `npm install payzu-pix` - Python: `pip install payzu-pix` - PHP: `composer require payzu/pix` - Ruby: `gem install payzu-pix` - Java: `br.com.payzu:payzu-pix` (Maven Central) - Go: `go get github.com/PayZuAI/payzu-sdks/go/v2` Repo: https://github.com/PayZuAI/payzu-sdks
5
+
6
+ The version of the OpenAPI document: 1.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PayZuPix
17
+ class PostWithdrawQrcodeRequest < ApiModelBase
18
+ # Pix QR Code payload (EMV format).
19
+ attr_accessor :qr_code
20
+
21
+ # Amount in BRL, with at most 2 decimal places. Optional: if not provided, uses the QR Code's embedded value.
22
+ attr_accessor :amount
23
+
24
+ # URL for transaction notifications (http or https).
25
+ attr_accessor :callback_url
26
+
27
+ # Optional description for the payment.
28
+ attr_accessor :description
29
+
30
+ # External reference for this withdrawal. Repeating it with the same amount and QR Code returns the existing withdrawal; with different data, the request is rejected with PZC210.
31
+ attr_accessor :client_reference
32
+
33
+ # Virtual sub-account (up to 50 characters) to correlate stores, branches, marketplaces. Returned in the callback.
34
+ attr_accessor :virtual_account
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'qr_code' => :'qrCode',
40
+ :'amount' => :'amount',
41
+ :'callback_url' => :'callbackUrl',
42
+ :'description' => :'description',
43
+ :'client_reference' => :'clientReference',
44
+ :'virtual_account' => :'virtualAccount'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'qr_code' => :'String',
62
+ :'amount' => :'Float',
63
+ :'callback_url' => :'String',
64
+ :'description' => :'String',
65
+ :'client_reference' => :'String',
66
+ :'virtual_account' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PayZuPix::PostWithdrawQrcodeRequest` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PayZuPix::PostWithdrawQrcodeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'qr_code')
93
+ self.qr_code = attributes[:'qr_code']
94
+ else
95
+ self.qr_code = nil
96
+ end
97
+
98
+ if attributes.key?(:'amount')
99
+ self.amount = attributes[:'amount']
100
+ end
101
+
102
+ if attributes.key?(:'callback_url')
103
+ self.callback_url = attributes[:'callback_url']
104
+ end
105
+
106
+ if attributes.key?(:'description')
107
+ self.description = attributes[:'description']
108
+ end
109
+
110
+ if attributes.key?(:'client_reference')
111
+ self.client_reference = attributes[:'client_reference']
112
+ end
113
+
114
+ if attributes.key?(:'virtual_account')
115
+ self.virtual_account = attributes[:'virtual_account']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ if @qr_code.nil?
125
+ invalid_properties.push('invalid value for "qr_code", qr_code cannot be nil.')
126
+ end
127
+
128
+ if !@amount.nil? && @amount < 0.1
129
+ invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.1.')
130
+ end
131
+
132
+ pattern = Regexp.new(/^https?:\/\//)
133
+ if !@callback_url.nil? && @callback_url !~ pattern
134
+ invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.")
135
+ end
136
+
137
+ if !@client_reference.nil? && @client_reference.to_s.length > 64
138
+ invalid_properties.push('invalid value for "client_reference", the character length must be smaller than or equal to 64.')
139
+ end
140
+
141
+ if !@virtual_account.nil? && @virtual_account.to_s.length > 50
142
+ invalid_properties.push('invalid value for "virtual_account", the character length must be smaller than or equal to 50.')
143
+ end
144
+
145
+ if !@virtual_account.nil? && @virtual_account.to_s.length < 1
146
+ invalid_properties.push('invalid value for "virtual_account", the character length must be greater than or equal to 1.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @qr_code.nil?
157
+ return false if !@amount.nil? && @amount < 0.1
158
+ return false if !@callback_url.nil? && @callback_url !~ Regexp.new(/^https?:\/\//)
159
+ return false if !@client_reference.nil? && @client_reference.to_s.length > 64
160
+ return false if !@virtual_account.nil? && @virtual_account.to_s.length > 50
161
+ return false if !@virtual_account.nil? && @virtual_account.to_s.length < 1
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] qr_code Value to be assigned
167
+ def qr_code=(qr_code)
168
+ if qr_code.nil?
169
+ fail ArgumentError, 'qr_code cannot be nil'
170
+ end
171
+
172
+ @qr_code = qr_code
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] amount Value to be assigned
177
+ def amount=(amount)
178
+ if amount.nil?
179
+ fail ArgumentError, 'amount cannot be nil'
180
+ end
181
+
182
+ if amount < 0.1
183
+ fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.1.'
184
+ end
185
+
186
+ @amount = amount
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] callback_url Value to be assigned
191
+ def callback_url=(callback_url)
192
+ if callback_url.nil?
193
+ fail ArgumentError, 'callback_url cannot be nil'
194
+ end
195
+
196
+ pattern = Regexp.new(/^https?:\/\//)
197
+ if callback_url !~ pattern
198
+ fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}."
199
+ end
200
+
201
+ @callback_url = callback_url
202
+ end
203
+
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] client_reference Value to be assigned
206
+ def client_reference=(client_reference)
207
+ if client_reference.nil?
208
+ fail ArgumentError, 'client_reference cannot be nil'
209
+ end
210
+
211
+ if client_reference.to_s.length > 64
212
+ fail ArgumentError, 'invalid value for "client_reference", the character length must be smaller than or equal to 64.'
213
+ end
214
+
215
+ @client_reference = client_reference
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] virtual_account Value to be assigned
220
+ def virtual_account=(virtual_account)
221
+ if virtual_account.nil?
222
+ fail ArgumentError, 'virtual_account cannot be nil'
223
+ end
224
+
225
+ if virtual_account.to_s.length > 50
226
+ fail ArgumentError, 'invalid value for "virtual_account", the character length must be smaller than or equal to 50.'
227
+ end
228
+
229
+ if virtual_account.to_s.length < 1
230
+ fail ArgumentError, 'invalid value for "virtual_account", the character length must be greater than or equal to 1.'
231
+ end
232
+
233
+ @virtual_account = virtual_account
234
+ end
235
+
236
+ # Checks equality by comparing each attribute.
237
+ # @param [Object] Object to be compared
238
+ def ==(o)
239
+ return true if self.equal?(o)
240
+ self.class == o.class &&
241
+ qr_code == o.qr_code &&
242
+ amount == o.amount &&
243
+ callback_url == o.callback_url &&
244
+ description == o.description &&
245
+ client_reference == o.client_reference &&
246
+ virtual_account == o.virtual_account
247
+ end
248
+
249
+ # @see the `==` method
250
+ # @param [Object] Object to be compared
251
+ def eql?(o)
252
+ self == o
253
+ end
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Integer] Hash code
257
+ def hash
258
+ [qr_code, amount, callback_url, description, client_reference, virtual_account].hash
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def self.build_from_hash(attributes)
265
+ return nil unless attributes.is_a?(Hash)
266
+ attributes = attributes.transform_keys(&:to_sym)
267
+ transformed_hash = {}
268
+ openapi_types.each_pair do |key, type|
269
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
270
+ transformed_hash["#{key}"] = nil
271
+ elsif type =~ /\AArray<(.*)>/i
272
+ # check to ensure the input is an array given that the attribute
273
+ # is documented as an array but the input is not
274
+ if attributes[attribute_map[key]].is_a?(Array)
275
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
276
+ end
277
+ elsif !attributes[attribute_map[key]].nil?
278
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
279
+ end
280
+ end
281
+ new(transformed_hash)
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ if value.nil?
291
+ is_nullable = self.class.openapi_nullable.include?(attr)
292
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
+ end
294
+
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,350 @@
1
+ =begin
2
+ #PayZu Pix API
3
+
4
+ #REST API for Pix operations on the PayZu platform, deposits, withdrawals, internal transfers, infractions, reports, and callback inspection. All amounts are in BRL (reais) unless explicitly noted. Authentication uses a Bearer token issued during onboarding. ## SDKs oficiais - Node.js: `npm install payzu-pix` - Python: `pip install payzu-pix` - PHP: `composer require payzu/pix` - Ruby: `gem install payzu-pix` - Java: `br.com.payzu:payzu-pix` (Maven Central) - Go: `go get github.com/PayZuAI/payzu-sdks/go/v2` Repo: https://github.com/PayZuAI/payzu-sdks
5
+
6
+ The version of the OpenAPI document: 1.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PayZuPix
17
+ class PostWithdrawRequest < ApiModelBase
18
+ # Amount in BRL, with at most 2 decimal places. Must be >= 0.01.
19
+ attr_accessor :amount
20
+
21
+ # Destination Pix key in the format of pixType: CPF or CNPJ with valid check digits and no punctuation, phone as +55 followed by area code and number, email, or random key (EVP).
22
+ attr_accessor :pix_key
23
+
24
+ # Pix key type.
25
+ attr_accessor :pix_type
26
+
27
+ # URL for transaction notifications (http or https).
28
+ attr_accessor :callback_url
29
+
30
+ # External reference for this withdrawal. Repeating it with the same amount and key returns the existing withdrawal; with different data, the request is rejected with PZC210.
31
+ attr_accessor :client_reference
32
+
33
+ # Optional description.
34
+ attr_accessor :description
35
+
36
+ # Virtual sub-account (up to 50 characters) to correlate stores, branches, marketplaces. Returned in the callback.
37
+ attr_accessor :virtual_account
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'amount' => :'amount',
65
+ :'pix_key' => :'pixKey',
66
+ :'pix_type' => :'pixType',
67
+ :'callback_url' => :'callbackUrl',
68
+ :'client_reference' => :'clientReference',
69
+ :'description' => :'description',
70
+ :'virtual_account' => :'virtualAccount'
71
+ }
72
+ end
73
+
74
+ # Returns attribute mapping this model knows about
75
+ def self.acceptable_attribute_map
76
+ attribute_map
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ acceptable_attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'amount' => :'Float',
88
+ :'pix_key' => :'String',
89
+ :'pix_type' => :'String',
90
+ :'callback_url' => :'String',
91
+ :'client_reference' => :'String',
92
+ :'description' => :'String',
93
+ :'virtual_account' => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PayZuPix::PostWithdrawRequest` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ acceptable_attribute_map = self.class.acceptable_attribute_map
112
+ attributes = attributes.each_with_object({}) { |(k, v), h|
113
+ if (!acceptable_attribute_map.key?(k.to_sym))
114
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PayZuPix::PostWithdrawRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
115
+ end
116
+ h[k.to_sym] = v
117
+ }
118
+
119
+ if attributes.key?(:'amount')
120
+ self.amount = attributes[:'amount']
121
+ else
122
+ self.amount = nil
123
+ end
124
+
125
+ if attributes.key?(:'pix_key')
126
+ self.pix_key = attributes[:'pix_key']
127
+ else
128
+ self.pix_key = nil
129
+ end
130
+
131
+ if attributes.key?(:'pix_type')
132
+ self.pix_type = attributes[:'pix_type']
133
+ else
134
+ self.pix_type = nil
135
+ end
136
+
137
+ if attributes.key?(:'callback_url')
138
+ self.callback_url = attributes[:'callback_url']
139
+ end
140
+
141
+ if attributes.key?(:'client_reference')
142
+ self.client_reference = attributes[:'client_reference']
143
+ end
144
+
145
+ if attributes.key?(:'description')
146
+ self.description = attributes[:'description']
147
+ end
148
+
149
+ if attributes.key?(:'virtual_account')
150
+ self.virtual_account = attributes[:'virtual_account']
151
+ end
152
+ end
153
+
154
+ # Show invalid properties with the reasons. Usually used together with valid?
155
+ # @return Array for valid properties with the reasons
156
+ def list_invalid_properties
157
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
158
+ invalid_properties = Array.new
159
+ if @amount.nil?
160
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
161
+ end
162
+
163
+ if @amount < 0.01
164
+ invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.01.')
165
+ end
166
+
167
+ if @pix_key.nil?
168
+ invalid_properties.push('invalid value for "pix_key", pix_key cannot be nil.')
169
+ end
170
+
171
+ if @pix_type.nil?
172
+ invalid_properties.push('invalid value for "pix_type", pix_type cannot be nil.')
173
+ end
174
+
175
+ pattern = Regexp.new(/^https?:\/\//)
176
+ if !@callback_url.nil? && @callback_url !~ pattern
177
+ invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.")
178
+ end
179
+
180
+ if !@client_reference.nil? && @client_reference.to_s.length > 64
181
+ invalid_properties.push('invalid value for "client_reference", the character length must be smaller than or equal to 64.')
182
+ end
183
+
184
+ if !@virtual_account.nil? && @virtual_account.to_s.length > 50
185
+ invalid_properties.push('invalid value for "virtual_account", the character length must be smaller than or equal to 50.')
186
+ end
187
+
188
+ if !@virtual_account.nil? && @virtual_account.to_s.length < 1
189
+ invalid_properties.push('invalid value for "virtual_account", the character length must be greater than or equal to 1.')
190
+ end
191
+
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ return false if @amount.nil?
200
+ return false if @amount < 0.01
201
+ return false if @pix_key.nil?
202
+ return false if @pix_type.nil?
203
+ pix_type_validator = EnumAttributeValidator.new('String', ["cpf", "cnpj", "phone", "email", "evp"])
204
+ return false unless pix_type_validator.valid?(@pix_type)
205
+ return false if !@callback_url.nil? && @callback_url !~ Regexp.new(/^https?:\/\//)
206
+ return false if !@client_reference.nil? && @client_reference.to_s.length > 64
207
+ return false if !@virtual_account.nil? && @virtual_account.to_s.length > 50
208
+ return false if !@virtual_account.nil? && @virtual_account.to_s.length < 1
209
+ true
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] amount Value to be assigned
214
+ def amount=(amount)
215
+ if amount.nil?
216
+ fail ArgumentError, 'amount cannot be nil'
217
+ end
218
+
219
+ if amount < 0.01
220
+ fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.01.'
221
+ end
222
+
223
+ @amount = amount
224
+ end
225
+
226
+ # Custom attribute writer method with validation
227
+ # @param [Object] pix_key Value to be assigned
228
+ def pix_key=(pix_key)
229
+ if pix_key.nil?
230
+ fail ArgumentError, 'pix_key cannot be nil'
231
+ end
232
+
233
+ @pix_key = pix_key
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] callback_url Value to be assigned
238
+ def callback_url=(callback_url)
239
+ if callback_url.nil?
240
+ fail ArgumentError, 'callback_url cannot be nil'
241
+ end
242
+
243
+ pattern = Regexp.new(/^https?:\/\//)
244
+ if callback_url !~ pattern
245
+ fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}."
246
+ end
247
+
248
+ @callback_url = callback_url
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] client_reference Value to be assigned
253
+ def client_reference=(client_reference)
254
+ if client_reference.nil?
255
+ fail ArgumentError, 'client_reference cannot be nil'
256
+ end
257
+
258
+ if client_reference.to_s.length > 64
259
+ fail ArgumentError, 'invalid value for "client_reference", the character length must be smaller than or equal to 64.'
260
+ end
261
+
262
+ @client_reference = client_reference
263
+ end
264
+
265
+ # Custom attribute writer method with validation
266
+ # @param [Object] virtual_account Value to be assigned
267
+ def virtual_account=(virtual_account)
268
+ if virtual_account.nil?
269
+ fail ArgumentError, 'virtual_account cannot be nil'
270
+ end
271
+
272
+ if virtual_account.to_s.length > 50
273
+ fail ArgumentError, 'invalid value for "virtual_account", the character length must be smaller than or equal to 50.'
274
+ end
275
+
276
+ if virtual_account.to_s.length < 1
277
+ fail ArgumentError, 'invalid value for "virtual_account", the character length must be greater than or equal to 1.'
278
+ end
279
+
280
+ @virtual_account = virtual_account
281
+ end
282
+
283
+ # Checks equality by comparing each attribute.
284
+ # @param [Object] Object to be compared
285
+ def ==(o)
286
+ return true if self.equal?(o)
287
+ self.class == o.class &&
288
+ amount == o.amount &&
289
+ pix_key == o.pix_key &&
290
+ pix_type == o.pix_type &&
291
+ callback_url == o.callback_url &&
292
+ client_reference == o.client_reference &&
293
+ description == o.description &&
294
+ virtual_account == o.virtual_account
295
+ end
296
+
297
+ # @see the `==` method
298
+ # @param [Object] Object to be compared
299
+ def eql?(o)
300
+ self == o
301
+ end
302
+
303
+ # Calculates hash code according to all attributes.
304
+ # @return [Integer] Hash code
305
+ def hash
306
+ [amount, pix_key, pix_type, callback_url, client_reference, description, virtual_account].hash
307
+ end
308
+
309
+ # Builds the object from hash
310
+ # @param [Hash] attributes Model attributes in the form of hash
311
+ # @return [Object] Returns the model itself
312
+ def self.build_from_hash(attributes)
313
+ return nil unless attributes.is_a?(Hash)
314
+ attributes = attributes.transform_keys(&:to_sym)
315
+ transformed_hash = {}
316
+ openapi_types.each_pair do |key, type|
317
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
318
+ transformed_hash["#{key}"] = nil
319
+ elsif type =~ /\AArray<(.*)>/i
320
+ # check to ensure the input is an array given that the attribute
321
+ # is documented as an array but the input is not
322
+ if attributes[attribute_map[key]].is_a?(Array)
323
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
324
+ end
325
+ elsif !attributes[attribute_map[key]].nil?
326
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
327
+ end
328
+ end
329
+ new(transformed_hash)
330
+ end
331
+
332
+ # Returns the object in the form of hash
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_hash
335
+ hash = {}
336
+ self.class.attribute_map.each_pair do |attr, param|
337
+ value = self.send(attr)
338
+ if value.nil?
339
+ is_nullable = self.class.openapi_nullable.include?(attr)
340
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
341
+ end
342
+
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ end
349
+
350
+ end