processout 2.17.0 → 2.20.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. metadata +4 -65
  3. data/.gitignore +0 -52
  4. data/.rspec +0 -2
  5. data/.travis.yml +0 -5
  6. data/Dockerfile +0 -7
  7. data/Gemfile +0 -4
  8. data/LICENSE.txt +0 -21
  9. data/Makefile +0 -4
  10. data/README.md +0 -12
  11. data/Rakefile +0 -6
  12. data/bin/console +0 -14
  13. data/bin/setup +0 -8
  14. data/lib/processout/activity.rb +0 -206
  15. data/lib/processout/addon.rb +0 -401
  16. data/lib/processout/api_request.rb +0 -295
  17. data/lib/processout/api_version.rb +0 -92
  18. data/lib/processout/balance.rb +0 -81
  19. data/lib/processout/balances.rb +0 -111
  20. data/lib/processout/card.rb +0 -503
  21. data/lib/processout/card_information.rb +0 -164
  22. data/lib/processout/coupon.rb +0 -352
  23. data/lib/processout/customer.rb +0 -755
  24. data/lib/processout/customer_action.rb +0 -81
  25. data/lib/processout/discount.rb +0 -360
  26. data/lib/processout/dunning_action.rb +0 -81
  27. data/lib/processout/errors/authentication_error.rb +0 -9
  28. data/lib/processout/errors/generic_error.rb +0 -9
  29. data/lib/processout/errors/internal_error.rb +0 -9
  30. data/lib/processout/errors/notfound_error.rb +0 -9
  31. data/lib/processout/errors/validation_error.rb +0 -9
  32. data/lib/processout/event.rb +0 -237
  33. data/lib/processout/gateway.rb +0 -210
  34. data/lib/processout/gateway_configuration.rb +0 -346
  35. data/lib/processout/gateway_request.rb +0 -26
  36. data/lib/processout/invoice.rb +0 -945
  37. data/lib/processout/invoice_detail.rb +0 -224
  38. data/lib/processout/invoice_device.rb +0 -92
  39. data/lib/processout/invoice_external_fraud_tools.rb +0 -70
  40. data/lib/processout/invoice_risk.rb +0 -81
  41. data/lib/processout/invoice_shipping.rb +0 -191
  42. data/lib/processout/invoice_tax.rb +0 -81
  43. data/lib/processout/networking/request.rb +0 -102
  44. data/lib/processout/networking/response.rb +0 -67
  45. data/lib/processout/payment_data_network_authentication.rb +0 -70
  46. data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
  47. data/lib/processout/payment_data_three_ds_request.rb +0 -103
  48. data/lib/processout/payout.rb +0 -379
  49. data/lib/processout/payout_item.rb +0 -238
  50. data/lib/processout/plan.rb +0 -368
  51. data/lib/processout/product.rb +0 -368
  52. data/lib/processout/project.rb +0 -353
  53. data/lib/processout/refund.rb +0 -265
  54. data/lib/processout/subscription.rb +0 -910
  55. data/lib/processout/three_ds.rb +0 -158
  56. data/lib/processout/token.rb +0 -482
  57. data/lib/processout/transaction.rb +0 -894
  58. data/lib/processout/transaction_operation.rb +0 -418
  59. data/lib/processout/version.rb +0 -3
  60. data/lib/processout/webhook.rb +0 -237
  61. data/lib/processout/webhook_endpoint.rb +0 -149
  62. data/lib/processout.rb +0 -251
  63. data/processout.gemspec +0 -26
@@ -1,265 +0,0 @@
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 Refund
10
-
11
- attr_reader :id
12
- attr_reader :transaction
13
- attr_reader :transaction_id
14
- attr_reader :amount
15
- attr_reader :reason
16
- attr_reader :information
17
- attr_reader :has_failed
18
- attr_reader :metadata
19
- attr_reader :sandbox
20
- attr_reader :created_at
21
-
22
-
23
- def id=(val)
24
- @id = val
25
- end
26
-
27
- def transaction=(val)
28
- if val.nil?
29
- @transaction = val
30
- return
31
- end
32
-
33
- if val.instance_of? Transaction
34
- @transaction = val
35
- else
36
- obj = Transaction.new(@client)
37
- obj.fill_with_data(val)
38
- @transaction = obj
39
- end
40
-
41
- end
42
-
43
- def transaction_id=(val)
44
- @transaction_id = val
45
- end
46
-
47
- def amount=(val)
48
- @amount = val
49
- end
50
-
51
- def reason=(val)
52
- @reason = val
53
- end
54
-
55
- def information=(val)
56
- @information = val
57
- end
58
-
59
- def has_failed=(val)
60
- @has_failed = val
61
- end
62
-
63
- def metadata=(val)
64
- @metadata = val
65
- end
66
-
67
- def sandbox=(val)
68
- @sandbox = val
69
- end
70
-
71
- def created_at=(val)
72
- @created_at = val
73
- end
74
-
75
-
76
- # Initializes the Refund object
77
- # Params:
78
- # +client+:: +ProcessOut+ client instance
79
- # +data+:: data that can be used to fill the object
80
- def initialize(client, data = {})
81
- @client = client
82
-
83
- self.id = data.fetch(:id, nil)
84
- self.transaction = data.fetch(:transaction, nil)
85
- self.transaction_id = data.fetch(:transaction_id, nil)
86
- self.amount = data.fetch(:amount, nil)
87
- self.reason = data.fetch(:reason, nil)
88
- self.information = data.fetch(:information, nil)
89
- self.has_failed = data.fetch(:has_failed, nil)
90
- self.metadata = data.fetch(:metadata, nil)
91
- self.sandbox = data.fetch(:sandbox, nil)
92
- self.created_at = data.fetch(:created_at, nil)
93
-
94
- end
95
-
96
- # Create a new Refund using the current client
97
- def new(data = {})
98
- Refund.new(@client, data)
99
- end
100
-
101
- # Overrides the JSON marshaller to only send the fields we want
102
- def to_json(options)
103
- {
104
- "id": self.id,
105
- "transaction": self.transaction,
106
- "transaction_id": self.transaction_id,
107
- "amount": self.amount,
108
- "reason": self.reason,
109
- "information": self.information,
110
- "has_failed": self.has_failed,
111
- "metadata": self.metadata,
112
- "sandbox": self.sandbox,
113
- "created_at": self.created_at,
114
- }.to_json
115
- end
116
-
117
- # Fills the object with data coming from the API
118
- # Params:
119
- # +data+:: +Hash+ of data coming from the API
120
- def fill_with_data(data)
121
- if data.nil?
122
- return self
123
- end
124
- if data.include? "id"
125
- self.id = data["id"]
126
- end
127
- if data.include? "transaction"
128
- self.transaction = data["transaction"]
129
- end
130
- if data.include? "transaction_id"
131
- self.transaction_id = data["transaction_id"]
132
- end
133
- if data.include? "amount"
134
- self.amount = data["amount"]
135
- end
136
- if data.include? "reason"
137
- self.reason = data["reason"]
138
- end
139
- if data.include? "information"
140
- self.information = data["information"]
141
- end
142
- if data.include? "has_failed"
143
- self.has_failed = data["has_failed"]
144
- end
145
- if data.include? "metadata"
146
- self.metadata = data["metadata"]
147
- end
148
- if data.include? "sandbox"
149
- self.sandbox = data["sandbox"]
150
- end
151
- if data.include? "created_at"
152
- self.created_at = data["created_at"]
153
- end
154
-
155
- self
156
- end
157
-
158
- # Prefills the object with the data passed as parameters
159
- # Params:
160
- # +data+:: +Hash+ of data
161
- def prefill(data)
162
- if data.nil?
163
- return self
164
- end
165
- self.id = data.fetch(:id, self.id)
166
- self.transaction = data.fetch(:transaction, self.transaction)
167
- self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
168
- self.amount = data.fetch(:amount, self.amount)
169
- self.reason = data.fetch(:reason, self.reason)
170
- self.information = data.fetch(:information, self.information)
171
- self.has_failed = data.fetch(:has_failed, self.has_failed)
172
- self.metadata = data.fetch(:metadata, self.metadata)
173
- self.sandbox = data.fetch(:sandbox, self.sandbox)
174
- self.created_at = data.fetch(:created_at, self.created_at)
175
-
176
- self
177
- end
178
-
179
- # Get the transaction's refunds.
180
- # Params:
181
- # +transaction_id+:: ID of the transaction
182
- # +options+:: +Hash+ of options
183
- def fetch_transaction_refunds(transaction_id, options = {})
184
- self.prefill(options)
185
-
186
- request = Request.new(@client)
187
- path = "/transactions/" + CGI.escape(transaction_id) + "/refunds"
188
- data = {
189
-
190
- }
191
-
192
- response = Response.new(request.get(path, data, options))
193
- return_values = Array.new
194
-
195
- a = Array.new
196
- body = response.body
197
- for v in body['refunds']
198
- tmp = Refund.new(@client)
199
- tmp.fill_with_data(v)
200
- a.push(tmp)
201
- end
202
-
203
- return_values.push(a)
204
-
205
-
206
-
207
- return_values[0]
208
- end
209
-
210
- # Find a transaction's refund by its ID.
211
- # Params:
212
- # +transaction_id+:: ID of the transaction on which the refund was applied
213
- # +refund_id+:: ID of the refund
214
- # +options+:: +Hash+ of options
215
- def find(transaction_id, refund_id, options = {})
216
- self.prefill(options)
217
-
218
- request = Request.new(@client)
219
- path = "/transactions/" + CGI.escape(transaction_id) + "/refunds/" + CGI.escape(refund_id) + ""
220
- data = {
221
-
222
- }
223
-
224
- response = Response.new(request.get(path, data, options))
225
- return_values = Array.new
226
-
227
- body = response.body
228
- body = body["refund"]
229
-
230
-
231
- obj = Refund.new(@client)
232
- return_values.push(obj.fill_with_data(body))
233
-
234
-
235
-
236
- return_values[0]
237
- end
238
-
239
- # Create a refund for a transaction.
240
- # Params:
241
- # +options+:: +Hash+ of options
242
- def create(options = {})
243
- self.prefill(options)
244
-
245
- request = Request.new(@client)
246
- path = "/transactions/" + CGI.escape(@transaction_id) + "/refunds"
247
- data = {
248
- "amount" => @amount,
249
- "metadata" => @metadata,
250
- "reason" => @reason,
251
- "information" => @information
252
- }
253
-
254
- response = Response.new(request.post(path, data, options))
255
- return_values = Array.new
256
-
257
- return_values.push(response.success)
258
-
259
-
260
- return_values[0]
261
- end
262
-
263
-
264
- end
265
- end