khipu-api-client 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 248679e96582fe441b1c877fb45578f77a822f62
4
+ data.tar.gz: 8d1b836b4f36155e1afc644ae911f53982727715
5
+ SHA512:
6
+ metadata.gz: 32299189412df8180c730c8a7a3e4c0c63fb94bcbcb5c78fdbe6d7596e228dbadfad6aedec1685c293a77f140bc557d9eb79efe379d8d9b083cf2a05bd769525
7
+ data.tar.gz: 1febbe6c799d5deef4151dffde610bc21902b0fb1abd826a43f370ccb21c3ad4801e51d83b79fd34ecd0bfe4193741de5c188a014e6b471c3b39680627497129
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ ## Installation
2
+
3
+ ```
4
+ gem install khipu-api-client
5
+ ```
6
+
7
+ ## Usage
8
+
9
+ ### Basic usage
10
+ ```ruby
11
+ require 'khipu-api-client'
12
+
13
+ Khipu.configure do |c|
14
+ c.secret = 'abc123'
15
+ c.receiver_id = 1234
16
+ end
17
+
18
+ api = Khipu::PaymentsApi.new()
19
+ r1 = api.payments_post("Test de api nueva", "CLP", 1,
20
+ {expires_date: DateTime.new(2016,4,4),
21
+ send_email: true, payer_name: "payer",
22
+ payer_email: "payer@mail.com"})
23
+ print r1
24
+ r2 = api.payments_id_get(r1.payment_id)
25
+ print r2
26
+ ```
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "khipu-api-client/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "khipu-api-client"
7
+ s.version = Khipu::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["khipu"]
10
+ s.email = ["developers@khipu.com"]
11
+ s.homepage = "https://github.com/khipu/khipu-api-ruby-client"
12
+ s.summary = %q{A ruby wrapper for the khipu APIs}
13
+ s.license = "Apache-2.0"
14
+
15
+ s.add_runtime_dependency 'typhoeus', '~> 0.2', '>= 0.2.1'
16
+ s.add_runtime_dependency 'json', '~> 1.4', '>= 1.4.6'
17
+
18
+ s.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
19
+ s.add_development_dependency 'vcr', '~> 2.9', '>= 2.9.3'
20
+ s.add_development_dependency 'webmock', '~> 1.6', '>= 1.6.2'
21
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
22
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
23
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
24
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.10'
25
+
26
+ s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
27
+ s.test_files = `find spec/*`.split("\n")
28
+ s.executables = []
29
+ s.require_paths = ["lib"]
30
+ end
@@ -0,0 +1,39 @@
1
+ # Common files
2
+ require 'khipu-api-client/api_client'
3
+ require 'khipu-api-client/api_error'
4
+ require 'khipu-api-client/version'
5
+ require 'khipu-api-client/configuration'
6
+
7
+ # Models
8
+ require 'khipu-api-client/models/base_object'
9
+ require 'khipu-api-client/models/payment_response'
10
+ require 'khipu-api-client/models/create_response'
11
+ require 'khipu-api-client/models/banks_response'
12
+ require 'khipu-api-client/models/bank_item'
13
+ require 'khipu-api-client/models/success_response'
14
+ require 'khipu-api-client/models/authorization_error'
15
+ require 'khipu-api-client/models/service_error'
16
+ require 'khipu-api-client/models/validation_error'
17
+ require 'khipu-api-client/models/error_item'
18
+
19
+ # APIs
20
+ require 'khipu-api-client/api/banks_api'
21
+ require 'khipu-api-client/api/payments_api'
22
+
23
+ module Khipu
24
+ class << self
25
+ # Configure sdk using block.
26
+ # Khipu.configure do |config|
27
+ # config.username = "xxx"
28
+ # config.password = "xxx"
29
+ # end
30
+ # If no block given, return the configuration singleton instance.
31
+ def configure
32
+ if block_given?
33
+ yield Configuration.instance
34
+ else
35
+ Configuration.instance
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,62 @@
1
+ require "uri"
2
+
3
+ module Khipu
4
+ class BanksApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = nil)
8
+ @api_client = api_client || Configuration.api_client
9
+ end
10
+
11
+ # Obtener listado de bancos
12
+ # Obtiene el listado de bancos que pueden usarse para pagar a esta cuenta de cobro.
13
+ # @param [Hash] opts the optional parameters
14
+ # @return [BanksResponse]
15
+ def banks_get(opts = {})
16
+ if Configuration.debugging
17
+ Configuration.logger.debug "Calling API: BanksApi#banks_get ..."
18
+ end
19
+
20
+ # resource path
21
+ path = "/banks".sub('{format}','json')
22
+
23
+ # query parameters
24
+ query_params = {}
25
+
26
+ # header parameters
27
+ header_params = {}
28
+
29
+ # HTTP header 'Accept' (if needed)
30
+ _header_accept = ['application/json']
31
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
32
+
33
+ # HTTP header 'Content-Type'
34
+ _header_content_type = ['application/x-www-form-urlencoded']
35
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
36
+
37
+ # form parameters
38
+ form_params = {}
39
+
40
+ # http body (model)
41
+ post_body = nil
42
+
43
+
44
+ auth_names = ['khipu']
45
+ result = @api_client.call_api(:GET, path,
46
+ :header_params => header_params,
47
+ :query_params => query_params,
48
+ :form_params => form_params,
49
+ :body => post_body,
50
+ :auth_names => auth_names,
51
+ :return_type => 'BanksResponse')
52
+ if Configuration.debugging
53
+ Configuration.logger.debug "API called: BanksApi#banks_get. Result: #{result.inspect}"
54
+ end
55
+ return result
56
+ end
57
+ end
58
+ end
59
+
60
+
61
+
62
+
@@ -0,0 +1,316 @@
1
+ require "uri"
2
+
3
+ module Khipu
4
+ class PaymentsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = nil)
8
+ @api_client = api_client || Configuration.api_client
9
+ end
10
+
11
+ # Obtener información de un pago
12
+ # Información completa del pago. Datos con los que fue creado y el estado actual del pago. Se obtiene del notification_token que envia khipu cuando el pago es conciliado.
13
+ # @param notification_token Token de notifiación recibido usando la API de notificaiones 1.3 o superior.
14
+ # @param [Hash] opts the optional parameters
15
+ # @return [PaymentResponse]
16
+ def payments_get(notification_token, opts = {})
17
+ if Configuration.debugging
18
+ Configuration.logger.debug "Calling API: PaymentsApi#payments_get ..."
19
+ end
20
+
21
+ # verify the required parameter 'notification_token' is set
22
+ fail "Missing the required parameter 'notification_token' when calling payments_get" if notification_token.nil?
23
+
24
+ # resource path
25
+ path = "/payments".sub('{format}','json')
26
+
27
+ # query parameters
28
+ query_params = {}
29
+ query_params[:'notification_token'] = notification_token
30
+
31
+ # header parameters
32
+ header_params = {}
33
+
34
+ # HTTP header 'Accept' (if needed)
35
+ _header_accept = ['application/json']
36
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
37
+
38
+ # HTTP header 'Content-Type'
39
+ _header_content_type = ['application/x-www-form-urlencoded']
40
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
41
+
42
+ # form parameters
43
+ form_params = {}
44
+
45
+ # http body (model)
46
+ post_body = nil
47
+
48
+
49
+ auth_names = ['khipu']
50
+ result = @api_client.call_api(:GET, path,
51
+ :header_params => header_params,
52
+ :query_params => query_params,
53
+ :form_params => form_params,
54
+ :body => post_body,
55
+ :auth_names => auth_names,
56
+ :return_type => 'PaymentResponse')
57
+ if Configuration.debugging
58
+ Configuration.logger.debug "API called: PaymentsApi#payments_get. Result: #{result.inspect}"
59
+ end
60
+ return result
61
+ end
62
+
63
+ # Crear un pago
64
+ # Crea un pago en khipu y obtiene las URLs para redirección al usuario para que complete el pago.
65
+ # @param subject Motivo
66
+ # @param currency El código de moneda en formato ISO-4217
67
+ # @param amount El monto del cobro. Sin separador de miles y usando \&quot;.\&quot; como separador de decimales. Hasta 4 lugares decimales, dependiendo de la moneda.
68
+ # @param [Hash] opts the optional parameters
69
+ # @option opts [String] :transaction_id Identificador propio de la transacción. Ej: número de factura u orden de compra
70
+ # @option opts [String] :custom Parámetro para enviar información personalizada de la transacción. Ej: documento XML con el detalle del carro de compra
71
+ # @option opts [String] :body Descripción del cobro
72
+ # @option opts [String] :bank_id Identificador del banco para usar en el pago
73
+ # @option opts [String] :return_url La dirección URL a donde enviar al cliente mientras el pago está siendo verificado
74
+ # @option opts [String] :cancel_url La dirección URL a donde enviar al cliente si decide no hacer hacer la transacción
75
+ # @option opts [String] :picture_url Una dirección URL de una foto de tu producto o servicio
76
+ # @option opts [String] :notify_url La dirección del web-service que utilizará khipu para notificar cuando el pago esté conciliado
77
+ # @option opts [String] :notify_api_version Versión de la API de notifiaciones para recibir avisos por web-service
78
+ # @option opts [DateTime] :expires_date Fecha de expiración del cobro. Pasada esta fecha el cobro es inválido. Formato ISO-8601. Ej: 2017-03-01T13:00:00Z
79
+ # @option opts [BOOLEAN] :send_email Si es \&quot;true\&quot;, se enviará una solicitud de cobro al correo especificado en \&quot;payer_email\&quot;
80
+ # @option opts [String] :payer_name Nombre del pagador. Es obligatorio cuando send_email es \&quot;true\&quot;
81
+ # @option opts [String] :payer_email Correo del pagador. Es obligatorio cuando send_email es \&quot;true\&quot;
82
+ # @option opts [BOOLEAN] :send_reminders Si es \&quot;true\&quot;, se enviarán recordatorios de cobro.
83
+ # @option opts [String] :responsible_user_email Correo electrónico del responsable de este cobro, debe corresponder a un usuario khipu con permisos para cobrar usando esta cuenta de cobro
84
+ # @option opts [String] :fixed_payer_personal_identifier Identificador personal. Si se especifica, solo podrá ser pagado usando ese identificador
85
+ # @option opts [Float] :integrator_fee Comisión para el integrador. Sólo es válido si la cuenta de cobro tiene una cuenta de integrador asociada
86
+ # @return [CreateResponse]
87
+ def payments_post(subject, currency, amount, opts = {})
88
+ if Configuration.debugging
89
+ Configuration.logger.debug "Calling API: PaymentsApi#payments_post ..."
90
+ end
91
+
92
+ # verify the required parameter 'subject' is set
93
+ fail "Missing the required parameter 'subject' when calling payments_post" if subject.nil?
94
+
95
+ # verify the required parameter 'currency' is set
96
+ fail "Missing the required parameter 'currency' when calling payments_post" if currency.nil?
97
+
98
+ # verify the required parameter 'amount' is set
99
+ fail "Missing the required parameter 'amount' when calling payments_post" if amount.nil?
100
+
101
+ # resource path
102
+ path = "/payments".sub('{format}','json')
103
+
104
+ # query parameters
105
+ query_params = {}
106
+
107
+ # header parameters
108
+ header_params = {}
109
+
110
+ # HTTP header 'Accept' (if needed)
111
+ _header_accept = ['application/json']
112
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
113
+
114
+ # HTTP header 'Content-Type'
115
+ _header_content_type = ['application/x-www-form-urlencoded']
116
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
117
+
118
+ # form parameters
119
+ form_params = {}
120
+ form_params["subject"] = subject
121
+ form_params["currency"] = currency
122
+ form_params["amount"] = amount
123
+ form_params["transaction_id"] = opts[:'transaction_id'] if opts[:'transaction_id']
124
+ form_params["custom"] = opts[:'custom'] if opts[:'custom']
125
+ form_params["body"] = opts[:'body'] if opts[:'body']
126
+ form_params["bank_id"] = opts[:'bank_id'] if opts[:'bank_id']
127
+ form_params["return_url"] = opts[:'return_url'] if opts[:'return_url']
128
+ form_params["cancel_url"] = opts[:'cancel_url'] if opts[:'cancel_url']
129
+ form_params["picture_url"] = opts[:'picture_url'] if opts[:'picture_url']
130
+ form_params["notify_url"] = opts[:'notify_url'] if opts[:'notify_url']
131
+ form_params["notify_api_version"] = opts[:'notify_api_version'] if opts[:'notify_api_version']
132
+ form_params["expires_date"] = opts[:'expires_date'] if opts[:'expires_date']
133
+ form_params["send_email"] = opts[:'send_email'] if opts[:'send_email']
134
+ form_params["payer_name"] = opts[:'payer_name'] if opts[:'payer_name']
135
+ form_params["payer_email"] = opts[:'payer_email'] if opts[:'payer_email']
136
+ form_params["send_reminders"] = opts[:'send_reminders'] if opts[:'send_reminders']
137
+ form_params["responsible_user_email"] = opts[:'responsible_user_email'] if opts[:'responsible_user_email']
138
+ form_params["fixed_payer_personal_identifier"] = opts[:'fixed_payer_personal_identifier'] if opts[:'fixed_payer_personal_identifier']
139
+ form_params["integrator_fee"] = opts[:'integrator_fee'] if opts[:'integrator_fee']
140
+
141
+ # http body (model)
142
+ post_body = nil
143
+
144
+
145
+ auth_names = ['khipu']
146
+ result = @api_client.call_api(:POST, path,
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 => 'CreateResponse')
153
+ if Configuration.debugging
154
+ Configuration.logger.debug "API called: PaymentsApi#payments_post. Result: #{result.inspect}"
155
+ end
156
+ return result
157
+ end
158
+
159
+ # Obtener información de un pago
160
+ # Información completa del pago. Datos con los que fue creado y el estado actual del pago.
161
+ # @param id Identificador del pago
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [PaymentResponse]
164
+ def payments_id_get(id, opts = {})
165
+ if Configuration.debugging
166
+ Configuration.logger.debug "Calling API: PaymentsApi#payments_id_get ..."
167
+ end
168
+
169
+ # verify the required parameter 'id' is set
170
+ fail "Missing the required parameter 'id' when calling payments_id_get" if id.nil?
171
+
172
+ # resource path
173
+ path = "/payments/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
174
+
175
+ # query parameters
176
+ query_params = {}
177
+
178
+ # header parameters
179
+ header_params = {}
180
+
181
+ # HTTP header 'Accept' (if needed)
182
+ _header_accept = ['application/json']
183
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
184
+
185
+ # HTTP header 'Content-Type'
186
+ _header_content_type = ['application/x-www-form-urlencoded']
187
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
188
+
189
+ # form parameters
190
+ form_params = {}
191
+
192
+ # http body (model)
193
+ post_body = nil
194
+
195
+
196
+ auth_names = ['khipu']
197
+ result = @api_client.call_api(:GET, path,
198
+ :header_params => header_params,
199
+ :query_params => query_params,
200
+ :form_params => form_params,
201
+ :body => post_body,
202
+ :auth_names => auth_names,
203
+ :return_type => 'PaymentResponse')
204
+ if Configuration.debugging
205
+ Configuration.logger.debug "API called: PaymentsApi#payments_id_get. Result: #{result.inspect}"
206
+ end
207
+ return result
208
+ end
209
+
210
+ # Borrar un pago
211
+ # Solo se pueden borrar pagos que estén pendientes de pagar. Esta operación no puede deshacerse.
212
+ # @param id Identificador del pago
213
+ # @param [Hash] opts the optional parameters
214
+ # @return [SuccessResponse]
215
+ def payments_id_delete(id, opts = {})
216
+ if Configuration.debugging
217
+ Configuration.logger.debug "Calling API: PaymentsApi#payments_id_delete ..."
218
+ end
219
+
220
+ # verify the required parameter 'id' is set
221
+ fail "Missing the required parameter 'id' when calling payments_id_delete" if id.nil?
222
+
223
+ # resource path
224
+ path = "/payments/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
225
+
226
+ # query parameters
227
+ query_params = {}
228
+
229
+ # header parameters
230
+ header_params = {}
231
+
232
+ # HTTP header 'Accept' (if needed)
233
+ _header_accept = ['application/json']
234
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
235
+
236
+ # HTTP header 'Content-Type'
237
+ _header_content_type = ['application/x-www-form-urlencoded']
238
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
239
+
240
+ # form parameters
241
+ form_params = {}
242
+
243
+ # http body (model)
244
+ post_body = nil
245
+
246
+
247
+ auth_names = ['khipu']
248
+ result = @api_client.call_api(:DELETE, path,
249
+ :header_params => header_params,
250
+ :query_params => query_params,
251
+ :form_params => form_params,
252
+ :body => post_body,
253
+ :auth_names => auth_names,
254
+ :return_type => 'SuccessResponse')
255
+ if Configuration.debugging
256
+ Configuration.logger.debug "API called: PaymentsApi#payments_id_delete. Result: #{result.inspect}"
257
+ end
258
+ return result
259
+ end
260
+
261
+ # Reembolsar un pago
262
+ # Reembolsa el total del monto del pago. Esta operación solo se puede realizar en los comercios que recauden en cuenta khipu y antes de la rendición de los fondos correspondientes.
263
+ # @param id Identificador del pago
264
+ # @param [Hash] opts the optional parameters
265
+ # @return [SuccessResponse]
266
+ def payments_id_refunds_post(id, opts = {})
267
+ if Configuration.debugging
268
+ Configuration.logger.debug "Calling API: PaymentsApi#payments_id_refunds_post ..."
269
+ end
270
+
271
+ # verify the required parameter 'id' is set
272
+ fail "Missing the required parameter 'id' when calling payments_id_refunds_post" if id.nil?
273
+
274
+ # resource path
275
+ path = "/payments/{id}/refunds".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
276
+
277
+ # query parameters
278
+ query_params = {}
279
+
280
+ # header parameters
281
+ header_params = {}
282
+
283
+ # HTTP header 'Accept' (if needed)
284
+ _header_accept = ['application/json']
285
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
286
+
287
+ # HTTP header 'Content-Type'
288
+ _header_content_type = ['application/x-www-form-urlencoded']
289
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
290
+
291
+ # form parameters
292
+ form_params = {}
293
+
294
+ # http body (model)
295
+ post_body = nil
296
+
297
+
298
+ auth_names = ['khipu']
299
+ result = @api_client.call_api(:POST, path,
300
+ :header_params => header_params,
301
+ :query_params => query_params,
302
+ :form_params => form_params,
303
+ :body => post_body,
304
+ :auth_names => auth_names,
305
+ :return_type => 'SuccessResponse')
306
+ if Configuration.debugging
307
+ Configuration.logger.debug "API called: PaymentsApi#payments_id_refunds_post. Result: #{result.inspect}"
308
+ end
309
+ return result
310
+ end
311
+ end
312
+ end
313
+
314
+
315
+
316
+