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,234 @@
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 'cgi'
14
+
15
+ module PayZuPix
16
+ class KeysAndDICTApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Pix key lookup (DICT)
23
+ # Query the DICT (Diretório de Identificadores de Contas Transacionais) to retrieve information about a Pix key before sending a payment. Returns the key owner's details and associated financial institution. Token permission: `DEPOSIT` or `WITHDRAW`.
24
+ # @param pix_key [String] The Pix key to lookup (CPF, CNPJ, email, phone, or EVP).
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [PixKeyInfo]
27
+ def get_pix_key(pix_key, opts = {})
28
+ data, _status_code, _headers = get_pix_key_with_http_info(pix_key, opts)
29
+ data
30
+ end
31
+
32
+ # Pix key lookup (DICT)
33
+ # Query the DICT (Diretório de Identificadores de Contas Transacionais) to retrieve information about a Pix key before sending a payment. Returns the key owner's details and associated financial institution. Token permission: `DEPOSIT` or `WITHDRAW`.
34
+ # @param pix_key [String] The Pix key to lookup (CPF, CNPJ, email, phone, or EVP).
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(PixKeyInfo, Integer, Hash)>] PixKeyInfo data, response status code and response headers
37
+ def get_pix_key_with_http_info(pix_key, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: KeysAndDICTApi.get_pix_key ...'
40
+ end
41
+ # verify the required parameter 'pix_key' is set
42
+ if @api_client.config.client_side_validation && pix_key.nil?
43
+ fail ArgumentError, "Missing the required parameter 'pix_key' when calling KeysAndDICTApi.get_pix_key"
44
+ end
45
+ if @api_client.config.client_side_validation && pix_key.to_s.length > 77
46
+ fail ArgumentError, 'invalid value for "pix_key" when calling KeysAndDICTApi.get_pix_key, the character length must be smaller than or equal to 77.'
47
+ end
48
+
49
+ if @api_client.config.client_side_validation && pix_key.to_s.length < 1
50
+ fail ArgumentError, 'invalid value for "pix_key" when calling KeysAndDICTApi.get_pix_key, the character length must be greater than or equal to 1.'
51
+ end
52
+
53
+ # resource path
54
+ local_var_path = '/pix/key'
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+ query_params[:'pixKey'] = pix_key
59
+
60
+ # header parameters
61
+ header_params = opts[:header_params] || {}
62
+ # HTTP header 'Accept' (if needed)
63
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
64
+
65
+ # form parameters
66
+ form_params = opts[:form_params] || {}
67
+
68
+ # http body (model)
69
+ post_body = opts[:debug_body]
70
+
71
+ # return_type
72
+ return_type = opts[:debug_return_type] || 'PixKeyInfo'
73
+
74
+ # auth_names
75
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
76
+
77
+ new_options = opts.merge(
78
+ :operation => :"KeysAndDICTApi.get_pix_key",
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => return_type
85
+ )
86
+
87
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "API called: KeysAndDICTApi#get_pix_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
90
+ end
91
+ return data, status_code, headers
92
+ end
93
+
94
+ # Resolve DICT key
95
+ # Resolves a Pix key (DICT) to the holder details before paying. Requires WITHDRAW scope.
96
+ # @param key [String] Pix key to look up (CPF, CNPJ, email, phone or EVP).
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [DictConsultResponse]
99
+ def get_user_dict(key, opts = {})
100
+ data, _status_code, _headers = get_user_dict_with_http_info(key, opts)
101
+ data
102
+ end
103
+
104
+ # Resolve DICT key
105
+ # Resolves a Pix key (DICT) to the holder details before paying. Requires WITHDRAW scope.
106
+ # @param key [String] Pix key to look up (CPF, CNPJ, email, phone or EVP).
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [Array<(DictConsultResponse, Integer, Hash)>] DictConsultResponse data, response status code and response headers
109
+ def get_user_dict_with_http_info(key, opts = {})
110
+ if @api_client.config.debugging
111
+ @api_client.config.logger.debug 'Calling API: KeysAndDICTApi.get_user_dict ...'
112
+ end
113
+ # verify the required parameter 'key' is set
114
+ if @api_client.config.client_side_validation && key.nil?
115
+ fail ArgumentError, "Missing the required parameter 'key' when calling KeysAndDICTApi.get_user_dict"
116
+ end
117
+ if @api_client.config.client_side_validation && key.to_s.length > 77
118
+ fail ArgumentError, 'invalid value for "key" when calling KeysAndDICTApi.get_user_dict, the character length must be smaller than or equal to 77.'
119
+ end
120
+
121
+ if @api_client.config.client_side_validation && key.to_s.length < 1
122
+ fail ArgumentError, 'invalid value for "key" when calling KeysAndDICTApi.get_user_dict, the character length must be greater than or equal to 1.'
123
+ end
124
+
125
+ # resource path
126
+ local_var_path = '/user/dict'
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+ query_params[:'key'] = key
131
+
132
+ # header parameters
133
+ header_params = opts[:header_params] || {}
134
+ # HTTP header 'Accept' (if needed)
135
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
136
+
137
+ # form parameters
138
+ form_params = opts[:form_params] || {}
139
+
140
+ # http body (model)
141
+ post_body = opts[:debug_body]
142
+
143
+ # return_type
144
+ return_type = opts[:debug_return_type] || 'DictConsultResponse'
145
+
146
+ # auth_names
147
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
148
+
149
+ new_options = opts.merge(
150
+ :operation => :"KeysAndDICTApi.get_user_dict",
151
+ :header_params => header_params,
152
+ :query_params => query_params,
153
+ :form_params => form_params,
154
+ :body => post_body,
155
+ :auth_names => auth_names,
156
+ :return_type => return_type
157
+ )
158
+
159
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
160
+ if @api_client.config.debugging
161
+ @api_client.config.logger.debug "API called: KeysAndDICTApi#get_user_dict\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
162
+ end
163
+ return data, status_code, headers
164
+ end
165
+
166
+ # Read QR Code
167
+ # Decode and extract information from a Pix QR Code (EMV format) before making a payment. Returns the parsed data including receiver details, amount (if present), and other QR Code metadata. PayZu processes both dynamic and static QR Codes. Token permission: `DEPOSIT` or `WITHDRAW`.
168
+ # @param post_pix_qrcode_read_request [PostPixQrcodeReadRequest]
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [QRCodeReadResponse]
171
+ def post_pix_qrcode_read(post_pix_qrcode_read_request, opts = {})
172
+ data, _status_code, _headers = post_pix_qrcode_read_with_http_info(post_pix_qrcode_read_request, opts)
173
+ data
174
+ end
175
+
176
+ # Read QR Code
177
+ # Decode and extract information from a Pix QR Code (EMV format) before making a payment. Returns the parsed data including receiver details, amount (if present), and other QR Code metadata. PayZu processes both dynamic and static QR Codes. Token permission: &#x60;DEPOSIT&#x60; or &#x60;WITHDRAW&#x60;.
178
+ # @param post_pix_qrcode_read_request [PostPixQrcodeReadRequest]
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [Array<(QRCodeReadResponse, Integer, Hash)>] QRCodeReadResponse data, response status code and response headers
181
+ def post_pix_qrcode_read_with_http_info(post_pix_qrcode_read_request, opts = {})
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug 'Calling API: KeysAndDICTApi.post_pix_qrcode_read ...'
184
+ end
185
+ # verify the required parameter 'post_pix_qrcode_read_request' is set
186
+ if @api_client.config.client_side_validation && post_pix_qrcode_read_request.nil?
187
+ fail ArgumentError, "Missing the required parameter 'post_pix_qrcode_read_request' when calling KeysAndDICTApi.post_pix_qrcode_read"
188
+ end
189
+ # resource path
190
+ local_var_path = '/pix/qrcode/read'
191
+
192
+ # query parameters
193
+ query_params = opts[:query_params] || {}
194
+
195
+ # header parameters
196
+ header_params = opts[:header_params] || {}
197
+ # HTTP header 'Accept' (if needed)
198
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
199
+ # HTTP header 'Content-Type'
200
+ content_type = @api_client.select_header_content_type(['application/json'])
201
+ if !content_type.nil?
202
+ header_params['Content-Type'] = content_type
203
+ end
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(post_pix_qrcode_read_request)
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'QRCodeReadResponse'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"KeysAndDICTApi.post_pix_qrcode_read",
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type
225
+ )
226
+
227
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: KeysAndDICTApi#post_pix_qrcode_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,300 @@
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 'cgi'
14
+
15
+ module PayZuPix
16
+ class PixOperationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Retrieve Charge
23
+ # Get the latest status and details of a transaction of the account. Provide at least one of `id`, `clientReference`, or `endToEndId` (`virtualAccount` is also accepted). When more than one parameter is provided, they are combined as filters (AND). Token permission: `DEPOSIT`.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :id Transaction ID.
26
+ # @option opts [String] :client_reference External reference provided when creating the charge.
27
+ # @option opts [String] :end_to_end_id Pix end-to-end ID.
28
+ # @option opts [String] :virtual_account Virtual sub-account (up to 50 characters) used at creation. Accepted as an alternative lookup key.
29
+ # @return [Transaction]
30
+ def get_pix(opts = {})
31
+ data, _status_code, _headers = get_pix_with_http_info(opts)
32
+ data
33
+ end
34
+
35
+ # Retrieve Charge
36
+ # Get the latest status and details of a transaction of the account. Provide at least one of &#x60;id&#x60;, &#x60;clientReference&#x60;, or &#x60;endToEndId&#x60; (&#x60;virtualAccount&#x60; is also accepted). When more than one parameter is provided, they are combined as filters (AND). Token permission: &#x60;DEPOSIT&#x60;.
37
+ # @param [Hash] opts the optional parameters
38
+ # @option opts [String] :id Transaction ID.
39
+ # @option opts [String] :client_reference External reference provided when creating the charge.
40
+ # @option opts [String] :end_to_end_id Pix end-to-end ID.
41
+ # @option opts [String] :virtual_account Virtual sub-account (up to 50 characters) used at creation. Accepted as an alternative lookup key.
42
+ # @return [Array<(Transaction, Integer, Hash)>] Transaction data, response status code and response headers
43
+ def get_pix_with_http_info(opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: PixOperationsApi.get_pix ...'
46
+ end
47
+ if @api_client.config.client_side_validation && !opts[:'client_reference'].nil? && opts[:'client_reference'].to_s.length > 64
48
+ fail ArgumentError, 'invalid value for "opts[:"client_reference"]" when calling PixOperationsApi.get_pix, the character length must be smaller than or equal to 64.'
49
+ end
50
+
51
+ if @api_client.config.client_side_validation && !opts[:'virtual_account'].nil? && opts[:'virtual_account'].to_s.length > 50
52
+ fail ArgumentError, 'invalid value for "opts[:"virtual_account"]" when calling PixOperationsApi.get_pix, the character length must be smaller than or equal to 50.'
53
+ end
54
+
55
+ # resource path
56
+ local_var_path = '/pix'
57
+
58
+ # query parameters
59
+ query_params = opts[:query_params] || {}
60
+ query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
61
+ query_params[:'clientReference'] = opts[:'client_reference'] if !opts[:'client_reference'].nil?
62
+ query_params[:'endToEndId'] = opts[:'end_to_end_id'] if !opts[:'end_to_end_id'].nil?
63
+ query_params[:'virtualAccount'] = opts[:'virtual_account'] if !opts[:'virtual_account'].nil?
64
+
65
+ # header parameters
66
+ header_params = opts[:header_params] || {}
67
+ # HTTP header 'Accept' (if needed)
68
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:debug_body]
75
+
76
+ # return_type
77
+ return_type = opts[:debug_return_type] || 'Transaction'
78
+
79
+ # auth_names
80
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
81
+
82
+ new_options = opts.merge(
83
+ :operation => :"PixOperationsApi.get_pix",
84
+ :header_params => header_params,
85
+ :query_params => query_params,
86
+ :form_params => form_params,
87
+ :body => post_body,
88
+ :auth_names => auth_names,
89
+ :return_type => return_type
90
+ )
91
+
92
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
93
+ if @api_client.config.debugging
94
+ @api_client.config.logger.debug "API called: PixOperationsApi#get_pix\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
+ end
96
+ return data, status_code, headers
97
+ end
98
+
99
+ # Render Pix QR code (PNG)
100
+ # Render the Pix QR Code of a deposit as a binary PNG image Token permission: `DEPOSIT`.
101
+ # @param transaction_id [String] Transaction ID.
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [File]
104
+ def get_pix_qrcode(transaction_id, opts = {})
105
+ data, _status_code, _headers = get_pix_qrcode_with_http_info(transaction_id, opts)
106
+ data
107
+ end
108
+
109
+ # Render Pix QR code (PNG)
110
+ # Render the Pix QR Code of a deposit as a binary PNG image Token permission: &#x60;DEPOSIT&#x60;.
111
+ # @param transaction_id [String] Transaction ID.
112
+ # @param [Hash] opts the optional parameters
113
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
114
+ def get_pix_qrcode_with_http_info(transaction_id, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: PixOperationsApi.get_pix_qrcode ...'
117
+ end
118
+ # verify the required parameter 'transaction_id' is set
119
+ if @api_client.config.client_side_validation && transaction_id.nil?
120
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling PixOperationsApi.get_pix_qrcode"
121
+ end
122
+ # resource path
123
+ local_var_path = '/pix/qr-code/{transactionId}'.sub('{transactionId}', CGI.escape(transaction_id.to_s))
124
+
125
+ # query parameters
126
+ query_params = opts[:query_params] || {}
127
+
128
+ # header parameters
129
+ header_params = opts[:header_params] || {}
130
+ # HTTP header 'Accept' (if needed)
131
+ header_params['Accept'] = @api_client.select_header_accept(['image/png', 'application/json']) unless header_params['Accept']
132
+
133
+ # form parameters
134
+ form_params = opts[:form_params] || {}
135
+
136
+ # http body (model)
137
+ post_body = opts[:debug_body]
138
+
139
+ # return_type
140
+ return_type = opts[:debug_return_type] || 'File'
141
+
142
+ # auth_names
143
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
144
+
145
+ new_options = opts.merge(
146
+ :operation => :"PixOperationsApi.get_pix_qrcode",
147
+ :header_params => header_params,
148
+ :query_params => query_params,
149
+ :form_params => form_params,
150
+ :body => post_body,
151
+ :auth_names => auth_names,
152
+ :return_type => return_type
153
+ )
154
+
155
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
156
+ if @api_client.config.debugging
157
+ @api_client.config.logger.debug "API called: PixOperationsApi#get_pix_qrcode\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
158
+ end
159
+ return data, status_code, headers
160
+ end
161
+
162
+ # Get Transaction Receipt
163
+ # Returns the transaction receipt. By default (`type=pdf`) the response is the PDF file; with `type=base64` it is JSON with the `base64` field, the PDF as a data URI.
164
+ # @param id [String] Transaction ID.
165
+ # @param [Hash] opts the optional parameters
166
+ # @option opts [String] :type Return format. (default to 'pdf')
167
+ # @return [ProofResponse]
168
+ def get_proof(id, opts = {})
169
+ data, _status_code, _headers = get_proof_with_http_info(id, opts)
170
+ data
171
+ end
172
+
173
+ # Get Transaction Receipt
174
+ # Returns the transaction receipt. By default (&#x60;type&#x3D;pdf&#x60;) the response is the PDF file; with &#x60;type&#x3D;base64&#x60; it is JSON with the &#x60;base64&#x60; field, the PDF as a data URI.
175
+ # @param id [String] Transaction ID.
176
+ # @param [Hash] opts the optional parameters
177
+ # @option opts [String] :type Return format. (default to 'pdf')
178
+ # @return [Array<(ProofResponse, Integer, Hash)>] ProofResponse data, response status code and response headers
179
+ def get_proof_with_http_info(id, opts = {})
180
+ if @api_client.config.debugging
181
+ @api_client.config.logger.debug 'Calling API: PixOperationsApi.get_proof ...'
182
+ end
183
+ # verify the required parameter 'id' is set
184
+ if @api_client.config.client_side_validation && id.nil?
185
+ fail ArgumentError, "Missing the required parameter 'id' when calling PixOperationsApi.get_proof"
186
+ end
187
+ allowable_values = ["pdf", "base64"]
188
+ if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
189
+ fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
190
+ end
191
+ # resource path
192
+ local_var_path = '/proof/{id}'.sub('{id}', CGI.escape(id.to_s))
193
+
194
+ # query parameters
195
+ query_params = opts[:query_params] || {}
196
+ query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
197
+
198
+ # header parameters
199
+ header_params = opts[:header_params] || {}
200
+ # HTTP header 'Accept' (if needed)
201
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/pdf']) unless header_params['Accept']
202
+
203
+ # form parameters
204
+ form_params = opts[:form_params] || {}
205
+
206
+ # http body (model)
207
+ post_body = opts[:debug_body]
208
+
209
+ # return_type
210
+ return_type = opts[:debug_return_type] || 'ProofResponse'
211
+
212
+ # auth_names
213
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
214
+
215
+ new_options = opts.merge(
216
+ :operation => :"PixOperationsApi.get_proof",
217
+ :header_params => header_params,
218
+ :query_params => query_params,
219
+ :form_params => form_params,
220
+ :body => post_body,
221
+ :auth_names => auth_names,
222
+ :return_type => return_type
223
+ )
224
+
225
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
226
+ if @api_client.config.debugging
227
+ @api_client.config.logger.debug "API called: PixOperationsApi#get_proof\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
228
+ end
229
+ return data, status_code, headers
230
+ end
231
+
232
+ # Create Charge (Pix deposit)
233
+ # Create a new Pix **deposit** (charge). Returns QR Code and transaction details. Token permission: `DEPOSIT`.
234
+ # @param post_pix_request [PostPixRequest]
235
+ # @param [Hash] opts the optional parameters
236
+ # @return [Transaction]
237
+ def post_pix(post_pix_request, opts = {})
238
+ data, _status_code, _headers = post_pix_with_http_info(post_pix_request, opts)
239
+ data
240
+ end
241
+
242
+ # Create Charge (Pix deposit)
243
+ # Create a new Pix **deposit** (charge). Returns QR Code and transaction details. Token permission: &#x60;DEPOSIT&#x60;.
244
+ # @param post_pix_request [PostPixRequest]
245
+ # @param [Hash] opts the optional parameters
246
+ # @return [Array<(Transaction, Integer, Hash)>] Transaction data, response status code and response headers
247
+ def post_pix_with_http_info(post_pix_request, opts = {})
248
+ if @api_client.config.debugging
249
+ @api_client.config.logger.debug 'Calling API: PixOperationsApi.post_pix ...'
250
+ end
251
+ # verify the required parameter 'post_pix_request' is set
252
+ if @api_client.config.client_side_validation && post_pix_request.nil?
253
+ fail ArgumentError, "Missing the required parameter 'post_pix_request' when calling PixOperationsApi.post_pix"
254
+ end
255
+ # resource path
256
+ local_var_path = '/pix'
257
+
258
+ # query parameters
259
+ query_params = opts[:query_params] || {}
260
+
261
+ # header parameters
262
+ header_params = opts[:header_params] || {}
263
+ # HTTP header 'Accept' (if needed)
264
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
265
+ # HTTP header 'Content-Type'
266
+ content_type = @api_client.select_header_content_type(['application/json'])
267
+ if !content_type.nil?
268
+ header_params['Content-Type'] = content_type
269
+ end
270
+
271
+ # form parameters
272
+ form_params = opts[:form_params] || {}
273
+
274
+ # http body (model)
275
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(post_pix_request)
276
+
277
+ # return_type
278
+ return_type = opts[:debug_return_type] || 'Transaction'
279
+
280
+ # auth_names
281
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
282
+
283
+ new_options = opts.merge(
284
+ :operation => :"PixOperationsApi.post_pix",
285
+ :header_params => header_params,
286
+ :query_params => query_params,
287
+ :form_params => form_params,
288
+ :body => post_body,
289
+ :auth_names => auth_names,
290
+ :return_type => return_type
291
+ )
292
+
293
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
294
+ if @api_client.config.debugging
295
+ @api_client.config.logger.debug "API called: PixOperationsApi#post_pix\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
296
+ end
297
+ return data, status_code, headers
298
+ end
299
+ end
300
+ end
@@ -0,0 +1,96 @@
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 'cgi'
14
+
15
+ module PayZuPix
16
+ class RefundsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Refund a Pix
23
+ # Refund a received Pix charge. Provide `amount` for a partial refund, or omit it to refund the full amount. Processing is **asynchronous**: the response returns the transaction with `refundStatus: PENDING`; completion is confirmed later by webhook. Send `{}` to refund the full amount. Token permission: `WITHDRAW`.
24
+ # @param transaction_id [String] ID of the transaction to refund.
25
+ # @param refund_request [RefundRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [TransactionWithRefunds]
28
+ def post_refund(transaction_id, refund_request, opts = {})
29
+ data, _status_code, _headers = post_refund_with_http_info(transaction_id, refund_request, opts)
30
+ data
31
+ end
32
+
33
+ # Refund a Pix
34
+ # Refund a received Pix charge. Provide &#x60;amount&#x60; for a partial refund, or omit it to refund the full amount. Processing is **asynchronous**: the response returns the transaction with &#x60;refundStatus: PENDING&#x60;; completion is confirmed later by webhook. Send &#x60;{}&#x60; to refund the full amount. Token permission: &#x60;WITHDRAW&#x60;.
35
+ # @param transaction_id [String] ID of the transaction to refund.
36
+ # @param refund_request [RefundRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(TransactionWithRefunds, Integer, Hash)>] TransactionWithRefunds data, response status code and response headers
39
+ def post_refund_with_http_info(transaction_id, refund_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: RefundsApi.post_refund ...'
42
+ end
43
+ # verify the required parameter 'transaction_id' is set
44
+ if @api_client.config.client_side_validation && transaction_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling RefundsApi.post_refund"
46
+ end
47
+ # verify the required parameter 'refund_request' is set
48
+ if @api_client.config.client_side_validation && refund_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'refund_request' when calling RefundsApi.post_refund"
50
+ end
51
+ # resource path
52
+ local_var_path = '/refund/{transactionId}'.sub('{transactionId}', CGI.escape(transaction_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(refund_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'TransactionWithRefunds'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"RefundsApi.post_refund",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: RefundsApi#post_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+ end
96
+ end