processout 2.13.0 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  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 +79 -0
  7. data/lib/processout/card_information.rb +14 -0
  8. data/lib/processout/coupon.rb +20 -0
  9. data/lib/processout/customer.rb +62 -24
  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 -31
  14. data/lib/processout/gateway.rb +18 -0
  15. data/lib/processout/gateway_configuration.rb +18 -0
  16. data/lib/processout/invoice.rb +166 -2
  17. data/lib/processout/invoice_detail.rb +22 -0
  18. data/lib/processout/invoice_device.rb +20 -0
  19. data/lib/processout/invoice_external_fraud_tools.rb +70 -0
  20. data/lib/processout/invoice_risk.rb +9 -0
  21. data/lib/processout/invoice_shipping.rb +19 -0
  22. data/lib/processout/invoice_tax.rb +81 -0
  23. data/lib/processout/networking/request.rb +1 -1
  24. data/lib/processout/payment_data_network_authentication.rb +8 -0
  25. data/lib/processout/payment_data_three_ds_authentication.rb +8 -0
  26. data/lib/processout/payment_data_three_ds_request.rb +11 -0
  27. data/lib/processout/payout.rb +27 -0
  28. data/lib/processout/payout_item.rb +20 -0
  29. data/lib/processout/plan.rb +21 -0
  30. data/lib/processout/product.rb +19 -0
  31. data/lib/processout/project.rb +18 -27
  32. data/lib/processout/refund.rb +17 -0
  33. data/lib/processout/subscription.rb +42 -0
  34. data/lib/processout/three_ds.rb +158 -0
  35. data/lib/processout/token.rb +93 -30
  36. data/lib/processout/transaction.rb +113 -0
  37. data/lib/processout/transaction_operation.rb +52 -0
  38. data/lib/processout/version.rb +1 -1
  39. data/lib/processout/webhook.rb +21 -0
  40. data/lib/processout/webhook_endpoint.rb +14 -0
  41. data/lib/processout.rb +18 -0
  42. 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
 
@@ -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
 
@@ -9,6 +10,7 @@ module ProcessOut
9
10
 
10
11
  attr_reader :channel
11
12
  attr_reader :ip_address
13
+ attr_reader :id
12
14
 
13
15
 
14
16
  def channel=(val)
@@ -19,6 +21,10 @@ module ProcessOut
19
21
  @ip_address = val
20
22
  end
21
23
 
24
+ def id=(val)
25
+ @id = val
26
+ end
27
+
22
28
 
23
29
  # Initializes the InvoiceDevice object
24
30
  # Params:
@@ -29,6 +35,7 @@ module ProcessOut
29
35
 
30
36
  self.channel = data.fetch(:channel, nil)
31
37
  self.ip_address = data.fetch(:ip_address, nil)
38
+ self.id = data.fetch(:id, nil)
32
39
 
33
40
  end
34
41
 
@@ -37,6 +44,15 @@ module ProcessOut
37
44
  InvoiceDevice.new(@client, data)
38
45
  end
39
46
 
47
+ # Overrides the JSON marshaller to only send the fields we want
48
+ def to_json(options)
49
+ {
50
+ "channel": self.channel,
51
+ "ip_address": self.ip_address,
52
+ "id": self.id,
53
+ }.to_json
54
+ end
55
+
40
56
  # Fills the object with data coming from the API
41
57
  # Params:
42
58
  # +data+:: +Hash+ of data coming from the API
@@ -50,6 +66,9 @@ module ProcessOut
50
66
  if data.include? "ip_address"
51
67
  self.ip_address = data["ip_address"]
52
68
  end
69
+ if data.include? "id"
70
+ self.id = data["id"]
71
+ end
53
72
 
54
73
  self
55
74
  end
@@ -63,6 +82,7 @@ module ProcessOut
63
82
  end
64
83
  self.channel = data.fetch(:channel, self.channel)
65
84
  self.ip_address = data.fetch(:ip_address, self.ip_address)
85
+ self.id = data.fetch(:id, self.id)
66
86
 
67
87
  self
68
88
  end
@@ -0,0 +1,70 @@
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 InvoiceExternalFraudTools
10
+
11
+ attr_reader :forter
12
+
13
+
14
+ def forter=(val)
15
+ @forter = val
16
+ end
17
+
18
+
19
+ # Initializes the InvoiceExternalFraudTools object
20
+ # Params:
21
+ # +client+:: +ProcessOut+ client instance
22
+ # +data+:: data that can be used to fill the object
23
+ def initialize(client, data = {})
24
+ @client = client
25
+
26
+ self.forter = data.fetch(:forter, nil)
27
+
28
+ end
29
+
30
+ # Create a new InvoiceExternalFraudTools using the current client
31
+ def new(data = {})
32
+ InvoiceExternalFraudTools.new(@client, data)
33
+ end
34
+
35
+ # Overrides the JSON marshaller to only send the fields we want
36
+ def to_json(options)
37
+ {
38
+ "forter": self.forter,
39
+ }.to_json
40
+ end
41
+
42
+ # Fills the object with data coming from the API
43
+ # Params:
44
+ # +data+:: +Hash+ of data coming from the API
45
+ def fill_with_data(data)
46
+ if data.nil?
47
+ return self
48
+ end
49
+ if data.include? "forter"
50
+ self.forter = data["forter"]
51
+ end
52
+
53
+ self
54
+ end
55
+
56
+ # Prefills the object with the data passed as parameters
57
+ # Params:
58
+ # +data+:: +Hash+ of data
59
+ def prefill(data)
60
+ if data.nil?
61
+ return self
62
+ end
63
+ self.forter = data.fetch(:forter, self.forter)
64
+
65
+ self
66
+ end
67
+
68
+
69
+ end
70
+ end
@@ -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
@@ -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 InvoiceTax
10
+
11
+ attr_reader :amount
12
+ attr_reader :rate
13
+
14
+
15
+ def amount=(val)
16
+ @amount = val
17
+ end
18
+
19
+ def rate=(val)
20
+ @rate = val
21
+ end
22
+
23
+
24
+ # Initializes the InvoiceTax 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.rate = data.fetch(:rate, nil)
33
+
34
+ end
35
+
36
+ # Create a new InvoiceTax using the current client
37
+ def new(data = {})
38
+ InvoiceTax.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
+ "rate": self.rate,
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? "rate"
60
+ self.rate = data["rate"]
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.rate = data.fetch(:rate, self.rate)
75
+
76
+ self
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -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.15.1"
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