processout 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -67
- data/.gitignore +0 -52
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Dockerfile +0 -7
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/Makefile +0 -4
- data/README.md +0 -12
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/processout/activity.rb +0 -206
- data/lib/processout/addon.rb +0 -401
- data/lib/processout/alternative_merchant_certificate.rb +0 -94
- data/lib/processout/api_request.rb +0 -295
- data/lib/processout/api_version.rb +0 -92
- data/lib/processout/apple_pay_alternative_merchant_certificates.rb +0 -110
- data/lib/processout/balance.rb +0 -81
- data/lib/processout/balances.rb +0 -111
- data/lib/processout/card.rb +0 -503
- data/lib/processout/card_information.rb +0 -164
- data/lib/processout/coupon.rb +0 -352
- data/lib/processout/customer.rb +0 -755
- data/lib/processout/customer_action.rb +0 -81
- data/lib/processout/discount.rb +0 -360
- data/lib/processout/dunning_action.rb +0 -81
- data/lib/processout/errors/authentication_error.rb +0 -9
- data/lib/processout/errors/generic_error.rb +0 -9
- data/lib/processout/errors/internal_error.rb +0 -9
- data/lib/processout/errors/notfound_error.rb +0 -9
- data/lib/processout/errors/validation_error.rb +0 -9
- data/lib/processout/event.rb +0 -237
- data/lib/processout/gateway.rb +0 -210
- data/lib/processout/gateway_configuration.rb +0 -346
- data/lib/processout/gateway_request.rb +0 -26
- data/lib/processout/invoice.rb +0 -945
- data/lib/processout/invoice_detail.rb +0 -235
- data/lib/processout/invoice_device.rb +0 -92
- data/lib/processout/invoice_external_fraud_tools.rb +0 -70
- data/lib/processout/invoice_risk.rb +0 -81
- data/lib/processout/invoice_shipping.rb +0 -191
- data/lib/processout/invoice_tax.rb +0 -81
- data/lib/processout/networking/request.rb +0 -102
- data/lib/processout/networking/response.rb +0 -67
- data/lib/processout/payment_data_network_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_request.rb +0 -103
- data/lib/processout/payout.rb +0 -379
- data/lib/processout/payout_item.rb +0 -238
- data/lib/processout/plan.rb +0 -368
- data/lib/processout/product.rb +0 -368
- data/lib/processout/project.rb +0 -353
- data/lib/processout/refund.rb +0 -277
- data/lib/processout/subscription.rb +0 -910
- data/lib/processout/three_ds.rb +0 -158
- data/lib/processout/token.rb +0 -493
- data/lib/processout/transaction.rb +0 -905
- data/lib/processout/transaction_operation.rb +0 -418
- data/lib/processout/version.rb +0 -3
- data/lib/processout/webhook.rb +0 -237
- data/lib/processout/webhook_endpoint.rb +0 -149
- data/lib/processout.rb +0 -263
- data/processout.gemspec +0 -26
data/lib/processout/payout.rb
DELETED
@@ -1,379 +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 Payout
|
10
|
-
|
11
|
-
attr_reader :id
|
12
|
-
attr_reader :project
|
13
|
-
attr_reader :project_id
|
14
|
-
attr_reader :status
|
15
|
-
attr_reader :amount
|
16
|
-
attr_reader :currency
|
17
|
-
attr_reader :metadata
|
18
|
-
attr_reader :bank_name
|
19
|
-
attr_reader :bank_summary
|
20
|
-
attr_reader :sales_transactions
|
21
|
-
attr_reader :sales_volume
|
22
|
-
attr_reader :refunds_transactions
|
23
|
-
attr_reader :refunds_volume
|
24
|
-
attr_reader :chargebacks_transactions
|
25
|
-
attr_reader :chargebacks_volume
|
26
|
-
attr_reader :fees
|
27
|
-
attr_reader :adjustments
|
28
|
-
attr_reader :reserve
|
29
|
-
attr_reader :settled_at
|
30
|
-
attr_reader :created_at
|
31
|
-
|
32
|
-
|
33
|
-
def id=(val)
|
34
|
-
@id = val
|
35
|
-
end
|
36
|
-
|
37
|
-
def project=(val)
|
38
|
-
if val.nil?
|
39
|
-
@project = val
|
40
|
-
return
|
41
|
-
end
|
42
|
-
|
43
|
-
if val.instance_of? Project
|
44
|
-
@project = val
|
45
|
-
else
|
46
|
-
obj = Project.new(@client)
|
47
|
-
obj.fill_with_data(val)
|
48
|
-
@project = obj
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def project_id=(val)
|
54
|
-
@project_id = val
|
55
|
-
end
|
56
|
-
|
57
|
-
def status=(val)
|
58
|
-
@status = val
|
59
|
-
end
|
60
|
-
|
61
|
-
def amount=(val)
|
62
|
-
@amount = val
|
63
|
-
end
|
64
|
-
|
65
|
-
def currency=(val)
|
66
|
-
@currency = val
|
67
|
-
end
|
68
|
-
|
69
|
-
def metadata=(val)
|
70
|
-
@metadata = val
|
71
|
-
end
|
72
|
-
|
73
|
-
def bank_name=(val)
|
74
|
-
@bank_name = val
|
75
|
-
end
|
76
|
-
|
77
|
-
def bank_summary=(val)
|
78
|
-
@bank_summary = val
|
79
|
-
end
|
80
|
-
|
81
|
-
def sales_transactions=(val)
|
82
|
-
@sales_transactions = val
|
83
|
-
end
|
84
|
-
|
85
|
-
def sales_volume=(val)
|
86
|
-
@sales_volume = val
|
87
|
-
end
|
88
|
-
|
89
|
-
def refunds_transactions=(val)
|
90
|
-
@refunds_transactions = val
|
91
|
-
end
|
92
|
-
|
93
|
-
def refunds_volume=(val)
|
94
|
-
@refunds_volume = val
|
95
|
-
end
|
96
|
-
|
97
|
-
def chargebacks_transactions=(val)
|
98
|
-
@chargebacks_transactions = val
|
99
|
-
end
|
100
|
-
|
101
|
-
def chargebacks_volume=(val)
|
102
|
-
@chargebacks_volume = val
|
103
|
-
end
|
104
|
-
|
105
|
-
def fees=(val)
|
106
|
-
@fees = val
|
107
|
-
end
|
108
|
-
|
109
|
-
def adjustments=(val)
|
110
|
-
@adjustments = val
|
111
|
-
end
|
112
|
-
|
113
|
-
def reserve=(val)
|
114
|
-
@reserve = val
|
115
|
-
end
|
116
|
-
|
117
|
-
def settled_at=(val)
|
118
|
-
@settled_at = val
|
119
|
-
end
|
120
|
-
|
121
|
-
def created_at=(val)
|
122
|
-
@created_at = val
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
# Initializes the Payout object
|
127
|
-
# Params:
|
128
|
-
# +client+:: +ProcessOut+ client instance
|
129
|
-
# +data+:: data that can be used to fill the object
|
130
|
-
def initialize(client, data = {})
|
131
|
-
@client = client
|
132
|
-
|
133
|
-
self.id = data.fetch(:id, nil)
|
134
|
-
self.project = data.fetch(:project, nil)
|
135
|
-
self.project_id = data.fetch(:project_id, nil)
|
136
|
-
self.status = data.fetch(:status, nil)
|
137
|
-
self.amount = data.fetch(:amount, nil)
|
138
|
-
self.currency = data.fetch(:currency, nil)
|
139
|
-
self.metadata = data.fetch(:metadata, nil)
|
140
|
-
self.bank_name = data.fetch(:bank_name, nil)
|
141
|
-
self.bank_summary = data.fetch(:bank_summary, nil)
|
142
|
-
self.sales_transactions = data.fetch(:sales_transactions, nil)
|
143
|
-
self.sales_volume = data.fetch(:sales_volume, nil)
|
144
|
-
self.refunds_transactions = data.fetch(:refunds_transactions, nil)
|
145
|
-
self.refunds_volume = data.fetch(:refunds_volume, nil)
|
146
|
-
self.chargebacks_transactions = data.fetch(:chargebacks_transactions, nil)
|
147
|
-
self.chargebacks_volume = data.fetch(:chargebacks_volume, nil)
|
148
|
-
self.fees = data.fetch(:fees, nil)
|
149
|
-
self.adjustments = data.fetch(:adjustments, nil)
|
150
|
-
self.reserve = data.fetch(:reserve, nil)
|
151
|
-
self.settled_at = data.fetch(:settled_at, nil)
|
152
|
-
self.created_at = data.fetch(:created_at, nil)
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
# Create a new Payout using the current client
|
157
|
-
def new(data = {})
|
158
|
-
Payout.new(@client, data)
|
159
|
-
end
|
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
|
-
|
187
|
-
# Fills the object with data coming from the API
|
188
|
-
# Params:
|
189
|
-
# +data+:: +Hash+ of data coming from the API
|
190
|
-
def fill_with_data(data)
|
191
|
-
if data.nil?
|
192
|
-
return self
|
193
|
-
end
|
194
|
-
if data.include? "id"
|
195
|
-
self.id = data["id"]
|
196
|
-
end
|
197
|
-
if data.include? "project"
|
198
|
-
self.project = data["project"]
|
199
|
-
end
|
200
|
-
if data.include? "project_id"
|
201
|
-
self.project_id = data["project_id"]
|
202
|
-
end
|
203
|
-
if data.include? "status"
|
204
|
-
self.status = data["status"]
|
205
|
-
end
|
206
|
-
if data.include? "amount"
|
207
|
-
self.amount = data["amount"]
|
208
|
-
end
|
209
|
-
if data.include? "currency"
|
210
|
-
self.currency = data["currency"]
|
211
|
-
end
|
212
|
-
if data.include? "metadata"
|
213
|
-
self.metadata = data["metadata"]
|
214
|
-
end
|
215
|
-
if data.include? "bank_name"
|
216
|
-
self.bank_name = data["bank_name"]
|
217
|
-
end
|
218
|
-
if data.include? "bank_summary"
|
219
|
-
self.bank_summary = data["bank_summary"]
|
220
|
-
end
|
221
|
-
if data.include? "sales_transactions"
|
222
|
-
self.sales_transactions = data["sales_transactions"]
|
223
|
-
end
|
224
|
-
if data.include? "sales_volume"
|
225
|
-
self.sales_volume = data["sales_volume"]
|
226
|
-
end
|
227
|
-
if data.include? "refunds_transactions"
|
228
|
-
self.refunds_transactions = data["refunds_transactions"]
|
229
|
-
end
|
230
|
-
if data.include? "refunds_volume"
|
231
|
-
self.refunds_volume = data["refunds_volume"]
|
232
|
-
end
|
233
|
-
if data.include? "chargebacks_transactions"
|
234
|
-
self.chargebacks_transactions = data["chargebacks_transactions"]
|
235
|
-
end
|
236
|
-
if data.include? "chargebacks_volume"
|
237
|
-
self.chargebacks_volume = data["chargebacks_volume"]
|
238
|
-
end
|
239
|
-
if data.include? "fees"
|
240
|
-
self.fees = data["fees"]
|
241
|
-
end
|
242
|
-
if data.include? "adjustments"
|
243
|
-
self.adjustments = data["adjustments"]
|
244
|
-
end
|
245
|
-
if data.include? "reserve"
|
246
|
-
self.reserve = data["reserve"]
|
247
|
-
end
|
248
|
-
if data.include? "settled_at"
|
249
|
-
self.settled_at = data["settled_at"]
|
250
|
-
end
|
251
|
-
if data.include? "created_at"
|
252
|
-
self.created_at = data["created_at"]
|
253
|
-
end
|
254
|
-
|
255
|
-
self
|
256
|
-
end
|
257
|
-
|
258
|
-
# Prefills the object with the data passed as parameters
|
259
|
-
# Params:
|
260
|
-
# +data+:: +Hash+ of data
|
261
|
-
def prefill(data)
|
262
|
-
if data.nil?
|
263
|
-
return self
|
264
|
-
end
|
265
|
-
self.id = data.fetch(:id, self.id)
|
266
|
-
self.project = data.fetch(:project, self.project)
|
267
|
-
self.project_id = data.fetch(:project_id, self.project_id)
|
268
|
-
self.status = data.fetch(:status, self.status)
|
269
|
-
self.amount = data.fetch(:amount, self.amount)
|
270
|
-
self.currency = data.fetch(:currency, self.currency)
|
271
|
-
self.metadata = data.fetch(:metadata, self.metadata)
|
272
|
-
self.bank_name = data.fetch(:bank_name, self.bank_name)
|
273
|
-
self.bank_summary = data.fetch(:bank_summary, self.bank_summary)
|
274
|
-
self.sales_transactions = data.fetch(:sales_transactions, self.sales_transactions)
|
275
|
-
self.sales_volume = data.fetch(:sales_volume, self.sales_volume)
|
276
|
-
self.refunds_transactions = data.fetch(:refunds_transactions, self.refunds_transactions)
|
277
|
-
self.refunds_volume = data.fetch(:refunds_volume, self.refunds_volume)
|
278
|
-
self.chargebacks_transactions = data.fetch(:chargebacks_transactions, self.chargebacks_transactions)
|
279
|
-
self.chargebacks_volume = data.fetch(:chargebacks_volume, self.chargebacks_volume)
|
280
|
-
self.fees = data.fetch(:fees, self.fees)
|
281
|
-
self.adjustments = data.fetch(:adjustments, self.adjustments)
|
282
|
-
self.reserve = data.fetch(:reserve, self.reserve)
|
283
|
-
self.settled_at = data.fetch(:settled_at, self.settled_at)
|
284
|
-
self.created_at = data.fetch(:created_at, self.created_at)
|
285
|
-
|
286
|
-
self
|
287
|
-
end
|
288
|
-
|
289
|
-
# Get all the items linked to the payout.
|
290
|
-
# Params:
|
291
|
-
# +options+:: +Hash+ of options
|
292
|
-
def fetch_items(options = {})
|
293
|
-
self.prefill(options)
|
294
|
-
|
295
|
-
request = Request.new(@client)
|
296
|
-
path = "/payouts/" + CGI.escape(@id) + "/items"
|
297
|
-
data = {
|
298
|
-
|
299
|
-
}
|
300
|
-
|
301
|
-
response = Response.new(request.get(path, data, options))
|
302
|
-
return_values = Array.new
|
303
|
-
|
304
|
-
a = Array.new
|
305
|
-
body = response.body
|
306
|
-
for v in body['items']
|
307
|
-
tmp = PayoutItem.new(@client)
|
308
|
-
tmp.fill_with_data(v)
|
309
|
-
a.push(tmp)
|
310
|
-
end
|
311
|
-
|
312
|
-
return_values.push(a)
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
return_values[0]
|
317
|
-
end
|
318
|
-
|
319
|
-
# Get all the payouts.
|
320
|
-
# Params:
|
321
|
-
# +options+:: +Hash+ of options
|
322
|
-
def all(options = {})
|
323
|
-
self.prefill(options)
|
324
|
-
|
325
|
-
request = Request.new(@client)
|
326
|
-
path = "/payouts"
|
327
|
-
data = {
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
response = Response.new(request.get(path, data, options))
|
332
|
-
return_values = Array.new
|
333
|
-
|
334
|
-
a = Array.new
|
335
|
-
body = response.body
|
336
|
-
for v in body['payouts']
|
337
|
-
tmp = Payout.new(@client)
|
338
|
-
tmp.fill_with_data(v)
|
339
|
-
a.push(tmp)
|
340
|
-
end
|
341
|
-
|
342
|
-
return_values.push(a)
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
return_values[0]
|
347
|
-
end
|
348
|
-
|
349
|
-
# Find a payout by its ID.
|
350
|
-
# Params:
|
351
|
-
# +payout_id+:: ID of the payout
|
352
|
-
# +options+:: +Hash+ of options
|
353
|
-
def find(payout_id, options = {})
|
354
|
-
self.prefill(options)
|
355
|
-
|
356
|
-
request = Request.new(@client)
|
357
|
-
path = "/payouts/" + CGI.escape(payout_id) + ""
|
358
|
-
data = {
|
359
|
-
|
360
|
-
}
|
361
|
-
|
362
|
-
response = Response.new(request.get(path, data, options))
|
363
|
-
return_values = Array.new
|
364
|
-
|
365
|
-
body = response.body
|
366
|
-
body = body["payout"]
|
367
|
-
|
368
|
-
|
369
|
-
obj = Payout.new(@client)
|
370
|
-
return_values.push(obj.fill_with_data(body))
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
return_values[0]
|
375
|
-
end
|
376
|
-
|
377
|
-
|
378
|
-
end
|
379
|
-
end
|
@@ -1,238 +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 PayoutItem
|
10
|
-
|
11
|
-
attr_reader :id
|
12
|
-
attr_reader :project
|
13
|
-
attr_reader :project_id
|
14
|
-
attr_reader :payout
|
15
|
-
attr_reader :payout_id
|
16
|
-
attr_reader :transaction
|
17
|
-
attr_reader :transaction_id
|
18
|
-
attr_reader :type
|
19
|
-
attr_reader :gateway_resource_id
|
20
|
-
attr_reader :amount
|
21
|
-
attr_reader :fees
|
22
|
-
attr_reader :metadata
|
23
|
-
attr_reader :created_at
|
24
|
-
|
25
|
-
|
26
|
-
def id=(val)
|
27
|
-
@id = val
|
28
|
-
end
|
29
|
-
|
30
|
-
def project=(val)
|
31
|
-
if val.nil?
|
32
|
-
@project = val
|
33
|
-
return
|
34
|
-
end
|
35
|
-
|
36
|
-
if val.instance_of? Project
|
37
|
-
@project = val
|
38
|
-
else
|
39
|
-
obj = Project.new(@client)
|
40
|
-
obj.fill_with_data(val)
|
41
|
-
@project = obj
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
def project_id=(val)
|
47
|
-
@project_id = val
|
48
|
-
end
|
49
|
-
|
50
|
-
def payout=(val)
|
51
|
-
if val.nil?
|
52
|
-
@payout = val
|
53
|
-
return
|
54
|
-
end
|
55
|
-
|
56
|
-
if val.instance_of? Payout
|
57
|
-
@payout = val
|
58
|
-
else
|
59
|
-
obj = Payout.new(@client)
|
60
|
-
obj.fill_with_data(val)
|
61
|
-
@payout = obj
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
def payout_id=(val)
|
67
|
-
@payout_id = val
|
68
|
-
end
|
69
|
-
|
70
|
-
def transaction=(val)
|
71
|
-
if val.nil?
|
72
|
-
@transaction = val
|
73
|
-
return
|
74
|
-
end
|
75
|
-
|
76
|
-
if val.instance_of? Transaction
|
77
|
-
@transaction = val
|
78
|
-
else
|
79
|
-
obj = Transaction.new(@client)
|
80
|
-
obj.fill_with_data(val)
|
81
|
-
@transaction = obj
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
def transaction_id=(val)
|
87
|
-
@transaction_id = val
|
88
|
-
end
|
89
|
-
|
90
|
-
def type=(val)
|
91
|
-
@type = val
|
92
|
-
end
|
93
|
-
|
94
|
-
def gateway_resource_id=(val)
|
95
|
-
@gateway_resource_id = val
|
96
|
-
end
|
97
|
-
|
98
|
-
def amount=(val)
|
99
|
-
@amount = val
|
100
|
-
end
|
101
|
-
|
102
|
-
def fees=(val)
|
103
|
-
@fees = val
|
104
|
-
end
|
105
|
-
|
106
|
-
def metadata=(val)
|
107
|
-
@metadata = val
|
108
|
-
end
|
109
|
-
|
110
|
-
def created_at=(val)
|
111
|
-
@created_at = val
|
112
|
-
end
|
113
|
-
|
114
|
-
|
115
|
-
# Initializes the PayoutItem object
|
116
|
-
# Params:
|
117
|
-
# +client+:: +ProcessOut+ client instance
|
118
|
-
# +data+:: data that can be used to fill the object
|
119
|
-
def initialize(client, data = {})
|
120
|
-
@client = client
|
121
|
-
|
122
|
-
self.id = data.fetch(:id, nil)
|
123
|
-
self.project = data.fetch(:project, nil)
|
124
|
-
self.project_id = data.fetch(:project_id, nil)
|
125
|
-
self.payout = data.fetch(:payout, nil)
|
126
|
-
self.payout_id = data.fetch(:payout_id, nil)
|
127
|
-
self.transaction = data.fetch(:transaction, nil)
|
128
|
-
self.transaction_id = data.fetch(:transaction_id, nil)
|
129
|
-
self.type = data.fetch(:type, nil)
|
130
|
-
self.gateway_resource_id = data.fetch(:gateway_resource_id, nil)
|
131
|
-
self.amount = data.fetch(:amount, nil)
|
132
|
-
self.fees = data.fetch(:fees, nil)
|
133
|
-
self.metadata = data.fetch(:metadata, nil)
|
134
|
-
self.created_at = data.fetch(:created_at, nil)
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
# Create a new PayoutItem using the current client
|
139
|
-
def new(data = {})
|
140
|
-
PayoutItem.new(@client, data)
|
141
|
-
end
|
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
|
-
|
162
|
-
# Fills the object with data coming from the API
|
163
|
-
# Params:
|
164
|
-
# +data+:: +Hash+ of data coming from the API
|
165
|
-
def fill_with_data(data)
|
166
|
-
if data.nil?
|
167
|
-
return self
|
168
|
-
end
|
169
|
-
if data.include? "id"
|
170
|
-
self.id = data["id"]
|
171
|
-
end
|
172
|
-
if data.include? "project"
|
173
|
-
self.project = data["project"]
|
174
|
-
end
|
175
|
-
if data.include? "project_id"
|
176
|
-
self.project_id = data["project_id"]
|
177
|
-
end
|
178
|
-
if data.include? "payout"
|
179
|
-
self.payout = data["payout"]
|
180
|
-
end
|
181
|
-
if data.include? "payout_id"
|
182
|
-
self.payout_id = data["payout_id"]
|
183
|
-
end
|
184
|
-
if data.include? "transaction"
|
185
|
-
self.transaction = data["transaction"]
|
186
|
-
end
|
187
|
-
if data.include? "transaction_id"
|
188
|
-
self.transaction_id = data["transaction_id"]
|
189
|
-
end
|
190
|
-
if data.include? "type"
|
191
|
-
self.type = data["type"]
|
192
|
-
end
|
193
|
-
if data.include? "gateway_resource_id"
|
194
|
-
self.gateway_resource_id = data["gateway_resource_id"]
|
195
|
-
end
|
196
|
-
if data.include? "amount"
|
197
|
-
self.amount = data["amount"]
|
198
|
-
end
|
199
|
-
if data.include? "fees"
|
200
|
-
self.fees = data["fees"]
|
201
|
-
end
|
202
|
-
if data.include? "metadata"
|
203
|
-
self.metadata = data["metadata"]
|
204
|
-
end
|
205
|
-
if data.include? "created_at"
|
206
|
-
self.created_at = data["created_at"]
|
207
|
-
end
|
208
|
-
|
209
|
-
self
|
210
|
-
end
|
211
|
-
|
212
|
-
# Prefills the object with the data passed as parameters
|
213
|
-
# Params:
|
214
|
-
# +data+:: +Hash+ of data
|
215
|
-
def prefill(data)
|
216
|
-
if data.nil?
|
217
|
-
return self
|
218
|
-
end
|
219
|
-
self.id = data.fetch(:id, self.id)
|
220
|
-
self.project = data.fetch(:project, self.project)
|
221
|
-
self.project_id = data.fetch(:project_id, self.project_id)
|
222
|
-
self.payout = data.fetch(:payout, self.payout)
|
223
|
-
self.payout_id = data.fetch(:payout_id, self.payout_id)
|
224
|
-
self.transaction = data.fetch(:transaction, self.transaction)
|
225
|
-
self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
|
226
|
-
self.type = data.fetch(:type, self.type)
|
227
|
-
self.gateway_resource_id = data.fetch(:gateway_resource_id, self.gateway_resource_id)
|
228
|
-
self.amount = data.fetch(:amount, self.amount)
|
229
|
-
self.fees = data.fetch(:fees, self.fees)
|
230
|
-
self.metadata = data.fetch(:metadata, self.metadata)
|
231
|
-
self.created_at = data.fetch(:created_at, self.created_at)
|
232
|
-
|
233
|
-
self
|
234
|
-
end
|
235
|
-
|
236
|
-
|
237
|
-
end
|
238
|
-
end
|