processout 2.20.0 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +52 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Dockerfile +7 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/Makefile +4 -0
  9. data/README.md +12 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/lib/processout/activity.rb +206 -0
  14. data/lib/processout/addon.rb +401 -0
  15. data/lib/processout/alternative_merchant_certificate.rb +115 -0
  16. data/lib/processout/api_request.rb +295 -0
  17. data/lib/processout/api_version.rb +92 -0
  18. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +121 -0
  19. data/lib/processout/balance.rb +92 -0
  20. data/lib/processout/balances.rb +111 -0
  21. data/lib/processout/card.rb +503 -0
  22. data/lib/processout/card_information.rb +164 -0
  23. data/lib/processout/coupon.rb +352 -0
  24. data/lib/processout/customer.rb +755 -0
  25. data/lib/processout/customer_action.rb +81 -0
  26. data/lib/processout/discount.rb +360 -0
  27. data/lib/processout/dunning_action.rb +81 -0
  28. data/lib/processout/errors/authentication_error.rb +9 -0
  29. data/lib/processout/errors/generic_error.rb +9 -0
  30. data/lib/processout/errors/internal_error.rb +9 -0
  31. data/lib/processout/errors/notfound_error.rb +9 -0
  32. data/lib/processout/errors/validation_error.rb +9 -0
  33. data/lib/processout/event.rb +237 -0
  34. data/lib/processout/gateway.rb +210 -0
  35. data/lib/processout/gateway_configuration.rb +346 -0
  36. data/lib/processout/gateway_request.rb +26 -0
  37. data/lib/processout/invoice.rb +984 -0
  38. data/lib/processout/invoice_detail.rb +235 -0
  39. data/lib/processout/invoice_device.rb +92 -0
  40. data/lib/processout/invoice_external_fraud_tools.rb +70 -0
  41. data/lib/processout/invoice_risk.rb +81 -0
  42. data/lib/processout/invoice_shipping.rb +202 -0
  43. data/lib/processout/invoice_tax.rb +81 -0
  44. data/lib/processout/networking/request.rb +102 -0
  45. data/lib/processout/networking/response.rb +67 -0
  46. data/lib/processout/payment_data_network_authentication.rb +70 -0
  47. data/lib/processout/payment_data_three_ds_authentication.rb +70 -0
  48. data/lib/processout/payment_data_three_ds_request.rb +103 -0
  49. data/lib/processout/payout.rb +379 -0
  50. data/lib/processout/payout_item.rb +238 -0
  51. data/lib/processout/plan.rb +368 -0
  52. data/lib/processout/product.rb +368 -0
  53. data/lib/processout/project.rb +353 -0
  54. data/lib/processout/refund.rb +277 -0
  55. data/lib/processout/subscription.rb +910 -0
  56. data/lib/processout/three_ds.rb +158 -0
  57. data/lib/processout/token.rb +493 -0
  58. data/lib/processout/transaction.rb +905 -0
  59. data/lib/processout/transaction_operation.rb +418 -0
  60. data/lib/processout/version.rb +3 -0
  61. data/lib/processout/webhook.rb +237 -0
  62. data/lib/processout/webhook_endpoint.rb +149 -0
  63. data/lib/processout.rb +263 -0
  64. data/processout.gemspec +26 -0
  65. metadata +66 -3
@@ -0,0 +1,237 @@
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 Event
10
+
11
+ attr_reader :id
12
+ attr_reader :project
13
+ attr_reader :project_id
14
+ attr_reader :name
15
+ attr_reader :data
16
+ attr_reader :sandbox
17
+ attr_reader :fired_at
18
+
19
+
20
+ def id=(val)
21
+ @id = val
22
+ end
23
+
24
+ def project=(val)
25
+ if val.nil?
26
+ @project = val
27
+ return
28
+ end
29
+
30
+ if val.instance_of? Project
31
+ @project = val
32
+ else
33
+ obj = Project.new(@client)
34
+ obj.fill_with_data(val)
35
+ @project = obj
36
+ end
37
+
38
+ end
39
+
40
+ def project_id=(val)
41
+ @project_id = val
42
+ end
43
+
44
+ def name=(val)
45
+ @name = val
46
+ end
47
+
48
+ def data=(val)
49
+ @data = val
50
+
51
+ end
52
+
53
+ def sandbox=(val)
54
+ @sandbox = val
55
+ end
56
+
57
+ def fired_at=(val)
58
+ @fired_at = val
59
+ end
60
+
61
+
62
+ # Initializes the Event object
63
+ # Params:
64
+ # +client+:: +ProcessOut+ client instance
65
+ # +data+:: data that can be used to fill the object
66
+ def initialize(client, data = {})
67
+ @client = client
68
+
69
+ self.id = data.fetch(:id, nil)
70
+ self.project = data.fetch(:project, nil)
71
+ self.project_id = data.fetch(:project_id, nil)
72
+ self.name = data.fetch(:name, nil)
73
+ self.data = data.fetch(:data, nil)
74
+ self.sandbox = data.fetch(:sandbox, nil)
75
+ self.fired_at = data.fetch(:fired_at, nil)
76
+
77
+ end
78
+
79
+ # Create a new Event using the current client
80
+ def new(data = {})
81
+ Event.new(@client, data)
82
+ end
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
+
97
+ # Fills the object with data coming from the API
98
+ # Params:
99
+ # +data+:: +Hash+ of data coming from the API
100
+ def fill_with_data(data)
101
+ if data.nil?
102
+ return self
103
+ end
104
+ if data.include? "id"
105
+ self.id = data["id"]
106
+ end
107
+ if data.include? "project"
108
+ self.project = data["project"]
109
+ end
110
+ if data.include? "project_id"
111
+ self.project_id = data["project_id"]
112
+ end
113
+ if data.include? "name"
114
+ self.name = data["name"]
115
+ end
116
+ if data.include? "data"
117
+ self.data = data["data"]
118
+ end
119
+ if data.include? "sandbox"
120
+ self.sandbox = data["sandbox"]
121
+ end
122
+ if data.include? "fired_at"
123
+ self.fired_at = data["fired_at"]
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Prefills the object with the data passed as parameters
130
+ # Params:
131
+ # +data+:: +Hash+ of data
132
+ def prefill(data)
133
+ if data.nil?
134
+ return self
135
+ end
136
+ self.id = data.fetch(:id, self.id)
137
+ self.project = data.fetch(:project, self.project)
138
+ self.project_id = data.fetch(:project_id, self.project_id)
139
+ self.name = data.fetch(:name, self.name)
140
+ self.data = data.fetch(:data, self.data)
141
+ self.sandbox = data.fetch(:sandbox, self.sandbox)
142
+ self.fired_at = data.fetch(:fired_at, self.fired_at)
143
+
144
+ self
145
+ end
146
+
147
+ # Get all the webhooks of the event.
148
+ # Params:
149
+ # +options+:: +Hash+ of options
150
+ def fetch_webhooks(options = {})
151
+ self.prefill(options)
152
+
153
+ request = Request.new(@client)
154
+ path = "/events/" + CGI.escape(@id) + "/webhooks"
155
+ data = {
156
+
157
+ }
158
+
159
+ response = Response.new(request.get(path, data, options))
160
+ return_values = Array.new
161
+
162
+ a = Array.new
163
+ body = response.body
164
+ for v in body['webhooks']
165
+ tmp = Webhook.new(@client)
166
+ tmp.fill_with_data(v)
167
+ a.push(tmp)
168
+ end
169
+
170
+ return_values.push(a)
171
+
172
+
173
+
174
+ return_values[0]
175
+ end
176
+
177
+ # Get all the events.
178
+ # Params:
179
+ # +options+:: +Hash+ of options
180
+ def all(options = {})
181
+ self.prefill(options)
182
+
183
+ request = Request.new(@client)
184
+ path = "/events"
185
+ data = {
186
+
187
+ }
188
+
189
+ response = Response.new(request.get(path, data, options))
190
+ return_values = Array.new
191
+
192
+ a = Array.new
193
+ body = response.body
194
+ for v in body['events']
195
+ tmp = Event.new(@client)
196
+ tmp.fill_with_data(v)
197
+ a.push(tmp)
198
+ end
199
+
200
+ return_values.push(a)
201
+
202
+
203
+
204
+ return_values[0]
205
+ end
206
+
207
+ # Find an event by its ID.
208
+ # Params:
209
+ # +event_id+:: ID of the event
210
+ # +options+:: +Hash+ of options
211
+ def find(event_id, options = {})
212
+ self.prefill(options)
213
+
214
+ request = Request.new(@client)
215
+ path = "/events/" + CGI.escape(event_id) + ""
216
+ data = {
217
+
218
+ }
219
+
220
+ response = Response.new(request.get(path, data, options))
221
+ return_values = Array.new
222
+
223
+ body = response.body
224
+ body = body["event"]
225
+
226
+
227
+ obj = Event.new(@client)
228
+ return_values.push(obj.fill_with_data(body))
229
+
230
+
231
+
232
+ return_values[0]
233
+ end
234
+
235
+
236
+ end
237
+ end
@@ -0,0 +1,210 @@
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 Gateway
10
+
11
+ attr_reader :id
12
+ attr_reader :name
13
+ attr_reader :display_name
14
+ attr_reader :logo_url
15
+ attr_reader :url
16
+ attr_reader :flows
17
+ attr_reader :tags
18
+ attr_reader :can_pull_transactions
19
+ attr_reader :can_refund
20
+ attr_reader :is_oauth_authentication
21
+ attr_reader :description
22
+
23
+
24
+ def id=(val)
25
+ @id = val
26
+ end
27
+
28
+ def name=(val)
29
+ @name = val
30
+ end
31
+
32
+ def display_name=(val)
33
+ @display_name = val
34
+ end
35
+
36
+ def logo_url=(val)
37
+ @logo_url = val
38
+ end
39
+
40
+ def url=(val)
41
+ @url = val
42
+ end
43
+
44
+ def flows=(val)
45
+ @flows = val
46
+ end
47
+
48
+ def tags=(val)
49
+ @tags = val
50
+ end
51
+
52
+ def can_pull_transactions=(val)
53
+ @can_pull_transactions = val
54
+ end
55
+
56
+ def can_refund=(val)
57
+ @can_refund = val
58
+ end
59
+
60
+ def is_oauth_authentication=(val)
61
+ @is_oauth_authentication = val
62
+ end
63
+
64
+ def description=(val)
65
+ @description = val
66
+ end
67
+
68
+
69
+ # Initializes the Gateway object
70
+ # Params:
71
+ # +client+:: +ProcessOut+ client instance
72
+ # +data+:: data that can be used to fill the object
73
+ def initialize(client, data = {})
74
+ @client = client
75
+
76
+ self.id = data.fetch(:id, nil)
77
+ self.name = data.fetch(:name, nil)
78
+ self.display_name = data.fetch(:display_name, nil)
79
+ self.logo_url = data.fetch(:logo_url, nil)
80
+ self.url = data.fetch(:url, nil)
81
+ self.flows = data.fetch(:flows, nil)
82
+ self.tags = data.fetch(:tags, nil)
83
+ self.can_pull_transactions = data.fetch(:can_pull_transactions, nil)
84
+ self.can_refund = data.fetch(:can_refund, nil)
85
+ self.is_oauth_authentication = data.fetch(:is_oauth_authentication, nil)
86
+ self.description = data.fetch(:description, nil)
87
+
88
+ end
89
+
90
+ # Create a new Gateway using the current client
91
+ def new(data = {})
92
+ Gateway.new(@client, data)
93
+ end
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
+
112
+ # Fills the object with data coming from the API
113
+ # Params:
114
+ # +data+:: +Hash+ of data coming from the API
115
+ def fill_with_data(data)
116
+ if data.nil?
117
+ return self
118
+ end
119
+ if data.include? "id"
120
+ self.id = data["id"]
121
+ end
122
+ if data.include? "name"
123
+ self.name = data["name"]
124
+ end
125
+ if data.include? "display_name"
126
+ self.display_name = data["display_name"]
127
+ end
128
+ if data.include? "logo_url"
129
+ self.logo_url = data["logo_url"]
130
+ end
131
+ if data.include? "url"
132
+ self.url = data["url"]
133
+ end
134
+ if data.include? "flows"
135
+ self.flows = data["flows"]
136
+ end
137
+ if data.include? "tags"
138
+ self.tags = data["tags"]
139
+ end
140
+ if data.include? "can_pull_transactions"
141
+ self.can_pull_transactions = data["can_pull_transactions"]
142
+ end
143
+ if data.include? "can_refund"
144
+ self.can_refund = data["can_refund"]
145
+ end
146
+ if data.include? "is_oauth_authentication"
147
+ self.is_oauth_authentication = data["is_oauth_authentication"]
148
+ end
149
+ if data.include? "description"
150
+ self.description = data["description"]
151
+ end
152
+
153
+ self
154
+ end
155
+
156
+ # Prefills the object with the data passed as parameters
157
+ # Params:
158
+ # +data+:: +Hash+ of data
159
+ def prefill(data)
160
+ if data.nil?
161
+ return self
162
+ end
163
+ self.id = data.fetch(:id, self.id)
164
+ self.name = data.fetch(:name, self.name)
165
+ self.display_name = data.fetch(:display_name, self.display_name)
166
+ self.logo_url = data.fetch(:logo_url, self.logo_url)
167
+ self.url = data.fetch(:url, self.url)
168
+ self.flows = data.fetch(:flows, self.flows)
169
+ self.tags = data.fetch(:tags, self.tags)
170
+ self.can_pull_transactions = data.fetch(:can_pull_transactions, self.can_pull_transactions)
171
+ self.can_refund = data.fetch(:can_refund, self.can_refund)
172
+ self.is_oauth_authentication = data.fetch(:is_oauth_authentication, self.is_oauth_authentication)
173
+ self.description = data.fetch(:description, self.description)
174
+
175
+ self
176
+ end
177
+
178
+ # Get all the gateway configurations of the gateway
179
+ # Params:
180
+ # +options+:: +Hash+ of options
181
+ def fetch_gateway_configurations(options = {})
182
+ self.prefill(options)
183
+
184
+ request = Request.new(@client)
185
+ path = "/gateways/" + CGI.escape(@name) + "/gateway-configurations"
186
+ data = {
187
+
188
+ }
189
+
190
+ response = Response.new(request.get(path, data, options))
191
+ return_values = Array.new
192
+
193
+ a = Array.new
194
+ body = response.body
195
+ for v in body['gateway_configurations']
196
+ tmp = GatewayConfiguration.new(@client)
197
+ tmp.fill_with_data(v)
198
+ a.push(tmp)
199
+ end
200
+
201
+ return_values.push(a)
202
+
203
+
204
+
205
+ return_values[0]
206
+ end
207
+
208
+
209
+ end
210
+ end