processout 2.13.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/processout/activity.rb +14 -0
  3. data/lib/processout/addon.rb +21 -0
  4. data/lib/processout/api_request.rb +21 -0
  5. data/lib/processout/api_version.rb +10 -0
  6. data/lib/processout/card.rb +36 -0
  7. data/lib/processout/card_information.rb +14 -0
  8. data/lib/processout/coupon.rb +20 -0
  9. data/lib/processout/customer.rb +34 -22
  10. data/lib/processout/customer_action.rb +9 -0
  11. data/lib/processout/discount.rb +21 -0
  12. data/lib/processout/dunning_action.rb +9 -0
  13. data/lib/processout/event.rb +14 -0
  14. data/lib/processout/gateway.rb +18 -0
  15. data/lib/processout/gateway_configuration.rb +18 -0
  16. data/lib/processout/invoice.rb +43 -1
  17. data/lib/processout/invoice_detail.rb +22 -0
  18. data/lib/processout/invoice_device.rb +9 -0
  19. data/lib/processout/invoice_risk.rb +9 -0
  20. data/lib/processout/invoice_shipping.rb +19 -0
  21. data/lib/processout/networking/request.rb +1 -1
  22. data/lib/processout/payment_data_network_authentication.rb +8 -0
  23. data/lib/processout/payment_data_three_ds_authentication.rb +8 -0
  24. data/lib/processout/payment_data_three_ds_request.rb +11 -0
  25. data/lib/processout/payout.rb +27 -0
  26. data/lib/processout/payout_item.rb +20 -0
  27. data/lib/processout/plan.rb +21 -0
  28. data/lib/processout/product.rb +19 -0
  29. data/lib/processout/project.rb +18 -27
  30. data/lib/processout/refund.rb +17 -0
  31. data/lib/processout/subscription.rb +42 -0
  32. data/lib/processout/token.rb +39 -33
  33. data/lib/processout/transaction.rb +57 -0
  34. data/lib/processout/transaction_operation.rb +52 -0
  35. data/lib/processout/version.rb +1 -1
  36. data/lib/processout/webhook.rb +21 -0
  37. data/lib/processout/webhook_endpoint.rb +14 -0
  38. metadata +2 -2
@@ -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
@@ -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
 
@@ -335,6 +336,45 @@ module ProcessOut
335
336
  Invoice.new(@client, data)
336
337
  end
337
338
 
339
+ # Overrides the JSON marshaller to only send the fields we want
340
+ def to_json(options)
341
+ {
342
+ "id": self.id,
343
+ "project": self.project,
344
+ "project_id": self.project_id,
345
+ "transaction": self.transaction,
346
+ "transaction_id": self.transaction_id,
347
+ "customer": self.customer,
348
+ "customer_id": self.customer_id,
349
+ "subscription": self.subscription,
350
+ "subscription_id": self.subscription_id,
351
+ "token": self.token,
352
+ "token_id": self.token_id,
353
+ "details": self.details,
354
+ "url": self.url,
355
+ "name": self.name,
356
+ "amount": self.amount,
357
+ "currency": self.currency,
358
+ "merchant_initiator_type": self.merchant_initiator_type,
359
+ "statement_descriptor": self.statement_descriptor,
360
+ "statement_descriptor_phone": self.statement_descriptor_phone,
361
+ "statement_descriptor_city": self.statement_descriptor_city,
362
+ "statement_descriptor_company": self.statement_descriptor_company,
363
+ "statement_descriptor_url": self.statement_descriptor_url,
364
+ "metadata": self.metadata,
365
+ "gateway_data": self.gateway_data,
366
+ "return_url": self.return_url,
367
+ "cancel_url": self.cancel_url,
368
+ "webhook_url": self.webhook_url,
369
+ "require_backend_capture": self.require_backend_capture,
370
+ "sandbox": self.sandbox,
371
+ "created_at": self.created_at,
372
+ "risk": self.risk,
373
+ "shipping": self.shipping,
374
+ "device": self.device,
375
+ }.to_json
376
+ end
377
+
338
378
  # Fills the object with data coming from the API
339
379
  # Params:
340
380
  # +data+:: +Hash+ of data coming from the API
@@ -499,6 +539,7 @@ module ProcessOut
499
539
  request = Request.new(@client)
500
540
  path = "/invoices/" + CGI.escape(@id) + "/authorize"
501
541
  data = {
542
+ "device" => @device,
502
543
  "synchronous" => options.fetch(:synchronous, nil),
503
544
  "retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
504
545
  "capture_amount" => options.fetch(:capture_amount, nil),
@@ -529,6 +570,7 @@ module ProcessOut
529
570
  request = Request.new(@client)
530
571
  path = "/invoices/" + CGI.escape(@id) + "/capture"
531
572
  data = {
573
+ "device" => @device,
532
574
  "authorize_only" => options.fetch(:authorize_only, nil),
533
575
  "synchronous" => options.fetch(:synchronous, nil),
534
576
  "retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
@@ -716,9 +758,9 @@ module ProcessOut
716
758
  "name" => @name,
717
759
  "amount" => @amount,
718
760
  "currency" => @currency,
719
- "gateway_data" => @gateway_data,
720
761
  "metadata" => @metadata,
721
762
  "details" => @details,
763
+ "gateway_data" => @gateway_data,
722
764
  "merchant_initiator_type" => @merchant_initiator_type,
723
765
  "statement_descriptor" => @statement_descriptor,
724
766
  "statement_descriptor_phone" => @statement_descriptor_phone,
@@ -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,27 @@ module ProcessOut
115
116
  InvoiceDetail.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
+ "name": self.name,
123
+ "type": self.type,
124
+ "amount": self.amount,
125
+ "quantity": self.quantity,
126
+ "metadata": self.metadata,
127
+ "reference": self.reference,
128
+ "description": self.description,
129
+ "brand": self.brand,
130
+ "model": self.model,
131
+ "discount_amount": self.discount_amount,
132
+ "condition": self.condition,
133
+ "marketplace_merchant": self.marketplace_merchant,
134
+ "marketplace_merchant_is_business": self.marketplace_merchant_is_business,
135
+ "marketplace_merchant_created_at": self.marketplace_merchant_created_at,
136
+ "category": self.category,
137
+ }.to_json
138
+ end
139
+
118
140
  # Fills the object with data coming from the API
119
141
  # Params:
120
142
  # +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
  InvoiceDevice.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
+ "channel": self.channel,
45
+ "ip_address": self.ip_address,
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
@@ -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
  InvoiceRisk.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
+ "score": self.score,
45
+ "is_legit": self.is_legit,
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
@@ -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
 
@@ -97,6 +98,24 @@ module ProcessOut
97
98
  InvoiceShipping.new(@client, data)
98
99
  end
99
100
 
101
+ # Overrides the JSON marshaller to only send the fields we want
102
+ def to_json(options)
103
+ {
104
+ "amount": self.amount,
105
+ "method": self.method,
106
+ "provider": self.provider,
107
+ "delay": self.delay,
108
+ "address1": self.address1,
109
+ "address2": self.address2,
110
+ "city": self.city,
111
+ "state": self.state,
112
+ "country_code": self.country_code,
113
+ "zip": self.zip,
114
+ "phone_number": self.phone_number,
115
+ "expects_shipping_at": self.expects_shipping_at,
116
+ }.to_json
117
+ end
118
+
100
119
  # Fills the object with data coming from the API
101
120
  # Params:
102
121
  # +data+:: +Hash+ of data coming from the API
@@ -13,7 +13,7 @@ module ProcessOut
13
13
  req.basic_auth @client.project_id, @client.project_secret
14
14
  req.content_type = "application/json"
15
15
  req["API-Version"] = "1.4.0.0"
16
- req["User-Agent"] = "ProcessOut Ruby-Bindings/2.13.0"
16
+ req["User-Agent"] = "ProcessOut Ruby-Bindings/2.14.0"
17
17
 
18
18
  unless options.nil?
19
19
  req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
@@ -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
 
@@ -31,6 +32,13 @@ module ProcessOut
31
32
  PaymentDataNetworkAuthentication.new(@client, data)
32
33
  end
33
34
 
35
+ # Overrides the JSON marshaller to only send the fields we want
36
+ def to_json(options)
37
+ {
38
+ "cavv": self.cavv,
39
+ }.to_json
40
+ end
41
+
34
42
  # Fills the object with data coming from the API
35
43
  # Params:
36
44
  # +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
 
@@ -31,6 +32,13 @@ module ProcessOut
31
32
  PaymentDataThreeDSAuthentication.new(@client, data)
32
33
  end
33
34
 
35
+ # Overrides the JSON marshaller to only send the fields we want
36
+ def to_json(options)
37
+ {
38
+ "XID": self.xid,
39
+ }.to_json
40
+ end
41
+
34
42
  # Fills the object with data coming from the API
35
43
  # Params:
36
44
  # +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
 
@@ -49,6 +50,16 @@ module ProcessOut
49
50
  PaymentDataThreeDSRequest.new(@client, data)
50
51
  end
51
52
 
53
+ # Overrides the JSON marshaller to only send the fields we want
54
+ def to_json(options)
55
+ {
56
+ "acs_url": self.acs_url,
57
+ "pareq": self.pareq,
58
+ "md": self.md,
59
+ "term_url": self.term_url,
60
+ }.to_json
61
+ end
62
+
52
63
  # Fills the object with data coming from the API
53
64
  # Params:
54
65
  # +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
 
@@ -157,6 +158,32 @@ module ProcessOut
157
158
  Payout.new(@client, data)
158
159
  end
159
160
 
161
+ # Overrides the JSON marshaller to only send the fields we want
162
+ def to_json(options)
163
+ {
164
+ "id": self.id,
165
+ "project": self.project,
166
+ "project_id": self.project_id,
167
+ "status": self.status,
168
+ "amount": self.amount,
169
+ "currency": self.currency,
170
+ "metadata": self.metadata,
171
+ "bank_name": self.bank_name,
172
+ "bank_summary": self.bank_summary,
173
+ "sales_transactions": self.sales_transactions,
174
+ "sales_volume": self.sales_volume,
175
+ "refunds_transactions": self.refunds_transactions,
176
+ "refunds_volume": self.refunds_volume,
177
+ "chargebacks_transactions": self.chargebacks_transactions,
178
+ "chargebacks_volume": self.chargebacks_volume,
179
+ "fees": self.fees,
180
+ "adjustments": self.adjustments,
181
+ "reserve": self.reserve,
182
+ "settled_at": self.settled_at,
183
+ "created_at": self.created_at,
184
+ }.to_json
185
+ end
186
+
160
187
  # Fills the object with data coming from the API
161
188
  # Params:
162
189
  # +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
 
@@ -139,6 +140,25 @@ module ProcessOut
139
140
  PayoutItem.new(@client, data)
140
141
  end
141
142
 
143
+ # Overrides the JSON marshaller to only send the fields we want
144
+ def to_json(options)
145
+ {
146
+ "id": self.id,
147
+ "project": self.project,
148
+ "project_id": self.project_id,
149
+ "payout": self.payout,
150
+ "payout_id": self.payout_id,
151
+ "transaction": self.transaction,
152
+ "transaction_id": self.transaction_id,
153
+ "type": self.type,
154
+ "gateway_resource_id": self.gateway_resource_id,
155
+ "amount": self.amount,
156
+ "fees": self.fees,
157
+ "metadata": self.metadata,
158
+ "created_at": self.created_at,
159
+ }.to_json
160
+ end
161
+
142
162
  # Fills the object with data coming from the API
143
163
  # Params:
144
164
  # +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
 
@@ -121,6 +122,26 @@ module ProcessOut
121
122
  Plan.new(@client, data)
122
123
  end
123
124
 
125
+ # Overrides the JSON marshaller to only send the fields we want
126
+ def to_json(options)
127
+ {
128
+ "id": self.id,
129
+ "project": self.project,
130
+ "project_id": self.project_id,
131
+ "url": self.url,
132
+ "name": self.name,
133
+ "amount": self.amount,
134
+ "currency": self.currency,
135
+ "metadata": self.metadata,
136
+ "interval": self.interval,
137
+ "trial_period": self.trial_period,
138
+ "return_url": self.return_url,
139
+ "cancel_url": self.cancel_url,
140
+ "sandbox": self.sandbox,
141
+ "created_at": self.created_at,
142
+ }.to_json
143
+ end
144
+
124
145
  # Fills the object with data coming from the API
125
146
  # Params:
126
147
  # +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
 
@@ -109,6 +110,24 @@ module ProcessOut
109
110
  Product.new(@client, data)
110
111
  end
111
112
 
113
+ # Overrides the JSON marshaller to only send the fields we want
114
+ def to_json(options)
115
+ {
116
+ "id": self.id,
117
+ "project": self.project,
118
+ "project_id": self.project_id,
119
+ "url": self.url,
120
+ "name": self.name,
121
+ "amount": self.amount,
122
+ "currency": self.currency,
123
+ "metadata": self.metadata,
124
+ "return_url": self.return_url,
125
+ "cancel_url": self.cancel_url,
126
+ "sandbox": self.sandbox,
127
+ "created_at": self.created_at,
128
+ }.to_json
129
+ end
130
+
112
131
  # Fills the object with data coming from the API
113
132
  # Params:
114
133
  # +data+:: +Hash+ of data coming from the API