processout 2.13.0 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/processout/activity.rb +14 -0
- data/lib/processout/addon.rb +21 -0
- data/lib/processout/api_request.rb +21 -0
- data/lib/processout/api_version.rb +10 -0
- data/lib/processout/card.rb +79 -0
- data/lib/processout/card_information.rb +14 -0
- data/lib/processout/coupon.rb +20 -0
- data/lib/processout/customer.rb +62 -24
- data/lib/processout/customer_action.rb +9 -0
- data/lib/processout/discount.rb +21 -0
- data/lib/processout/dunning_action.rb +9 -0
- data/lib/processout/event.rb +14 -31
- data/lib/processout/gateway.rb +18 -0
- data/lib/processout/gateway_configuration.rb +18 -0
- data/lib/processout/invoice.rb +166 -2
- data/lib/processout/invoice_detail.rb +22 -0
- data/lib/processout/invoice_device.rb +20 -0
- data/lib/processout/invoice_external_fraud_tools.rb +70 -0
- data/lib/processout/invoice_risk.rb +9 -0
- data/lib/processout/invoice_shipping.rb +19 -0
- data/lib/processout/invoice_tax.rb +81 -0
- data/lib/processout/networking/request.rb +1 -1
- data/lib/processout/payment_data_network_authentication.rb +8 -0
- data/lib/processout/payment_data_three_ds_authentication.rb +8 -0
- data/lib/processout/payment_data_three_ds_request.rb +11 -0
- data/lib/processout/payout.rb +27 -0
- data/lib/processout/payout_item.rb +20 -0
- data/lib/processout/plan.rb +21 -0
- data/lib/processout/product.rb +19 -0
- data/lib/processout/project.rb +18 -27
- data/lib/processout/refund.rb +17 -0
- data/lib/processout/subscription.rb +42 -0
- data/lib/processout/three_ds.rb +158 -0
- data/lib/processout/token.rb +93 -30
- data/lib/processout/transaction.rb +113 -0
- data/lib/processout/transaction_operation.rb +52 -0
- data/lib/processout/version.rb +1 -1
- data/lib/processout/webhook.rb +21 -0
- data/lib/processout/webhook_endpoint.rb +14 -0
- data/lib/processout.rb +18 -0
- metadata +6 -4
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -37,6 +38,14 @@ module ProcessOut
|
|
37
38
|
CustomerAction.new(@client, data)
|
38
39
|
end
|
39
40
|
|
41
|
+
# Overrides the JSON marshaller to only send the fields we want
|
42
|
+
def to_json(options)
|
43
|
+
{
|
44
|
+
"type": self.type,
|
45
|
+
"value": self.value,
|
46
|
+
}.to_json
|
47
|
+
end
|
48
|
+
|
40
49
|
# Fills the object with data coming from the API
|
41
50
|
# Params:
|
42
51
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/discount.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -145,6 +146,26 @@ module ProcessOut
|
|
145
146
|
Discount.new(@client, data)
|
146
147
|
end
|
147
148
|
|
149
|
+
# Overrides the JSON marshaller to only send the fields we want
|
150
|
+
def to_json(options)
|
151
|
+
{
|
152
|
+
"id": self.id,
|
153
|
+
"project": self.project,
|
154
|
+
"project_id": self.project_id,
|
155
|
+
"subscription": self.subscription,
|
156
|
+
"subscription_id": self.subscription_id,
|
157
|
+
"coupon": self.coupon,
|
158
|
+
"coupon_id": self.coupon_id,
|
159
|
+
"name": self.name,
|
160
|
+
"amount": self.amount,
|
161
|
+
"percent": self.percent,
|
162
|
+
"expires_at": self.expires_at,
|
163
|
+
"metadata": self.metadata,
|
164
|
+
"sandbox": self.sandbox,
|
165
|
+
"created_at": self.created_at,
|
166
|
+
}.to_json
|
167
|
+
end
|
168
|
+
|
148
169
|
# Fills the object with data coming from the API
|
149
170
|
# Params:
|
150
171
|
# +data+:: +Hash+ of data coming from the API
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -37,6 +38,14 @@ module ProcessOut
|
|
37
38
|
DunningAction.new(@client, data)
|
38
39
|
end
|
39
40
|
|
41
|
+
# Overrides the JSON marshaller to only send the fields we want
|
42
|
+
def to_json(options)
|
43
|
+
{
|
44
|
+
"action": self.action,
|
45
|
+
"delay_in_days": self.delay_in_days,
|
46
|
+
}.to_json
|
47
|
+
end
|
48
|
+
|
40
49
|
# Fills the object with data coming from the API
|
41
50
|
# Params:
|
42
51
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/event.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -80,6 +81,19 @@ module ProcessOut
|
|
80
81
|
Event.new(@client, data)
|
81
82
|
end
|
82
83
|
|
84
|
+
# Overrides the JSON marshaller to only send the fields we want
|
85
|
+
def to_json(options)
|
86
|
+
{
|
87
|
+
"id": self.id,
|
88
|
+
"project": self.project,
|
89
|
+
"project_id": self.project_id,
|
90
|
+
"name": self.name,
|
91
|
+
"data": self.data,
|
92
|
+
"sandbox": self.sandbox,
|
93
|
+
"fired_at": self.fired_at,
|
94
|
+
}.to_json
|
95
|
+
end
|
96
|
+
|
83
97
|
# Fills the object with data coming from the API
|
84
98
|
# Params:
|
85
99
|
# +data+:: +Hash+ of data coming from the API
|
@@ -215,37 +229,6 @@ module ProcessOut
|
|
215
229
|
|
216
230
|
|
217
231
|
|
218
|
-
return_values[0]
|
219
|
-
end
|
220
|
-
|
221
|
-
# Find an event by the Resource ID that generated it.
|
222
|
-
# Params:
|
223
|
-
# +resource_id+:: Resource ID
|
224
|
-
# +options+:: +Hash+ of options
|
225
|
-
def find_by_resource_id(resource_id, options = {})
|
226
|
-
self.prefill(options)
|
227
|
-
|
228
|
-
request = Request.new(@client)
|
229
|
-
path = "/events/by_resource_id/" + CGI.escape(resource_id) + ""
|
230
|
-
data = {
|
231
|
-
|
232
|
-
}
|
233
|
-
|
234
|
-
response = Response.new(request.get(path, data, options))
|
235
|
-
return_values = Array.new
|
236
|
-
|
237
|
-
a = Array.new
|
238
|
-
body = response.body
|
239
|
-
for v in body['events']
|
240
|
-
tmp = Event.new(@client)
|
241
|
-
tmp.fill_with_data(v)
|
242
|
-
a.push(tmp)
|
243
|
-
end
|
244
|
-
|
245
|
-
return_values.push(a)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
232
|
return_values[0]
|
250
233
|
end
|
251
234
|
|
data/lib/processout/gateway.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -91,6 +92,23 @@ module ProcessOut
|
|
91
92
|
Gateway.new(@client, data)
|
92
93
|
end
|
93
94
|
|
95
|
+
# Overrides the JSON marshaller to only send the fields we want
|
96
|
+
def to_json(options)
|
97
|
+
{
|
98
|
+
"id": self.id,
|
99
|
+
"name": self.name,
|
100
|
+
"display_name": self.display_name,
|
101
|
+
"logo_url": self.logo_url,
|
102
|
+
"url": self.url,
|
103
|
+
"flows": self.flows,
|
104
|
+
"tags": self.tags,
|
105
|
+
"can_pull_transactions": self.can_pull_transactions,
|
106
|
+
"can_refund": self.can_refund,
|
107
|
+
"is_oauth_authentication": self.is_oauth_authentication,
|
108
|
+
"description": self.description,
|
109
|
+
}.to_json
|
110
|
+
end
|
111
|
+
|
94
112
|
# Fills the object with data coming from the API
|
95
113
|
# Params:
|
96
114
|
# +data+:: +Hash+ of data coming from the API
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -115,6 +116,23 @@ module ProcessOut
|
|
115
116
|
GatewayConfiguration.new(@client, data)
|
116
117
|
end
|
117
118
|
|
119
|
+
# Overrides the JSON marshaller to only send the fields we want
|
120
|
+
def to_json(options)
|
121
|
+
{
|
122
|
+
"id": self.id,
|
123
|
+
"project": self.project,
|
124
|
+
"project_id": self.project_id,
|
125
|
+
"gateway": self.gateway,
|
126
|
+
"gateway_id": self.gateway_id,
|
127
|
+
"name": self.name,
|
128
|
+
"default_currency": self.default_currency,
|
129
|
+
"enabled": self.enabled,
|
130
|
+
"public_keys": self.public_keys,
|
131
|
+
"created_at": self.created_at,
|
132
|
+
"enabled_at": self.enabled_at,
|
133
|
+
}.to_json
|
134
|
+
end
|
135
|
+
|
118
136
|
# Fills the object with data coming from the API
|
119
137
|
# Params:
|
120
138
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/invoice.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# The content of this file was automatically generated
|
2
2
|
|
3
3
|
require "cgi"
|
4
|
+
require "json"
|
4
5
|
require "processout/networking/request"
|
5
6
|
require "processout/networking/response"
|
6
7
|
|
@@ -40,6 +41,12 @@ module ProcessOut
|
|
40
41
|
attr_reader :risk
|
41
42
|
attr_reader :shipping
|
42
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
|
43
50
|
|
44
51
|
|
45
52
|
def id=(val)
|
@@ -286,6 +293,54 @@ module ProcessOut
|
|
286
293
|
|
287
294
|
end
|
288
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
|
+
|
289
344
|
|
290
345
|
# Initializes the Invoice object
|
291
346
|
# Params:
|
@@ -327,6 +382,12 @@ module ProcessOut
|
|
327
382
|
self.risk = data.fetch(:risk, nil)
|
328
383
|
self.shipping = data.fetch(:shipping, nil)
|
329
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)
|
330
391
|
|
331
392
|
end
|
332
393
|
|
@@ -335,6 +396,51 @@ module ProcessOut
|
|
335
396
|
Invoice.new(@client, data)
|
336
397
|
end
|
337
398
|
|
399
|
+
# Overrides the JSON marshaller to only send the fields we want
|
400
|
+
def to_json(options)
|
401
|
+
{
|
402
|
+
"id": self.id,
|
403
|
+
"project": self.project,
|
404
|
+
"project_id": self.project_id,
|
405
|
+
"transaction": self.transaction,
|
406
|
+
"transaction_id": self.transaction_id,
|
407
|
+
"customer": self.customer,
|
408
|
+
"customer_id": self.customer_id,
|
409
|
+
"subscription": self.subscription,
|
410
|
+
"subscription_id": self.subscription_id,
|
411
|
+
"token": self.token,
|
412
|
+
"token_id": self.token_id,
|
413
|
+
"details": self.details,
|
414
|
+
"url": self.url,
|
415
|
+
"name": self.name,
|
416
|
+
"amount": self.amount,
|
417
|
+
"currency": self.currency,
|
418
|
+
"merchant_initiator_type": self.merchant_initiator_type,
|
419
|
+
"statement_descriptor": self.statement_descriptor,
|
420
|
+
"statement_descriptor_phone": self.statement_descriptor_phone,
|
421
|
+
"statement_descriptor_city": self.statement_descriptor_city,
|
422
|
+
"statement_descriptor_company": self.statement_descriptor_company,
|
423
|
+
"statement_descriptor_url": self.statement_descriptor_url,
|
424
|
+
"metadata": self.metadata,
|
425
|
+
"gateway_data": self.gateway_data,
|
426
|
+
"return_url": self.return_url,
|
427
|
+
"cancel_url": self.cancel_url,
|
428
|
+
"webhook_url": self.webhook_url,
|
429
|
+
"require_backend_capture": self.require_backend_capture,
|
430
|
+
"sandbox": self.sandbox,
|
431
|
+
"created_at": self.created_at,
|
432
|
+
"risk": self.risk,
|
433
|
+
"shipping": self.shipping,
|
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,
|
441
|
+
}.to_json
|
442
|
+
end
|
443
|
+
|
338
444
|
# Fills the object with data coming from the API
|
339
445
|
# Params:
|
340
446
|
# +data+:: +Hash+ of data coming from the API
|
@@ -441,6 +547,24 @@ module ProcessOut
|
|
441
547
|
if data.include? "device"
|
442
548
|
self.device = data["device"]
|
443
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
|
444
568
|
|
445
569
|
self
|
446
570
|
end
|
@@ -485,10 +609,41 @@ module ProcessOut
|
|
485
609
|
self.risk = data.fetch(:risk, self.risk)
|
486
610
|
self.shipping = data.fetch(:shipping, self.shipping)
|
487
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)
|
488
618
|
|
489
619
|
self
|
490
620
|
end
|
491
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
|
+
|
492
647
|
# Authorize the invoice using the given source (customer or token)
|
493
648
|
# Params:
|
494
649
|
# +source+:: Source used to authorization the payment. Can be a card, a token or a gateway request
|
@@ -499,6 +654,8 @@ module ProcessOut
|
|
499
654
|
request = Request.new(@client)
|
500
655
|
path = "/invoices/" + CGI.escape(@id) + "/authorize"
|
501
656
|
data = {
|
657
|
+
"device" => @device,
|
658
|
+
"incremental" => @incremental,
|
502
659
|
"synchronous" => options.fetch(:synchronous, nil),
|
503
660
|
"retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
|
504
661
|
"capture_amount" => options.fetch(:capture_amount, nil),
|
@@ -529,6 +686,8 @@ module ProcessOut
|
|
529
686
|
request = Request.new(@client)
|
530
687
|
path = "/invoices/" + CGI.escape(@id) + "/capture"
|
531
688
|
data = {
|
689
|
+
"device" => @device,
|
690
|
+
"incremental" => @incremental,
|
532
691
|
"authorize_only" => options.fetch(:authorize_only, nil),
|
533
692
|
"synchronous" => options.fetch(:synchronous, nil),
|
534
693
|
"retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
|
@@ -716,9 +875,12 @@ module ProcessOut
|
|
716
875
|
"name" => @name,
|
717
876
|
"amount" => @amount,
|
718
877
|
"currency" => @currency,
|
719
|
-
"gateway_data" => @gateway_data,
|
720
878
|
"metadata" => @metadata,
|
721
879
|
"details" => @details,
|
880
|
+
"exemption_reason_3ds2" => @exemption_reason_3ds2,
|
881
|
+
"sca_exemption_reason" => @sca_exemption_reason,
|
882
|
+
"challenge_indicator" => @challenge_indicator,
|
883
|
+
"gateway_data" => @gateway_data,
|
722
884
|
"merchant_initiator_type" => @merchant_initiator_type,
|
723
885
|
"statement_descriptor" => @statement_descriptor,
|
724
886
|
"statement_descriptor_phone" => @statement_descriptor_phone,
|
@@ -731,7 +893,9 @@ module ProcessOut
|
|
731
893
|
"risk" => @risk,
|
732
894
|
"shipping" => @shipping,
|
733
895
|
"device" => @device,
|
734
|
-
"require_backend_capture" => @require_backend_capture
|
896
|
+
"require_backend_capture" => @require_backend_capture,
|
897
|
+
"external_fraud_tools" => @external_fraud_tools,
|
898
|
+
"tax" => @tax
|
735
899
|
}
|
736
900
|
|
737
901
|
response = Response.new(request.post(path, data, options))
|