tpaga 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,340 @@
1
+ require "uri"
2
+
3
+ module Tpaga
4
+ class DaviPlataApi
5
+ basePath = "https://sandbox.tpaga.co/api"
6
+ # apiInvoker = APIInvoker
7
+
8
+ # Adds a new DaviPlataCharge to Customer's DaviPlata
9
+ # Creates a new `DaviPlataCharge` and associates it to a `DaviPlata`.
10
+ # @param body The `DaviPlataCharge` object to be generated to a `DaviPlata`. It has the following fields\n- **id** its the id of the `DaviPlataCharge` thats going to be generated after creation.\n- **daviPlata** which is the identificator of the `DaviPlata` to be charged\n- **customer** which is the id of the `Customer` associated with the `DaviPlata`\n- **amount** which is the full amount of the charge\n- **currency** its the 3-letter ISO code for the currency.\n- **taxAmount** the amount that accounts as taxes.\n- **paid** its the status of the charge. true if its paid, false if its not.\n- **description** which is the desciption of the charge being made.\n- **orderId** commerce order identificator
11
+ # @param [Hash] opts the optional parameters
12
+ # @return [DaviPlataCharge]
13
+ def self.add_davi_plata_charge(body, opts = {})
14
+
15
+ # verify the required parameter 'body' is set
16
+ raise "Missing the required parameter 'body' when calling add_davi_plata_charge" if body.nil?
17
+
18
+
19
+ # resource path
20
+ path = "/charge/daviplata".sub('{format}', 'json')
21
+
22
+ # query parameters
23
+ query_params = {}
24
+
25
+ # header parameters
26
+ header_params = {}
27
+
28
+ # HTTP header 'Accept' (if needed)
29
+ _header_accept = []
30
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
31
+
32
+ # HTTP header 'Content-Type'
33
+ _header_content_type = []
34
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
35
+
36
+ # form parameters
37
+ form_params = {}
38
+
39
+ # http body (model)
40
+ post_body = Swagger::Request.object_to_http_body(body)
41
+
42
+
43
+ auth_names = ['api_key']
44
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
45
+ obj = DaviPlataCharge.new() and obj.build_from_hash(response)
46
+ end
47
+
48
+ # Retrieve a DaviPlataCharge by ID
49
+ # Get the details of an existing `DaviPlataCharge`. This method only requires an unique `DaviPlataCharge` identifier `id` that was returned upon `DaviPlataCharge` creation.
50
+ # @param id Identification of `DaviPlataCharge` that needs to be retrieved
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [DaviPlataCharge]
53
+ def self.get_davi_plata_charge_by_id(id, opts = {})
54
+
55
+ # verify the required parameter 'id' is set
56
+ raise "Missing the required parameter 'id' when calling get_davi_plata_charge_by_id" if id.nil?
57
+
58
+
59
+ # resource path
60
+ path = "/charge/daviplata/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
61
+
62
+ # query parameters
63
+ query_params = {}
64
+
65
+ # header parameters
66
+ header_params = {}
67
+
68
+ # HTTP header 'Accept' (if needed)
69
+ _header_accept = []
70
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
71
+
72
+ # HTTP header 'Content-Type'
73
+ _header_content_type = []
74
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
75
+
76
+ # form parameters
77
+ form_params = {}
78
+
79
+ # http body (model)
80
+ post_body = nil
81
+
82
+
83
+ auth_names = ['api_key']
84
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
85
+ obj = DaviPlataCharge.new() and obj.build_from_hash(response)
86
+ end
87
+
88
+ # Adds a new DaviPlataChargeback to Customer's DaviPlata
89
+ # Creates a new `DaviPlataChargeback` and associates it to a `DaviPlata`.
90
+ # @param body The `DaviPlataChargeback` to be applied to a `DaviPlata`. It has the following fields\n- **id** its the id of the `DaviPlataChargeback` thats going to be generated after creation.\n- **daviPlata** its the id of the `DaviPlata` to be reinbursed.\n- **daviPlataCharge** its the id of the `DaviPlataCharge` to apply the Chargeback.\n- **reimbursed** its the status of the chargeback, true if its been reinbursed or false if its still pending.
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [DaviPlataChargeback]
93
+ def self.add_davi_plata_chargeback(body, opts = {})
94
+
95
+ # verify the required parameter 'body' is set
96
+ raise "Missing the required parameter 'body' when calling add_davi_plata_chargeback" if body.nil?
97
+
98
+
99
+ # resource path
100
+ path = "/chargeback/daviplata".sub('{format}', 'json')
101
+
102
+ # query parameters
103
+ query_params = {}
104
+
105
+ # header parameters
106
+ header_params = {}
107
+
108
+ # HTTP header 'Accept' (if needed)
109
+ _header_accept = []
110
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
111
+
112
+ # HTTP header 'Content-Type'
113
+ _header_content_type = []
114
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
115
+
116
+ # form parameters
117
+ form_params = {}
118
+
119
+ # http body (model)
120
+ post_body = Swagger::Request.object_to_http_body(body)
121
+
122
+
123
+ auth_names = ['api_key']
124
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
125
+ obj = DaviPlataChargeback.new() and obj.build_from_hash(response)
126
+ end
127
+
128
+ # Retrieve a DaviPlataChargeback by ID
129
+ # Get the details of an existing `DaviPlataChargeback`. This method only requires an unique `DaviPlataChargeback` identifier `id` that was returned upon `DaviPlataChargeback` creation.
130
+ # @param id Identification of `DaviPlataChargeback` to be retrieved
131
+ # @param [Hash] opts the optional parameters
132
+ # @return [DaviPlataChargeback]
133
+ def self.get_davi_plata_chargeback_by_id(id, opts = {})
134
+
135
+ # verify the required parameter 'id' is set
136
+ raise "Missing the required parameter 'id' when calling get_davi_plata_chargeback_by_id" if id.nil?
137
+
138
+
139
+ # resource path
140
+ path = "/chargeback/daviplata/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
141
+
142
+ # query parameters
143
+ query_params = {}
144
+
145
+ # header parameters
146
+ header_params = {}
147
+
148
+ # HTTP header 'Accept' (if needed)
149
+ _header_accept = []
150
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
151
+
152
+ # HTTP header 'Content-Type'
153
+ _header_content_type = []
154
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
155
+
156
+ # form parameters
157
+ form_params = {}
158
+
159
+ # http body (model)
160
+ post_body = nil
161
+
162
+
163
+ auth_names = ['api_key']
164
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
165
+ obj = DaviPlataChargeback.new() and obj.build_from_hash(response)
166
+ end
167
+
168
+ # Adds a new DaviPlata payment method to the Customer
169
+ # Creates a new `DaviPLata` and associates it to the `Customer`
170
+ # @param customer_id Identification of `Customer` to associate the new `DaviPlata`
171
+ # @param body The `DaviPlata` object to be added to the `Customer`\n- **id** its the id of the `DaviPlata` thats going to be generated after creation.\n- **number** its the `DaviPlata` number.\n- **lastFour** it the last four digits of the `DaviPlata` number\n- **customer** its the id of the `Customer` associated to the `DaviPlata`\n- **document** its the document number of the `Customer`\n- **documentType** its the type of document supplied, it can be CC, CE or TI\n- **maxAmount** its the maximum amount that can be charged to the associated `DaviPlata`
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [DaviPlata]
174
+ def self.add_davi_plata(customer_id, body, opts = {})
175
+
176
+ # verify the required parameter 'customer_id' is set
177
+ raise "Missing the required parameter 'customer_id' when calling add_davi_plata" if customer_id.nil?
178
+
179
+ # verify the required parameter 'body' is set
180
+ raise "Missing the required parameter 'body' when calling add_davi_plata" if body.nil?
181
+
182
+
183
+ # resource path
184
+ path = "/customer/{customer_id}/daviplata".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s)
185
+
186
+ # query parameters
187
+ query_params = {}
188
+
189
+ # header parameters
190
+ header_params = {}
191
+
192
+ # HTTP header 'Accept' (if needed)
193
+ _header_accept = []
194
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
195
+
196
+ # HTTP header 'Content-Type'
197
+ _header_content_type = []
198
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
199
+
200
+ # form parameters
201
+ form_params = {}
202
+
203
+ # http body (model)
204
+ post_body = Swagger::Request.object_to_http_body(body)
205
+
206
+
207
+ auth_names = ['api_key']
208
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
209
+ obj = DaviPlata.new() and obj.build_from_hash(response)
210
+ end
211
+
212
+ # Retrieve a DaviPlata by ID
213
+ # Get the details of an existing `DaviPlata`. This method only requires an unique `DaviPlata` identifier `id` that was returned upon `DaviPlata` creation.
214
+ # @param customer_id Identification of `Customer` associated with a `DaviPlata`
215
+ # @param daviplata_id Identification of `DaviPlata` that needs to be retrieved
216
+ # @param [Hash] opts the optional parameters
217
+ # @return [DaviPlata]
218
+ def self.get_davi_plata_by_id(customer_id, daviplata_id, opts = {})
219
+
220
+ # verify the required parameter 'customer_id' is set
221
+ raise "Missing the required parameter 'customer_id' when calling get_davi_plata_by_id" if customer_id.nil?
222
+
223
+ # verify the required parameter 'daviplata_id' is set
224
+ raise "Missing the required parameter 'daviplata_id' when calling get_davi_plata_by_id" if daviplata_id.nil?
225
+
226
+
227
+ # resource path
228
+ path = "/customer/{customer_id}/daviplata/{daviplata_id}".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'daviplata_id' + '}', daviplata_id.to_s)
229
+
230
+ # query parameters
231
+ query_params = {}
232
+
233
+ # header parameters
234
+ header_params = {}
235
+
236
+ # HTTP header 'Accept' (if needed)
237
+ _header_accept = []
238
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
239
+
240
+ # HTTP header 'Content-Type'
241
+ _header_content_type = []
242
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
243
+
244
+ # form parameters
245
+ form_params = {}
246
+
247
+ # http body (model)
248
+ post_body = nil
249
+
250
+
251
+ auth_names = ['api_key']
252
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
253
+ obj = DaviPlata.new() and obj.build_from_hash(response)
254
+ end
255
+
256
+ # Deletes a DaviPlata by ID
257
+ # Deletes a `DaviPlata` when its `id` matches the parameter. Only available when `DaviPlata` does not have associated Charges.
258
+ # @param customer_id Identification of `Customer` associated with a `DaviPlata`
259
+ # @param daviplata_id Identification of `DaviPlata` to be deleted
260
+ # @param [Hash] opts the optional parameters
261
+ # @return [nil]
262
+ def self.delete_davi_plata_by_id(customer_id, daviplata_id, opts = {})
263
+
264
+ # verify the required parameter 'customer_id' is set
265
+ raise "Missing the required parameter 'customer_id' when calling delete_davi_plata_by_id" if customer_id.nil?
266
+
267
+ # verify the required parameter 'daviplata_id' is set
268
+ raise "Missing the required parameter 'daviplata_id' when calling delete_davi_plata_by_id" if daviplata_id.nil?
269
+
270
+
271
+ # resource path
272
+ path = "/customer/{customer_id}/daviplata/{daviplata_id}".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'daviplata_id' + '}', daviplata_id.to_s)
273
+
274
+ # query parameters
275
+ query_params = {}
276
+
277
+ # header parameters
278
+ header_params = {}
279
+
280
+ # HTTP header 'Accept' (if needed)
281
+ _header_accept = []
282
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
283
+
284
+ # HTTP header 'Content-Type'
285
+ _header_content_type = []
286
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
287
+
288
+ # form parameters
289
+ form_params = {}
290
+
291
+ # http body (model)
292
+ post_body = nil
293
+
294
+
295
+ auth_names = ['api_key']
296
+ Swagger::Request.new(:DELETE, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make
297
+ nil
298
+ end
299
+
300
+ # Verifies the ownership of the associated DaviPlata
301
+ # This method requires two parameters. One is the unique `DaviPlata` identifier `id` that was returned upon `DaviPlata` creation. the second parameter is a six digit pin code `pinNumber` obtained through a SMS from the service provider of `DaviPlata`. Its used to validate the ownership of the associated `DaviPlata`
302
+ # @param body it has two fields\n- **daviPlata** which is the Identification of the `DaviPlata` to verify\n- **pinNumber** which is a Six digit pin code used to validate `DaviPlata` as a payment method.
303
+ # @param [Hash] opts the optional parameters
304
+ # @return [DaviPlata]
305
+ def self.verify_davi_plata(body, opts = {})
306
+
307
+ # verify the required parameter 'body' is set
308
+ raise "Missing the required parameter 'body' when calling verify_davi_plata" if body.nil?
309
+
310
+
311
+ # resource path
312
+ path = "/daviplata/verify".sub('{format}', 'json')
313
+
314
+ # query parameters
315
+ query_params = {}
316
+
317
+ # header parameters
318
+ header_params = {}
319
+
320
+ # HTTP header 'Accept' (if needed)
321
+ _header_accept = []
322
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
323
+
324
+ # HTTP header 'Content-Type'
325
+ _header_content_type = []
326
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
327
+
328
+ # form parameters
329
+ form_params = {}
330
+
331
+ # http body (model)
332
+ post_body = Swagger::Request.object_to_http_body(body)
333
+
334
+
335
+ auth_names = ['api_key']
336
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
337
+ obj = DaviPlata.new() and obj.build_from_hash(response)
338
+ end
339
+ end
340
+ end
@@ -1,67 +1,60 @@
1
- require 'date'
2
-
3
1
  module Tpaga
4
- class Address
5
- attr_accessor :addressLine1, :addressLine2, :city, :postalCode
2
+ #
3
+ class Address < BaseObject
4
+ attr_accessor :address_line1, :address_line2, :postal_code, :city
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'address_line1' => :'addressLine1',
11
+
12
+ #
13
+ :'address_line2' => :'addressLine2',
14
+
15
+ #
16
+ :'postal_code' => :'postalCode',
17
+
18
+ #
19
+ :'city' => :'city'
20
+
21
+ }
22
+ end
6
23
 
7
- # :internal => :external
8
- def self.attribute_map
9
- {
10
- :addressLine1 => :'addressLine1',
11
- :addressLine2 => :'addressLine2',
12
- :city => :'city',
13
- :postalCode => :'postalCode'
24
+ # attribute type
25
+ def self.swagger_types
26
+ {
27
+ :'address_line1' => :'string',
28
+ :'address_line2' => :'string',
29
+ :'postal_code' => :'string',
30
+ :'city' => :'City'
31
+
32
+ }
33
+ end
14
34
 
15
- }
16
- end
35
+ def initialize(attributes = {})
36
+ return if !attributes.is_a?(Hash) || attributes.empty?
17
37
 
18
- def initialize(attributes = {})
19
- return if attributes.empty?
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
20
40
 
21
- # convert hash key from symbol to string
22
- # and convert object to hash
23
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
24
-
25
- # Morph attribute keys into undescored rubyish style
26
- if self.class.attribute_map[:"addressLine1"]
27
- @addressLine1 = attributes["addressLine1"]
28
- end
29
- if self.class.attribute_map[:"addressLine2"]
30
- @addressLine2 = attributes["addressLine2"]
41
+
42
+ if attributes[:'addressLine1']
43
+ @address_line1 = attributes[:'addressLine1']
31
44
  end
32
- if self.class.attribute_map[:"city"]
33
- @city = City.new(attributes["city"]) if (attributes["city"].kind_of? Hash)
45
+
46
+ if attributes[:'addressLine2']
47
+ @address_line2 = attributes[:'addressLine2']
34
48
  end
35
- if self.class.attribute_map[:"postalCode"]
36
- @postalCode = attributes["postalCode"]
49
+
50
+ if attributes[:'postalCode']
51
+ @postal_code = attributes[:'postalCode']
37
52
  end
38
-
39
-
40
- end
41
-
42
- def to_body
43
- body = {}
44
- self.class.attribute_map.each_pair do |key, value|
45
- next if self.send(key).nil?
46
-
47
- if self.send(key).respond_to? :to_body
48
- body[value] = self.send(key).to_body
49
- elsif self.send(key).kind_of?(Array)
50
- body[value] = []
51
- self.send(key).each do |arr|
52
- if arr.respond_to? :to_body
53
- body[value] << arr.to_body
54
- else
55
- body[value] << arr
56
- end
57
- end
58
- else
59
- body[value] = self.send(key)
53
+
54
+ if attributes[:'city']
55
+ @city = attributes[:'city']
60
56
  end
61
57
 
62
58
  end
63
- body
64
59
  end
65
60
  end
66
- end
67
-