processout 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 878c1e3d1b8880d8f78c8f9ee01625cdacd8cf9f
4
- data.tar.gz: b34d572212ccb96fd60e56fbcf82ca2f3655b3cf
3
+ metadata.gz: ce7980303bdbdb4f528fcb009f18608d285ccc40
4
+ data.tar.gz: 480ab958ca4675c5887450cd0a4d39c95eddb229
5
5
  SHA512:
6
- metadata.gz: c5ec061ec4c8fc16bddab240ea3332fcb8eb3512771f2bf7bac8d38aae462184bb791dabdfcd0afa1b66ca2080d9d0e59b83b37ba2d9a0958be3178a8339c14e
7
- data.tar.gz: 8331bd79a275750d3d1f9cd80fbe64429238002300affc65152ec0482624f8b49205d4feace8b0e7869412f8a20787a852351a8ea152f89aa4a3a73691f75f69
6
+ metadata.gz: 760c460b12ab5614338ff86f9e989eb1d78d125210992caf2be81e324ad1faee3dac0d5abab91b36e083a3d422471ce5024d5a9e18d03b126fed5a69520d327b
7
+ data.tar.gz: 637b880ff587b2e0a0459ffe62db63d22ce9b799dc6c75be3a561f8fb4329088f375b6e462ccea2f7414e474745defd648981cdf526c701c2eda0ccd01a00cd4
data/Makefile ADDED
@@ -0,0 +1,2 @@
1
+ test:
2
+ rspec
@@ -157,6 +157,36 @@ module ProcessOut
157
157
  self
158
158
  end
159
159
 
160
+ # Get all the gateway configurations of the gateway
161
+ # Params:
162
+ # +options+:: +Hash+ of options
163
+ def fetch_gateway_configurations(options = {})
164
+ self.prefill(options)
165
+
166
+ request = Request.new(@client)
167
+ path = "/gateways/" + CGI.escape(@name) + "/gateway-configurations"
168
+ data = {
169
+
170
+ }
171
+
172
+ response = Response.new(request.get(path, data, options))
173
+ return_values = Array.new
174
+
175
+ a = Array.new
176
+ body = response.body
177
+ for v in body['gateway_configurations']
178
+ tmp = GatewayConfiguration.new(@client)
179
+ tmp.fill_with_data(v)
180
+ a.push(tmp)
181
+ end
182
+
183
+ return_values.push(a)
184
+
185
+
186
+
187
+ return_values[0]
188
+ end
189
+
160
190
 
161
191
  end
162
192
  end
@@ -201,6 +201,150 @@ module ProcessOut
201
201
  self
202
202
  end
203
203
 
204
+ # Get all the gateway configurations.
205
+ # Params:
206
+ # +options+:: +Hash+ of options
207
+ def all(options = {})
208
+ self.prefill(options)
209
+
210
+ request = Request.new(@client)
211
+ path = "/gateway-configurations"
212
+ data = {
213
+
214
+ }
215
+
216
+ response = Response.new(request.get(path, data, options))
217
+ return_values = Array.new
218
+
219
+ a = Array.new
220
+ body = response.body
221
+ for v in body['gateway_configurations']
222
+ tmp = GatewayConfiguration.new(@client)
223
+ tmp.fill_with_data(v)
224
+ a.push(tmp)
225
+ end
226
+
227
+ return_values.push(a)
228
+
229
+
230
+
231
+ return_values[0]
232
+ end
233
+
234
+ # Find a gateway configuration by its ID.
235
+ # Params:
236
+ # +configuration_id+:: ID of the gateway configuration
237
+ # +options+:: +Hash+ of options
238
+ def find(configuration_id, options = {})
239
+ self.prefill(options)
240
+
241
+ request = Request.new(@client)
242
+ path = "/gateway-configurations/" + CGI.escape(configuration_id) + ""
243
+ data = {
244
+
245
+ }
246
+
247
+ response = Response.new(request.get(path, data, options))
248
+ return_values = Array.new
249
+
250
+ body = response.body
251
+ body = body["gateway_configuration"]
252
+
253
+
254
+ obj = GatewayConfiguration.new(@client)
255
+ return_values.push(obj.fill_with_data(body))
256
+
257
+
258
+
259
+ return_values[0]
260
+ end
261
+
262
+ # Save the updated gateway configuration attributes and settings.
263
+ # Params:
264
+ # +options+:: +Hash+ of options
265
+ def save(options = {})
266
+ self.prefill(options)
267
+
268
+ request = Request.new(@client)
269
+ path = "/gateway-configurations/" + CGI.escape(@id) + ""
270
+ data = {
271
+ "id" => @id,
272
+ "name" => @name,
273
+ "enabled" => @enabled,
274
+ "fee_fixed" => @fee_fixed,
275
+ "fee_percentage" => @fee_percentage,
276
+ "default_currency" => @default_currency,
277
+ "settings" => options.fetch(:settings, nil)
278
+ }
279
+
280
+ response = Response.new(request.put(path, data, options))
281
+ return_values = Array.new
282
+
283
+ body = response.body
284
+ body = body["gateway_configuration"]
285
+
286
+
287
+ return_values.push(self.fill_with_data(body))
288
+
289
+
290
+
291
+ return_values[0]
292
+ end
293
+
294
+ # Delete the gateway configuration.
295
+ # Params:
296
+ # +options+:: +Hash+ of options
297
+ def delete(options = {})
298
+ self.prefill(options)
299
+
300
+ request = Request.new(@client)
301
+ path = "/gateway-configurations/" + CGI.escape(@id) + ""
302
+ data = {
303
+
304
+ }
305
+
306
+ response = Response.new(request.delete(path, data, options))
307
+ return_values = Array.new
308
+
309
+ return_values.push(response.success)
310
+
311
+
312
+ return_values[0]
313
+ end
314
+
315
+ # Create a new gateway configuration.
316
+ # Params:
317
+ # +gateway_name+:: Name of the gateway
318
+ # +options+:: +Hash+ of options
319
+ def create(gateway_name, options = {})
320
+ self.prefill(options)
321
+
322
+ request = Request.new(@client)
323
+ path = "/gateways/" + CGI.escape(gateway_name) + "/gateway-configurations"
324
+ data = {
325
+ "id" => @id,
326
+ "name" => @name,
327
+ "enabled" => @enabled,
328
+ "fee_fixed" => @fee_fixed,
329
+ "fee_percentage" => @fee_percentage,
330
+ "default_currency" => @default_currency,
331
+ "settings" => options.fetch(:settings, nil)
332
+ }
333
+
334
+ response = Response.new(request.post(path, data, options))
335
+ return_values = Array.new
336
+
337
+ body = response.body
338
+ body = body["gateway_configuration"]
339
+
340
+
341
+ return_values.push(self.fill_with_data(body))
342
+
343
+
344
+
345
+ return_values[0]
346
+ end
347
+
204
348
 
205
349
  end
206
350
  end
@@ -394,6 +394,7 @@ module ProcessOut
394
394
  path = "/invoices/" + CGI.escape(@id) + "/authorize"
395
395
  data = {
396
396
  "synchronous" => options.fetch(:synchronous, nil),
397
+ "prioritized_gateway_configuration_id" => options.fetch(:prioritized_gateway_configuration_id, nil),
397
398
  "source" => source
398
399
  }
399
400
 
@@ -421,6 +422,7 @@ module ProcessOut
421
422
  data = {
422
423
  "authorize_only" => options.fetch(:authorize_only, nil),
423
424
  "synchronous" => options.fetch(:synchronous, nil),
425
+ "prioritized_gateway_configuration_id" => options.fetch(:prioritized_gateway_configuration_id, nil),
424
426
  "source" => source
425
427
  }
426
428
 
@@ -197,14 +197,41 @@ module ProcessOut
197
197
  self
198
198
  end
199
199
 
200
- # Get all the gateway configurations of the project
200
+ # Regenerate the project private key. Make sure to store the new private key and use it in any future request.
201
201
  # Params:
202
202
  # +options+:: +Hash+ of options
203
- def fetch_gateway_configurations(options = {})
203
+ def regenerate_private_key(options = {})
204
204
  self.prefill(options)
205
205
 
206
206
  request = Request.new(@client)
207
- path = "/projects/" + CGI.escape(@id) + "/gateway-configurations"
207
+ path = "/projects/{project_id}/private-key"
208
+ data = {
209
+
210
+ }
211
+
212
+ response = Response.new(request.post(path, data, options))
213
+ return_values = Array.new
214
+
215
+ body = response.body
216
+ body = body["project"]
217
+
218
+
219
+ obj = Project.new(@client)
220
+ return_values.push(obj.fill_with_data(body))
221
+
222
+
223
+
224
+ return_values[0]
225
+ end
226
+
227
+ # Get all the supervised projects.
228
+ # Params:
229
+ # +options+:: +Hash+ of options
230
+ def all_supervised(options = {})
231
+ self.prefill(options)
232
+
233
+ request = Request.new(@client)
234
+ path = "/supervised-projects"
208
235
  data = {
209
236
 
210
237
  }
@@ -214,8 +241,8 @@ module ProcessOut
214
241
 
215
242
  a = Array.new
216
243
  body = response.body
217
- for v in body['gateway_configurations']
218
- tmp = GatewayConfiguration.new(@client)
244
+ for v in body['projects']
245
+ tmp = Project.new(@client)
219
246
  tmp.fill_with_data(v)
220
247
  a.push(tmp)
221
248
  end
@@ -224,6 +251,36 @@ module ProcessOut
224
251
 
225
252
 
226
253
 
254
+ return_values[0]
255
+ end
256
+
257
+ # Create a new supervised project.
258
+ # Params:
259
+ # +options+:: +Hash+ of options
260
+ def create_supervised(options = {})
261
+ self.prefill(options)
262
+
263
+ request = Request.new(@client)
264
+ path = "/supervised-projects"
265
+ data = {
266
+ "id" => @id,
267
+ "name" => @name,
268
+ "default_currency" => @default_currency,
269
+ "dunning_configuration" => @dunning_configuration,
270
+ "applepay_settings" => options.fetch(:applepay_settings, nil)
271
+ }
272
+
273
+ response = Response.new(request.post(path, data, options))
274
+ return_values = Array.new
275
+
276
+ body = response.body
277
+ body = body["project"]
278
+
279
+
280
+ return_values.push(self.fill_with_data(body))
281
+
282
+
283
+
227
284
  return_values[0]
228
285
  end
229
286
 
@@ -20,6 +20,8 @@ module ProcessOut
20
20
  attr_reader :token_id
21
21
  attr_reader :card
22
22
  attr_reader :card_id
23
+ attr_reader :gateway_configuration
24
+ attr_reader :gateway_configuration_id
23
25
  attr_reader :operations
24
26
  attr_reader :refunds
25
27
  attr_reader :name
@@ -28,6 +30,7 @@ module ProcessOut
28
30
  attr_reader :captured_amount
29
31
  attr_reader :currency
30
32
  attr_reader :error_code
33
+ attr_reader :three_d_s_status
31
34
  attr_reader :status
32
35
  attr_reader :authorized
33
36
  attr_reader :captured
@@ -163,6 +166,26 @@ module ProcessOut
163
166
  @card_id = val
164
167
  end
165
168
 
169
+ def gateway_configuration=(val)
170
+ if val.nil?
171
+ @gateway_configuration = val
172
+ return
173
+ end
174
+
175
+ if val.instance_of? GatewayConfiguration
176
+ @gateway_configuration = val
177
+ else
178
+ obj = GatewayConfiguration.new(@client)
179
+ obj.fill_with_data(val)
180
+ @gateway_configuration = obj
181
+ end
182
+
183
+ end
184
+
185
+ def gateway_configuration_id=(val)
186
+ @gateway_configuration_id = val
187
+ end
188
+
166
189
  def operations=(val)
167
190
  if val.nil?
168
191
  @operations = []
@@ -227,6 +250,10 @@ module ProcessOut
227
250
  @error_code = val
228
251
  end
229
252
 
253
+ def three_d_s_status=(val)
254
+ @three_d_s_status = val
255
+ end
256
+
230
257
  def status=(val)
231
258
  @status = val
232
259
  end
@@ -284,6 +311,8 @@ module ProcessOut
284
311
  self.token_id = data.fetch(:token_id, nil)
285
312
  self.card = data.fetch(:card, nil)
286
313
  self.card_id = data.fetch(:card_id, nil)
314
+ self.gateway_configuration = data.fetch(:gateway_configuration, nil)
315
+ self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
287
316
  self.operations = data.fetch(:operations, nil)
288
317
  self.refunds = data.fetch(:refunds, nil)
289
318
  self.name = data.fetch(:name, nil)
@@ -292,6 +321,7 @@ module ProcessOut
292
321
  self.captured_amount = data.fetch(:captured_amount, nil)
293
322
  self.currency = data.fetch(:currency, nil)
294
323
  self.error_code = data.fetch(:error_code, nil)
324
+ self.three_d_s_status = data.fetch(:three_d_s_status, nil)
295
325
  self.status = data.fetch(:status, nil)
296
326
  self.authorized = data.fetch(:authorized, nil)
297
327
  self.captured = data.fetch(:captured, nil)
@@ -355,6 +385,12 @@ module ProcessOut
355
385
  if data.include? "card_id"
356
386
  self.card_id = data["card_id"]
357
387
  end
388
+ if data.include? "gateway_configuration"
389
+ self.gateway_configuration = data["gateway_configuration"]
390
+ end
391
+ if data.include? "gateway_configuration_id"
392
+ self.gateway_configuration_id = data["gateway_configuration_id"]
393
+ end
358
394
  if data.include? "operations"
359
395
  self.operations = data["operations"]
360
396
  end
@@ -379,6 +415,9 @@ module ProcessOut
379
415
  if data.include? "error_code"
380
416
  self.error_code = data["error_code"]
381
417
  end
418
+ if data.include? "three_d_s_status"
419
+ self.three_d_s_status = data["three_d_s_status"]
420
+ end
382
421
  if data.include? "status"
383
422
  self.status = data["status"]
384
423
  end
@@ -430,6 +469,8 @@ module ProcessOut
430
469
  self.token_id = data.fetch(:token_id, self.token_id)
431
470
  self.card = data.fetch(:card, self.card)
432
471
  self.card_id = data.fetch(:card_id, self.card_id)
472
+ self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
473
+ self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
433
474
  self.operations = data.fetch(:operations, self.operations)
434
475
  self.refunds = data.fetch(:refunds, self.refunds)
435
476
  self.name = data.fetch(:name, self.name)
@@ -438,6 +479,7 @@ module ProcessOut
438
479
  self.captured_amount = data.fetch(:captured_amount, self.captured_amount)
439
480
  self.currency = data.fetch(:currency, self.currency)
440
481
  self.error_code = data.fetch(:error_code, self.error_code)
482
+ self.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status)
441
483
  self.status = data.fetch(:status, self.status)
442
484
  self.authorized = data.fetch(:authorized, self.authorized)
443
485
  self.captured = data.fetch(:captured, self.captured)
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: processout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel HUEZ
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-04 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,6 +64,7 @@ files:
64
64
  - ".travis.yml"
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
+ - Makefile
67
68
  - README.md
68
69
  - Rakefile
69
70
  - bin/console