processout 2.14.0 → 2.16.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 +5 -5
- data/lib/processout/balance.rb +81 -0
- data/lib/processout/balances.rb +111 -0
- data/lib/processout/card.rb +43 -0
- data/lib/processout/customer.rb +28 -2
- data/lib/processout/event.rb +0 -31
- data/lib/processout/invoice.rb +123 -1
- data/lib/processout/invoice_device.rb +11 -0
- data/lib/processout/invoice_external_fraud_tools.rb +70 -0
- data/lib/processout/invoice_tax.rb +81 -0
- data/lib/processout/networking/request.rb +1 -1
- data/lib/processout/three_ds.rb +158 -0
- data/lib/processout/token.rb +70 -0
- data/lib/processout/transaction.rb +56 -0
- data/lib/processout/version.rb +1 -1
- data/lib/processout.rb +30 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 779ee1846ec8e9b73d6723ca8a356dc0bec6c6c1789365d0e7e3c46d99a04fa2
|
4
|
+
data.tar.gz: 4d1876dd17cc8913ee449c35909ea8c27f63aa39aa1c4b9562c426c6091827f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd40187eb822037e6914d2a43c28e4e1a7f4c60bf4c7e4d6e36fd4bfcd46817feca556a13d9deb779031d570816be5967145a620ac205fad1a7878a73ffd37bc
|
7
|
+
data.tar.gz: fe2ac4474ef41366774350e8c3c63dfc8d46fb562b4c373e2612541912774a6053f0b7d2c9e40f44c2aa948f7aa68818c8f5a3c0946464bf6009e1bbc0ef6e39
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# The content of this file was automatically generated
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
require "json"
|
5
|
+
require "processout/networking/request"
|
6
|
+
require "processout/networking/response"
|
7
|
+
|
8
|
+
module ProcessOut
|
9
|
+
class Balance
|
10
|
+
|
11
|
+
attr_reader :amount
|
12
|
+
attr_reader :currency
|
13
|
+
|
14
|
+
|
15
|
+
def amount=(val)
|
16
|
+
@amount = val
|
17
|
+
end
|
18
|
+
|
19
|
+
def currency=(val)
|
20
|
+
@currency = val
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# Initializes the Balance object
|
25
|
+
# Params:
|
26
|
+
# +client+:: +ProcessOut+ client instance
|
27
|
+
# +data+:: data that can be used to fill the object
|
28
|
+
def initialize(client, data = {})
|
29
|
+
@client = client
|
30
|
+
|
31
|
+
self.amount = data.fetch(:amount, nil)
|
32
|
+
self.currency = data.fetch(:currency, nil)
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
# Create a new Balance using the current client
|
37
|
+
def new(data = {})
|
38
|
+
Balance.new(@client, data)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Overrides the JSON marshaller to only send the fields we want
|
42
|
+
def to_json(options)
|
43
|
+
{
|
44
|
+
"amount": self.amount,
|
45
|
+
"currency": self.currency,
|
46
|
+
}.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
# Fills the object with data coming from the API
|
50
|
+
# Params:
|
51
|
+
# +data+:: +Hash+ of data coming from the API
|
52
|
+
def fill_with_data(data)
|
53
|
+
if data.nil?
|
54
|
+
return self
|
55
|
+
end
|
56
|
+
if data.include? "amount"
|
57
|
+
self.amount = data["amount"]
|
58
|
+
end
|
59
|
+
if data.include? "currency"
|
60
|
+
self.currency = data["currency"]
|
61
|
+
end
|
62
|
+
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
66
|
+
# Prefills the object with the data passed as parameters
|
67
|
+
# Params:
|
68
|
+
# +data+:: +Hash+ of data
|
69
|
+
def prefill(data)
|
70
|
+
if data.nil?
|
71
|
+
return self
|
72
|
+
end
|
73
|
+
self.amount = data.fetch(:amount, self.amount)
|
74
|
+
self.currency = data.fetch(:currency, self.currency)
|
75
|
+
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# The content of this file was automatically generated
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
require "json"
|
5
|
+
require "processout/networking/request"
|
6
|
+
require "processout/networking/response"
|
7
|
+
|
8
|
+
module ProcessOut
|
9
|
+
class Balances
|
10
|
+
|
11
|
+
attr_reader :vouchers
|
12
|
+
|
13
|
+
|
14
|
+
def vouchers=(val)
|
15
|
+
if val.nil?
|
16
|
+
@vouchers = []
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
if val.length > 0 and val[0].instance_of? Balance
|
21
|
+
@vouchers = val
|
22
|
+
else
|
23
|
+
l = Array.new
|
24
|
+
for v in val
|
25
|
+
obj = Balance.new(@client)
|
26
|
+
obj.fill_with_data(v)
|
27
|
+
l.push(obj)
|
28
|
+
end
|
29
|
+
@vouchers = l
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Initializes the Balances object
|
36
|
+
# Params:
|
37
|
+
# +client+:: +ProcessOut+ client instance
|
38
|
+
# +data+:: data that can be used to fill the object
|
39
|
+
def initialize(client, data = {})
|
40
|
+
@client = client
|
41
|
+
|
42
|
+
self.vouchers = data.fetch(:vouchers, nil)
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
# Create a new Balances using the current client
|
47
|
+
def new(data = {})
|
48
|
+
Balances.new(@client, data)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Overrides the JSON marshaller to only send the fields we want
|
52
|
+
def to_json(options)
|
53
|
+
{
|
54
|
+
"vouchers": self.vouchers,
|
55
|
+
}.to_json
|
56
|
+
end
|
57
|
+
|
58
|
+
# Fills the object with data coming from the API
|
59
|
+
# Params:
|
60
|
+
# +data+:: +Hash+ of data coming from the API
|
61
|
+
def fill_with_data(data)
|
62
|
+
if data.nil?
|
63
|
+
return self
|
64
|
+
end
|
65
|
+
if data.include? "vouchers"
|
66
|
+
self.vouchers = data["vouchers"]
|
67
|
+
end
|
68
|
+
|
69
|
+
self
|
70
|
+
end
|
71
|
+
|
72
|
+
# Prefills the object with the data passed as parameters
|
73
|
+
# Params:
|
74
|
+
# +data+:: +Hash+ of data
|
75
|
+
def prefill(data)
|
76
|
+
if data.nil?
|
77
|
+
return self
|
78
|
+
end
|
79
|
+
self.vouchers = data.fetch(:vouchers, self.vouchers)
|
80
|
+
|
81
|
+
self
|
82
|
+
end
|
83
|
+
|
84
|
+
# Fetch a customer token's balance
|
85
|
+
# Params:
|
86
|
+
# +token_id+:: ID of the customer's token
|
87
|
+
# +options+:: +Hash+ of options
|
88
|
+
def find(token_id, options = {})
|
89
|
+
self.prefill(options)
|
90
|
+
|
91
|
+
request = Request.new(@client)
|
92
|
+
path = "/balances/tokens/" + CGI.escape(token_id) + ""
|
93
|
+
data = {
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
response = Response.new(request.get(path, data, options))
|
98
|
+
return_values = Array.new
|
99
|
+
|
100
|
+
body = response.body
|
101
|
+
body = body["balances"]
|
102
|
+
balances = Balances.new(@client)
|
103
|
+
return_values.push(balances.fill_with_data(body))
|
104
|
+
|
105
|
+
|
106
|
+
return_values[0]
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
data/lib/processout/card.rb
CHANGED
@@ -18,6 +18,7 @@ module ProcessOut
|
|
18
18
|
attr_reader :type
|
19
19
|
attr_reader :bank_name
|
20
20
|
attr_reader :brand
|
21
|
+
attr_reader :category
|
21
22
|
attr_reader :iin
|
22
23
|
attr_reader :last_4_digits
|
23
24
|
attr_reader :exp_month
|
@@ -33,6 +34,7 @@ module ProcessOut
|
|
33
34
|
attr_reader :country_code
|
34
35
|
attr_reader :ip_address
|
35
36
|
attr_reader :fingerprint
|
37
|
+
attr_reader :token_type
|
36
38
|
attr_reader :metadata
|
37
39
|
attr_reader :expires_soon
|
38
40
|
attr_reader :sandbox
|
@@ -103,6 +105,10 @@ module ProcessOut
|
|
103
105
|
@brand = val
|
104
106
|
end
|
105
107
|
|
108
|
+
def category=(val)
|
109
|
+
@category = val
|
110
|
+
end
|
111
|
+
|
106
112
|
def iin=(val)
|
107
113
|
@iin = val
|
108
114
|
end
|
@@ -163,6 +169,10 @@ module ProcessOut
|
|
163
169
|
@fingerprint = val
|
164
170
|
end
|
165
171
|
|
172
|
+
def token_type=(val)
|
173
|
+
@token_type = val
|
174
|
+
end
|
175
|
+
|
166
176
|
def metadata=(val)
|
167
177
|
@metadata = val
|
168
178
|
end
|
@@ -197,6 +207,7 @@ module ProcessOut
|
|
197
207
|
self.type = data.fetch(:type, nil)
|
198
208
|
self.bank_name = data.fetch(:bank_name, nil)
|
199
209
|
self.brand = data.fetch(:brand, nil)
|
210
|
+
self.category = data.fetch(:category, nil)
|
200
211
|
self.iin = data.fetch(:iin, nil)
|
201
212
|
self.last_4_digits = data.fetch(:last_4_digits, nil)
|
202
213
|
self.exp_month = data.fetch(:exp_month, nil)
|
@@ -212,6 +223,7 @@ module ProcessOut
|
|
212
223
|
self.country_code = data.fetch(:country_code, nil)
|
213
224
|
self.ip_address = data.fetch(:ip_address, nil)
|
214
225
|
self.fingerprint = data.fetch(:fingerprint, nil)
|
226
|
+
self.token_type = data.fetch(:token_type, nil)
|
215
227
|
self.metadata = data.fetch(:metadata, nil)
|
216
228
|
self.expires_soon = data.fetch(:expires_soon, nil)
|
217
229
|
self.sandbox = data.fetch(:sandbox, nil)
|
@@ -237,6 +249,7 @@ module ProcessOut
|
|
237
249
|
"type": self.type,
|
238
250
|
"bank_name": self.bank_name,
|
239
251
|
"brand": self.brand,
|
252
|
+
"category": self.category,
|
240
253
|
"iin": self.iin,
|
241
254
|
"last_4_digits": self.last_4_digits,
|
242
255
|
"exp_month": self.exp_month,
|
@@ -252,6 +265,7 @@ module ProcessOut
|
|
252
265
|
"country_code": self.country_code,
|
253
266
|
"ip_address": self.ip_address,
|
254
267
|
"fingerprint": self.fingerprint,
|
268
|
+
"token_type": self.token_type,
|
255
269
|
"metadata": self.metadata,
|
256
270
|
"expires_soon": self.expires_soon,
|
257
271
|
"sandbox": self.sandbox,
|
@@ -296,6 +310,9 @@ module ProcessOut
|
|
296
310
|
if data.include? "brand"
|
297
311
|
self.brand = data["brand"]
|
298
312
|
end
|
313
|
+
if data.include? "category"
|
314
|
+
self.category = data["category"]
|
315
|
+
end
|
299
316
|
if data.include? "iin"
|
300
317
|
self.iin = data["iin"]
|
301
318
|
end
|
@@ -341,6 +358,9 @@ module ProcessOut
|
|
341
358
|
if data.include? "fingerprint"
|
342
359
|
self.fingerprint = data["fingerprint"]
|
343
360
|
end
|
361
|
+
if data.include? "token_type"
|
362
|
+
self.token_type = data["token_type"]
|
363
|
+
end
|
344
364
|
if data.include? "metadata"
|
345
365
|
self.metadata = data["metadata"]
|
346
366
|
end
|
@@ -374,6 +394,7 @@ module ProcessOut
|
|
374
394
|
self.type = data.fetch(:type, self.type)
|
375
395
|
self.bank_name = data.fetch(:bank_name, self.bank_name)
|
376
396
|
self.brand = data.fetch(:brand, self.brand)
|
397
|
+
self.category = data.fetch(:category, self.category)
|
377
398
|
self.iin = data.fetch(:iin, self.iin)
|
378
399
|
self.last_4_digits = data.fetch(:last_4_digits, self.last_4_digits)
|
379
400
|
self.exp_month = data.fetch(:exp_month, self.exp_month)
|
@@ -389,6 +410,7 @@ module ProcessOut
|
|
389
410
|
self.country_code = data.fetch(:country_code, self.country_code)
|
390
411
|
self.ip_address = data.fetch(:ip_address, self.ip_address)
|
391
412
|
self.fingerprint = data.fetch(:fingerprint, self.fingerprint)
|
413
|
+
self.token_type = data.fetch(:token_type, self.token_type)
|
392
414
|
self.metadata = data.fetch(:metadata, self.metadata)
|
393
415
|
self.expires_soon = data.fetch(:expires_soon, self.expires_soon)
|
394
416
|
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
@@ -452,6 +474,27 @@ module ProcessOut
|
|
452
474
|
|
453
475
|
|
454
476
|
|
477
|
+
return_values[0]
|
478
|
+
end
|
479
|
+
|
480
|
+
# Anonymize the card.
|
481
|
+
# Params:
|
482
|
+
# +options+:: +Hash+ of options
|
483
|
+
def anonymize(options = {})
|
484
|
+
self.prefill(options)
|
485
|
+
|
486
|
+
request = Request.new(@client)
|
487
|
+
path = "/cards/" + CGI.escape(@id) + ""
|
488
|
+
data = {
|
489
|
+
|
490
|
+
}
|
491
|
+
|
492
|
+
response = Response.new(request.delete(path, data, options))
|
493
|
+
return_values = Array.new
|
494
|
+
|
495
|
+
return_values.push(response.success)
|
496
|
+
|
497
|
+
|
455
498
|
return_values[0]
|
456
499
|
end
|
457
500
|
|
data/lib/processout/customer.rb
CHANGED
@@ -35,6 +35,8 @@ module ProcessOut
|
|
35
35
|
attr_reader :metadata
|
36
36
|
attr_reader :sandbox
|
37
37
|
attr_reader :created_at
|
38
|
+
attr_reader :registered_at
|
39
|
+
attr_reader :date_of_birth
|
38
40
|
|
39
41
|
|
40
42
|
def id=(val)
|
@@ -217,6 +219,14 @@ module ProcessOut
|
|
217
219
|
@created_at = val
|
218
220
|
end
|
219
221
|
|
222
|
+
def registered_at=(val)
|
223
|
+
@registered_at = val
|
224
|
+
end
|
225
|
+
|
226
|
+
def date_of_birth=(val)
|
227
|
+
@date_of_birth = val
|
228
|
+
end
|
229
|
+
|
220
230
|
|
221
231
|
# Initializes the Customer object
|
222
232
|
# Params:
|
@@ -252,6 +262,8 @@ module ProcessOut
|
|
252
262
|
self.metadata = data.fetch(:metadata, nil)
|
253
263
|
self.sandbox = data.fetch(:sandbox, nil)
|
254
264
|
self.created_at = data.fetch(:created_at, nil)
|
265
|
+
self.registered_at = data.fetch(:registered_at, nil)
|
266
|
+
self.date_of_birth = data.fetch(:date_of_birth, nil)
|
255
267
|
|
256
268
|
end
|
257
269
|
|
@@ -290,6 +302,8 @@ module ProcessOut
|
|
290
302
|
"metadata": self.metadata,
|
291
303
|
"sandbox": self.sandbox,
|
292
304
|
"created_at": self.created_at,
|
305
|
+
"registered_at": self.registered_at,
|
306
|
+
"date_of_birth": self.date_of_birth,
|
293
307
|
}.to_json
|
294
308
|
end
|
295
309
|
|
@@ -381,6 +395,12 @@ module ProcessOut
|
|
381
395
|
if data.include? "created_at"
|
382
396
|
self.created_at = data["created_at"]
|
383
397
|
end
|
398
|
+
if data.include? "registered_at"
|
399
|
+
self.registered_at = data["registered_at"]
|
400
|
+
end
|
401
|
+
if data.include? "date_of_birth"
|
402
|
+
self.date_of_birth = data["date_of_birth"]
|
403
|
+
end
|
384
404
|
|
385
405
|
self
|
386
406
|
end
|
@@ -419,6 +439,8 @@ module ProcessOut
|
|
419
439
|
self.metadata = data.fetch(:metadata, self.metadata)
|
420
440
|
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
421
441
|
self.created_at = data.fetch(:created_at, self.created_at)
|
442
|
+
self.registered_at = data.fetch(:registered_at, self.registered_at)
|
443
|
+
self.date_of_birth = data.fetch(:date_of_birth, self.date_of_birth)
|
422
444
|
|
423
445
|
self
|
424
446
|
end
|
@@ -613,10 +635,12 @@ module ProcessOut
|
|
613
635
|
"ip_address" => @ip_address,
|
614
636
|
"phone_number" => @phone_number,
|
615
637
|
"legal_document" => @legal_document,
|
638
|
+
"date_of_birth" => @date_of_birth,
|
616
639
|
"is_business" => @is_business,
|
617
640
|
"sex" => @sex,
|
618
641
|
"metadata" => @metadata,
|
619
|
-
"id" => @id
|
642
|
+
"id" => @id,
|
643
|
+
"registered_at" => @registered_at
|
620
644
|
}
|
621
645
|
|
622
646
|
response = Response.new(request.post(path, data, options))
|
@@ -684,9 +708,11 @@ module ProcessOut
|
|
684
708
|
"ip_address" => @ip_address,
|
685
709
|
"phone_number" => @phone_number,
|
686
710
|
"legal_document" => @legal_document,
|
711
|
+
"date_of_birth" => @date_of_birth,
|
687
712
|
"is_business" => @is_business,
|
688
713
|
"sex" => @sex,
|
689
|
-
"metadata" => @metadata
|
714
|
+
"metadata" => @metadata,
|
715
|
+
"registered_at" => @registered_at
|
690
716
|
}
|
691
717
|
|
692
718
|
response = Response.new(request.put(path, data, options))
|
data/lib/processout/event.rb
CHANGED
@@ -229,37 +229,6 @@ module ProcessOut
|
|
229
229
|
|
230
230
|
|
231
231
|
|
232
|
-
return_values[0]
|
233
|
-
end
|
234
|
-
|
235
|
-
# Find an event by the Resource ID that generated it.
|
236
|
-
# Params:
|
237
|
-
# +resource_id+:: Resource ID
|
238
|
-
# +options+:: +Hash+ of options
|
239
|
-
def find_by_resource_id(resource_id, options = {})
|
240
|
-
self.prefill(options)
|
241
|
-
|
242
|
-
request = Request.new(@client)
|
243
|
-
path = "/events/by_resource_id/" + CGI.escape(resource_id) + ""
|
244
|
-
data = {
|
245
|
-
|
246
|
-
}
|
247
|
-
|
248
|
-
response = Response.new(request.get(path, data, options))
|
249
|
-
return_values = Array.new
|
250
|
-
|
251
|
-
a = Array.new
|
252
|
-
body = response.body
|
253
|
-
for v in body['events']
|
254
|
-
tmp = Event.new(@client)
|
255
|
-
tmp.fill_with_data(v)
|
256
|
-
a.push(tmp)
|
257
|
-
end
|
258
|
-
|
259
|
-
return_values.push(a)
|
260
|
-
|
261
|
-
|
262
|
-
|
263
232
|
return_values[0]
|
264
233
|
end
|
265
234
|
|
data/lib/processout/invoice.rb
CHANGED
@@ -41,6 +41,12 @@ module ProcessOut
|
|
41
41
|
attr_reader :risk
|
42
42
|
attr_reader :shipping
|
43
43
|
attr_reader :device
|
44
|
+
attr_reader :external_fraud_tools
|
45
|
+
attr_reader :exemption_reason_3ds2
|
46
|
+
attr_reader :sca_exemption_reason
|
47
|
+
attr_reader :challenge_indicator
|
48
|
+
attr_reader :incremental
|
49
|
+
attr_reader :tax
|
44
50
|
|
45
51
|
|
46
52
|
def id=(val)
|
@@ -287,6 +293,54 @@ module ProcessOut
|
|
287
293
|
|
288
294
|
end
|
289
295
|
|
296
|
+
def external_fraud_tools=(val)
|
297
|
+
if val.nil?
|
298
|
+
@external_fraud_tools = val
|
299
|
+
return
|
300
|
+
end
|
301
|
+
|
302
|
+
if val.instance_of? InvoiceExternalFraudTools
|
303
|
+
@external_fraud_tools = val
|
304
|
+
else
|
305
|
+
obj = InvoiceExternalFraudTools.new(@client)
|
306
|
+
obj.fill_with_data(val)
|
307
|
+
@external_fraud_tools = obj
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
311
|
+
|
312
|
+
def exemption_reason_3ds2=(val)
|
313
|
+
@exemption_reason_3ds2 = val
|
314
|
+
end
|
315
|
+
|
316
|
+
def sca_exemption_reason=(val)
|
317
|
+
@sca_exemption_reason = val
|
318
|
+
end
|
319
|
+
|
320
|
+
def challenge_indicator=(val)
|
321
|
+
@challenge_indicator = val
|
322
|
+
end
|
323
|
+
|
324
|
+
def incremental=(val)
|
325
|
+
@incremental = val
|
326
|
+
end
|
327
|
+
|
328
|
+
def tax=(val)
|
329
|
+
if val.nil?
|
330
|
+
@tax = val
|
331
|
+
return
|
332
|
+
end
|
333
|
+
|
334
|
+
if val.instance_of? InvoiceTax
|
335
|
+
@tax = val
|
336
|
+
else
|
337
|
+
obj = InvoiceTax.new(@client)
|
338
|
+
obj.fill_with_data(val)
|
339
|
+
@tax = obj
|
340
|
+
end
|
341
|
+
|
342
|
+
end
|
343
|
+
|
290
344
|
|
291
345
|
# Initializes the Invoice object
|
292
346
|
# Params:
|
@@ -328,6 +382,12 @@ module ProcessOut
|
|
328
382
|
self.risk = data.fetch(:risk, nil)
|
329
383
|
self.shipping = data.fetch(:shipping, nil)
|
330
384
|
self.device = data.fetch(:device, nil)
|
385
|
+
self.external_fraud_tools = data.fetch(:external_fraud_tools, nil)
|
386
|
+
self.exemption_reason_3ds2 = data.fetch(:exemption_reason_3ds2, nil)
|
387
|
+
self.sca_exemption_reason = data.fetch(:sca_exemption_reason, nil)
|
388
|
+
self.challenge_indicator = data.fetch(:challenge_indicator, nil)
|
389
|
+
self.incremental = data.fetch(:incremental, nil)
|
390
|
+
self.tax = data.fetch(:tax, nil)
|
331
391
|
|
332
392
|
end
|
333
393
|
|
@@ -372,6 +432,12 @@ module ProcessOut
|
|
372
432
|
"risk": self.risk,
|
373
433
|
"shipping": self.shipping,
|
374
434
|
"device": self.device,
|
435
|
+
"external_fraud_tools": self.external_fraud_tools,
|
436
|
+
"exemption_reason_3ds2": self.exemption_reason_3ds2,
|
437
|
+
"sca_exemption_reason": self.sca_exemption_reason,
|
438
|
+
"challenge_indicator": self.challenge_indicator,
|
439
|
+
"incremental": self.incremental,
|
440
|
+
"tax": self.tax,
|
375
441
|
}.to_json
|
376
442
|
end
|
377
443
|
|
@@ -481,6 +547,24 @@ module ProcessOut
|
|
481
547
|
if data.include? "device"
|
482
548
|
self.device = data["device"]
|
483
549
|
end
|
550
|
+
if data.include? "external_fraud_tools"
|
551
|
+
self.external_fraud_tools = data["external_fraud_tools"]
|
552
|
+
end
|
553
|
+
if data.include? "exemption_reason_3ds2"
|
554
|
+
self.exemption_reason_3ds2 = data["exemption_reason_3ds2"]
|
555
|
+
end
|
556
|
+
if data.include? "sca_exemption_reason"
|
557
|
+
self.sca_exemption_reason = data["sca_exemption_reason"]
|
558
|
+
end
|
559
|
+
if data.include? "challenge_indicator"
|
560
|
+
self.challenge_indicator = data["challenge_indicator"]
|
561
|
+
end
|
562
|
+
if data.include? "incremental"
|
563
|
+
self.incremental = data["incremental"]
|
564
|
+
end
|
565
|
+
if data.include? "tax"
|
566
|
+
self.tax = data["tax"]
|
567
|
+
end
|
484
568
|
|
485
569
|
self
|
486
570
|
end
|
@@ -525,10 +609,41 @@ module ProcessOut
|
|
525
609
|
self.risk = data.fetch(:risk, self.risk)
|
526
610
|
self.shipping = data.fetch(:shipping, self.shipping)
|
527
611
|
self.device = data.fetch(:device, self.device)
|
612
|
+
self.external_fraud_tools = data.fetch(:external_fraud_tools, self.external_fraud_tools)
|
613
|
+
self.exemption_reason_3ds2 = data.fetch(:exemption_reason_3ds2, self.exemption_reason_3ds2)
|
614
|
+
self.sca_exemption_reason = data.fetch(:sca_exemption_reason, self.sca_exemption_reason)
|
615
|
+
self.challenge_indicator = data.fetch(:challenge_indicator, self.challenge_indicator)
|
616
|
+
self.incremental = data.fetch(:incremental, self.incremental)
|
617
|
+
self.tax = data.fetch(:tax, self.tax)
|
528
618
|
|
529
619
|
self
|
530
620
|
end
|
531
621
|
|
622
|
+
# Create an incremental authorization
|
623
|
+
# Params:
|
624
|
+
# +amount+:: Amount to increment authorization by
|
625
|
+
# +options+:: +Hash+ of options
|
626
|
+
def increment_authorization(amount, options = {})
|
627
|
+
self.prefill(options)
|
628
|
+
|
629
|
+
request = Request.new(@client)
|
630
|
+
path = "/invoices/" + CGI.escape(@id) + "/increment_authorization"
|
631
|
+
data = {
|
632
|
+
"amount" => amount
|
633
|
+
}
|
634
|
+
|
635
|
+
response = Response.new(request.post(path, data, options))
|
636
|
+
return_values = Array.new
|
637
|
+
|
638
|
+
body = response.body
|
639
|
+
body = body["transaction"]
|
640
|
+
transaction = Transaction.new(@client)
|
641
|
+
return_values.push(transaction.fill_with_data(body))
|
642
|
+
|
643
|
+
|
644
|
+
return_values[0]
|
645
|
+
end
|
646
|
+
|
532
647
|
# Authorize the invoice using the given source (customer or token)
|
533
648
|
# Params:
|
534
649
|
# +source+:: Source used to authorization the payment. Can be a card, a token or a gateway request
|
@@ -540,6 +655,7 @@ module ProcessOut
|
|
540
655
|
path = "/invoices/" + CGI.escape(@id) + "/authorize"
|
541
656
|
data = {
|
542
657
|
"device" => @device,
|
658
|
+
"incremental" => @incremental,
|
543
659
|
"synchronous" => options.fetch(:synchronous, nil),
|
544
660
|
"retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
|
545
661
|
"capture_amount" => options.fetch(:capture_amount, nil),
|
@@ -571,6 +687,7 @@ module ProcessOut
|
|
571
687
|
path = "/invoices/" + CGI.escape(@id) + "/capture"
|
572
688
|
data = {
|
573
689
|
"device" => @device,
|
690
|
+
"incremental" => @incremental,
|
574
691
|
"authorize_only" => options.fetch(:authorize_only, nil),
|
575
692
|
"synchronous" => options.fetch(:synchronous, nil),
|
576
693
|
"retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
|
@@ -760,6 +877,9 @@ module ProcessOut
|
|
760
877
|
"currency" => @currency,
|
761
878
|
"metadata" => @metadata,
|
762
879
|
"details" => @details,
|
880
|
+
"exemption_reason_3ds2" => @exemption_reason_3ds2,
|
881
|
+
"sca_exemption_reason" => @sca_exemption_reason,
|
882
|
+
"challenge_indicator" => @challenge_indicator,
|
763
883
|
"gateway_data" => @gateway_data,
|
764
884
|
"merchant_initiator_type" => @merchant_initiator_type,
|
765
885
|
"statement_descriptor" => @statement_descriptor,
|
@@ -773,7 +893,9 @@ module ProcessOut
|
|
773
893
|
"risk" => @risk,
|
774
894
|
"shipping" => @shipping,
|
775
895
|
"device" => @device,
|
776
|
-
"require_backend_capture" => @require_backend_capture
|
896
|
+
"require_backend_capture" => @require_backend_capture,
|
897
|
+
"external_fraud_tools" => @external_fraud_tools,
|
898
|
+
"tax" => @tax
|
777
899
|
}
|
778
900
|
|
779
901
|
response = Response.new(request.post(path, data, options))
|
@@ -10,6 +10,7 @@ module ProcessOut
|
|
10
10
|
|
11
11
|
attr_reader :channel
|
12
12
|
attr_reader :ip_address
|
13
|
+
attr_reader :id
|
13
14
|
|
14
15
|
|
15
16
|
def channel=(val)
|
@@ -20,6 +21,10 @@ module ProcessOut
|
|
20
21
|
@ip_address = val
|
21
22
|
end
|
22
23
|
|
24
|
+
def id=(val)
|
25
|
+
@id = val
|
26
|
+
end
|
27
|
+
|
23
28
|
|
24
29
|
# Initializes the InvoiceDevice object
|
25
30
|
# Params:
|
@@ -30,6 +35,7 @@ module ProcessOut
|
|
30
35
|
|
31
36
|
self.channel = data.fetch(:channel, nil)
|
32
37
|
self.ip_address = data.fetch(:ip_address, nil)
|
38
|
+
self.id = data.fetch(:id, nil)
|
33
39
|
|
34
40
|
end
|
35
41
|
|
@@ -43,6 +49,7 @@ module ProcessOut
|
|
43
49
|
{
|
44
50
|
"channel": self.channel,
|
45
51
|
"ip_address": self.ip_address,
|
52
|
+
"id": self.id,
|
46
53
|
}.to_json
|
47
54
|
end
|
48
55
|
|
@@ -59,6 +66,9 @@ module ProcessOut
|
|
59
66
|
if data.include? "ip_address"
|
60
67
|
self.ip_address = data["ip_address"]
|
61
68
|
end
|
69
|
+
if data.include? "id"
|
70
|
+
self.id = data["id"]
|
71
|
+
end
|
62
72
|
|
63
73
|
self
|
64
74
|
end
|
@@ -72,6 +82,7 @@ module ProcessOut
|
|
72
82
|
end
|
73
83
|
self.channel = data.fetch(:channel, self.channel)
|
74
84
|
self.ip_address = data.fetch(:ip_address, self.ip_address)
|
85
|
+
self.id = data.fetch(:id, self.id)
|
75
86
|
|
76
87
|
self
|
77
88
|
end
|