processout 1.2.2 → 2.0.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.
- checksums.yaml +4 -4
- data/lib/processout.rb +37 -0
- data/lib/processout/activity.rb +15 -0
- data/lib/processout/addon.rb +352 -0
- data/lib/processout/api_request.rb +274 -0
- data/lib/processout/api_version.rb +82 -0
- data/lib/processout/authorization_request.rb +62 -17
- data/lib/processout/card.rb +137 -10
- data/lib/processout/coupon.rb +22 -17
- data/lib/processout/customer.rb +180 -14
- data/lib/processout/discount.rb +69 -19
- data/lib/processout/dunning_action.rb +72 -0
- data/lib/processout/event.rb +15 -0
- data/lib/processout/gateway.rb +30 -0
- data/lib/processout/gateway_configuration.rb +90 -0
- data/lib/processout/gateway_request.rb +26 -0
- data/lib/processout/invoice.rb +119 -62
- data/lib/processout/invoice_detail.rb +20 -0
- data/lib/processout/networking/request.rb +1 -2
- data/lib/processout/plan.rb +15 -0
- data/lib/processout/product.rb +15 -0
- data/lib/processout/project.rb +100 -0
- data/lib/processout/refund.rb +32 -7
- data/lib/processout/subscription.rb +267 -117
- data/lib/processout/token.rb +62 -2
- data/lib/processout/transaction.rb +159 -0
- data/lib/processout/transaction_operation.rb +248 -0
- data/lib/processout/version.rb +1 -1
- data/lib/processout/webhook.rb +30 -0
- data/lib/processout/webhook_endpoint.rb +135 -0
- metadata +9 -2
data/lib/processout/token.rb
CHANGED
@@ -10,10 +10,14 @@ module ProcessOut
|
|
10
10
|
attr_reader :id
|
11
11
|
attr_reader :customer
|
12
12
|
attr_reader :customer_id
|
13
|
+
attr_reader :gateway_configuration
|
14
|
+
attr_reader :gateway_configuration_id
|
13
15
|
attr_reader :card
|
16
|
+
attr_reader :card_id
|
14
17
|
attr_reader :type
|
15
18
|
attr_reader :metadata
|
16
19
|
attr_reader :is_subscription_only
|
20
|
+
attr_reader :is_default
|
17
21
|
attr_reader :created_at
|
18
22
|
|
19
23
|
|
@@ -22,6 +26,11 @@ module ProcessOut
|
|
22
26
|
end
|
23
27
|
|
24
28
|
def customer=(val)
|
29
|
+
if val.nil?
|
30
|
+
@customer = val
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
25
34
|
if val.instance_of? Customer
|
26
35
|
@customer = val
|
27
36
|
else
|
@@ -36,7 +45,32 @@ module ProcessOut
|
|
36
45
|
@customer_id = val
|
37
46
|
end
|
38
47
|
|
48
|
+
def gateway_configuration=(val)
|
49
|
+
if val.nil?
|
50
|
+
@gateway_configuration = val
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
54
|
+
if val.instance_of? GatewayConfiguration
|
55
|
+
@gateway_configuration = val
|
56
|
+
else
|
57
|
+
obj = GatewayConfiguration.new(@client)
|
58
|
+
obj.fill_with_data(val)
|
59
|
+
@gateway_configuration = obj
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def gateway_configuration_id=(val)
|
65
|
+
@gateway_configuration_id = val
|
66
|
+
end
|
67
|
+
|
39
68
|
def card=(val)
|
69
|
+
if val.nil?
|
70
|
+
@card = val
|
71
|
+
return
|
72
|
+
end
|
73
|
+
|
40
74
|
if val.instance_of? Card
|
41
75
|
@card = val
|
42
76
|
else
|
@@ -47,6 +81,10 @@ module ProcessOut
|
|
47
81
|
|
48
82
|
end
|
49
83
|
|
84
|
+
def card_id=(val)
|
85
|
+
@card_id = val
|
86
|
+
end
|
87
|
+
|
50
88
|
def type=(val)
|
51
89
|
@type = val
|
52
90
|
end
|
@@ -59,6 +97,10 @@ module ProcessOut
|
|
59
97
|
@is_subscription_only = val
|
60
98
|
end
|
61
99
|
|
100
|
+
def is_default=(val)
|
101
|
+
@is_default = val
|
102
|
+
end
|
103
|
+
|
62
104
|
def created_at=(val)
|
63
105
|
@created_at = val
|
64
106
|
end
|
@@ -74,10 +116,14 @@ module ProcessOut
|
|
74
116
|
self.id = data.fetch(:id, nil)
|
75
117
|
self.customer = data.fetch(:customer, nil)
|
76
118
|
self.customer_id = data.fetch(:customer_id, nil)
|
119
|
+
self.gateway_configuration = data.fetch(:gateway_configuration, nil)
|
120
|
+
self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
|
77
121
|
self.card = data.fetch(:card, nil)
|
122
|
+
self.card_id = data.fetch(:card_id, nil)
|
78
123
|
self.type = data.fetch(:type, nil)
|
79
124
|
self.metadata = data.fetch(:metadata, nil)
|
80
125
|
self.is_subscription_only = data.fetch(:is_subscription_only, nil)
|
126
|
+
self.is_default = data.fetch(:is_default, nil)
|
81
127
|
self.created_at = data.fetch(:created_at, nil)
|
82
128
|
|
83
129
|
end
|
@@ -103,9 +149,18 @@ module ProcessOut
|
|
103
149
|
if data.include? "customer_id"
|
104
150
|
self.customer_id = data["customer_id"]
|
105
151
|
end
|
152
|
+
if data.include? "gateway_configuration"
|
153
|
+
self.gateway_configuration = data["gateway_configuration"]
|
154
|
+
end
|
155
|
+
if data.include? "gateway_configuration_id"
|
156
|
+
self.gateway_configuration_id = data["gateway_configuration_id"]
|
157
|
+
end
|
106
158
|
if data.include? "card"
|
107
159
|
self.card = data["card"]
|
108
160
|
end
|
161
|
+
if data.include? "card_id"
|
162
|
+
self.card_id = data["card_id"]
|
163
|
+
end
|
109
164
|
if data.include? "type"
|
110
165
|
self.type = data["type"]
|
111
166
|
end
|
@@ -115,6 +170,9 @@ module ProcessOut
|
|
115
170
|
if data.include? "is_subscription_only"
|
116
171
|
self.is_subscription_only = data["is_subscription_only"]
|
117
172
|
end
|
173
|
+
if data.include? "is_default"
|
174
|
+
self.is_default = data["is_default"]
|
175
|
+
end
|
118
176
|
if data.include? "created_at"
|
119
177
|
self.created_at = data["created_at"]
|
120
178
|
end
|
@@ -132,10 +190,14 @@ module ProcessOut
|
|
132
190
|
self.id = data.fetch(:id, self.id)
|
133
191
|
self.customer = data.fetch(:customer, self.customer)
|
134
192
|
self.customer_id = data.fetch(:customer_id, self.customer_id)
|
193
|
+
self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
|
194
|
+
self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
|
135
195
|
self.card = data.fetch(:card, self.card)
|
196
|
+
self.card_id = data.fetch(:card_id, self.card_id)
|
136
197
|
self.type = data.fetch(:type, self.type)
|
137
198
|
self.metadata = data.fetch(:metadata, self.metadata)
|
138
199
|
self.is_subscription_only = data.fetch(:is_subscription_only, self.is_subscription_only)
|
200
|
+
self.is_default = data.fetch(:is_default, self.is_default)
|
139
201
|
self.created_at = data.fetch(:created_at, self.created_at)
|
140
202
|
|
141
203
|
self
|
@@ -184,7 +246,6 @@ module ProcessOut
|
|
184
246
|
"metadata" => @metadata,
|
185
247
|
"settings" => options.fetch(:settings, nil),
|
186
248
|
"target" => options.fetch(:target, nil),
|
187
|
-
"replace" => options.fetch(:replace, nil),
|
188
249
|
"source" => source
|
189
250
|
}
|
190
251
|
|
@@ -216,7 +277,6 @@ module ProcessOut
|
|
216
277
|
data = {
|
217
278
|
"metadata" => @metadata,
|
218
279
|
"settings" => options.fetch(:settings, nil),
|
219
|
-
"replace" => options.fetch(:replace, nil),
|
220
280
|
"source" => source,
|
221
281
|
"target" => target
|
222
282
|
}
|
@@ -9,10 +9,19 @@ module ProcessOut
|
|
9
9
|
|
10
10
|
attr_reader :id
|
11
11
|
attr_reader :project
|
12
|
+
attr_reader :project_id
|
13
|
+
attr_reader :invoice
|
14
|
+
attr_reader :invoice_id
|
12
15
|
attr_reader :customer
|
16
|
+
attr_reader :customer_id
|
13
17
|
attr_reader :subscription
|
18
|
+
attr_reader :subscription_id
|
14
19
|
attr_reader :token
|
20
|
+
attr_reader :token_id
|
15
21
|
attr_reader :card
|
22
|
+
attr_reader :card_id
|
23
|
+
attr_reader :operations
|
24
|
+
attr_reader :refunds
|
16
25
|
attr_reader :name
|
17
26
|
attr_reader :authorized_amount
|
18
27
|
attr_reader :captured_amount
|
@@ -33,6 +42,11 @@ module ProcessOut
|
|
33
42
|
end
|
34
43
|
|
35
44
|
def project=(val)
|
45
|
+
if val.nil?
|
46
|
+
@project = val
|
47
|
+
return
|
48
|
+
end
|
49
|
+
|
36
50
|
if val.instance_of? Project
|
37
51
|
@project = val
|
38
52
|
else
|
@@ -43,7 +57,36 @@ module ProcessOut
|
|
43
57
|
|
44
58
|
end
|
45
59
|
|
60
|
+
def project_id=(val)
|
61
|
+
@project_id = val
|
62
|
+
end
|
63
|
+
|
64
|
+
def invoice=(val)
|
65
|
+
if val.nil?
|
66
|
+
@invoice = val
|
67
|
+
return
|
68
|
+
end
|
69
|
+
|
70
|
+
if val.instance_of? Customer
|
71
|
+
@invoice = val
|
72
|
+
else
|
73
|
+
obj = Customer.new(@client)
|
74
|
+
obj.fill_with_data(val)
|
75
|
+
@invoice = obj
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
def invoice_id=(val)
|
81
|
+
@invoice_id = val
|
82
|
+
end
|
83
|
+
|
46
84
|
def customer=(val)
|
85
|
+
if val.nil?
|
86
|
+
@customer = val
|
87
|
+
return
|
88
|
+
end
|
89
|
+
|
47
90
|
if val.instance_of? Customer
|
48
91
|
@customer = val
|
49
92
|
else
|
@@ -54,7 +97,16 @@ module ProcessOut
|
|
54
97
|
|
55
98
|
end
|
56
99
|
|
100
|
+
def customer_id=(val)
|
101
|
+
@customer_id = val
|
102
|
+
end
|
103
|
+
|
57
104
|
def subscription=(val)
|
105
|
+
if val.nil?
|
106
|
+
@subscription = val
|
107
|
+
return
|
108
|
+
end
|
109
|
+
|
58
110
|
if val.instance_of? Subscription
|
59
111
|
@subscription = val
|
60
112
|
else
|
@@ -65,7 +117,16 @@ module ProcessOut
|
|
65
117
|
|
66
118
|
end
|
67
119
|
|
120
|
+
def subscription_id=(val)
|
121
|
+
@subscription_id = val
|
122
|
+
end
|
123
|
+
|
68
124
|
def token=(val)
|
125
|
+
if val.nil?
|
126
|
+
@token = val
|
127
|
+
return
|
128
|
+
end
|
129
|
+
|
69
130
|
if val.instance_of? Token
|
70
131
|
@token = val
|
71
132
|
else
|
@@ -76,7 +137,16 @@ module ProcessOut
|
|
76
137
|
|
77
138
|
end
|
78
139
|
|
140
|
+
def token_id=(val)
|
141
|
+
@token_id = val
|
142
|
+
end
|
143
|
+
|
79
144
|
def card=(val)
|
145
|
+
if val.nil?
|
146
|
+
@card = val
|
147
|
+
return
|
148
|
+
end
|
149
|
+
|
80
150
|
if val.instance_of? Card
|
81
151
|
@card = val
|
82
152
|
else
|
@@ -87,6 +157,50 @@ module ProcessOut
|
|
87
157
|
|
88
158
|
end
|
89
159
|
|
160
|
+
def card_id=(val)
|
161
|
+
@card_id = val
|
162
|
+
end
|
163
|
+
|
164
|
+
def operations=(val)
|
165
|
+
if val.nil?
|
166
|
+
@operations = []
|
167
|
+
return
|
168
|
+
end
|
169
|
+
|
170
|
+
if val.length > 0 and val[0].instance_of? TransactionOperation
|
171
|
+
@operations = val
|
172
|
+
else
|
173
|
+
l = Array.new
|
174
|
+
for v in val
|
175
|
+
obj = TransactionOperation.new(@client)
|
176
|
+
obj.fill_with_data(v)
|
177
|
+
l.push(obj)
|
178
|
+
end
|
179
|
+
@operations = l
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
def refunds=(val)
|
185
|
+
if val.nil?
|
186
|
+
@refunds = []
|
187
|
+
return
|
188
|
+
end
|
189
|
+
|
190
|
+
if val.length > 0 and val[0].instance_of? Refund
|
191
|
+
@refunds = val
|
192
|
+
else
|
193
|
+
l = Array.new
|
194
|
+
for v in val
|
195
|
+
obj = Refund.new(@client)
|
196
|
+
obj.fill_with_data(v)
|
197
|
+
l.push(obj)
|
198
|
+
end
|
199
|
+
@refunds = l
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
203
|
+
|
90
204
|
def name=(val)
|
91
205
|
@name = val
|
92
206
|
end
|
@@ -149,10 +263,19 @@ module ProcessOut
|
|
149
263
|
|
150
264
|
self.id = data.fetch(:id, nil)
|
151
265
|
self.project = data.fetch(:project, nil)
|
266
|
+
self.project_id = data.fetch(:project_id, nil)
|
267
|
+
self.invoice = data.fetch(:invoice, nil)
|
268
|
+
self.invoice_id = data.fetch(:invoice_id, nil)
|
152
269
|
self.customer = data.fetch(:customer, nil)
|
270
|
+
self.customer_id = data.fetch(:customer_id, nil)
|
153
271
|
self.subscription = data.fetch(:subscription, nil)
|
272
|
+
self.subscription_id = data.fetch(:subscription_id, nil)
|
154
273
|
self.token = data.fetch(:token, nil)
|
274
|
+
self.token_id = data.fetch(:token_id, nil)
|
155
275
|
self.card = data.fetch(:card, nil)
|
276
|
+
self.card_id = data.fetch(:card_id, nil)
|
277
|
+
self.operations = data.fetch(:operations, nil)
|
278
|
+
self.refunds = data.fetch(:refunds, nil)
|
156
279
|
self.name = data.fetch(:name, nil)
|
157
280
|
self.authorized_amount = data.fetch(:authorized_amount, nil)
|
158
281
|
self.captured_amount = data.fetch(:captured_amount, nil)
|
@@ -187,18 +310,45 @@ module ProcessOut
|
|
187
310
|
if data.include? "project"
|
188
311
|
self.project = data["project"]
|
189
312
|
end
|
313
|
+
if data.include? "project_id"
|
314
|
+
self.project_id = data["project_id"]
|
315
|
+
end
|
316
|
+
if data.include? "invoice"
|
317
|
+
self.invoice = data["invoice"]
|
318
|
+
end
|
319
|
+
if data.include? "invoice_id"
|
320
|
+
self.invoice_id = data["invoice_id"]
|
321
|
+
end
|
190
322
|
if data.include? "customer"
|
191
323
|
self.customer = data["customer"]
|
192
324
|
end
|
325
|
+
if data.include? "customer_id"
|
326
|
+
self.customer_id = data["customer_id"]
|
327
|
+
end
|
193
328
|
if data.include? "subscription"
|
194
329
|
self.subscription = data["subscription"]
|
195
330
|
end
|
331
|
+
if data.include? "subscription_id"
|
332
|
+
self.subscription_id = data["subscription_id"]
|
333
|
+
end
|
196
334
|
if data.include? "token"
|
197
335
|
self.token = data["token"]
|
198
336
|
end
|
337
|
+
if data.include? "token_id"
|
338
|
+
self.token_id = data["token_id"]
|
339
|
+
end
|
199
340
|
if data.include? "card"
|
200
341
|
self.card = data["card"]
|
201
342
|
end
|
343
|
+
if data.include? "card_id"
|
344
|
+
self.card_id = data["card_id"]
|
345
|
+
end
|
346
|
+
if data.include? "operations"
|
347
|
+
self.operations = data["operations"]
|
348
|
+
end
|
349
|
+
if data.include? "refunds"
|
350
|
+
self.refunds = data["refunds"]
|
351
|
+
end
|
202
352
|
if data.include? "name"
|
203
353
|
self.name = data["name"]
|
204
354
|
end
|
@@ -251,10 +401,19 @@ module ProcessOut
|
|
251
401
|
end
|
252
402
|
self.id = data.fetch(:id, self.id)
|
253
403
|
self.project = data.fetch(:project, self.project)
|
404
|
+
self.project_id = data.fetch(:project_id, self.project_id)
|
405
|
+
self.invoice = data.fetch(:invoice, self.invoice)
|
406
|
+
self.invoice_id = data.fetch(:invoice_id, self.invoice_id)
|
254
407
|
self.customer = data.fetch(:customer, self.customer)
|
408
|
+
self.customer_id = data.fetch(:customer_id, self.customer_id)
|
255
409
|
self.subscription = data.fetch(:subscription, self.subscription)
|
410
|
+
self.subscription_id = data.fetch(:subscription_id, self.subscription_id)
|
256
411
|
self.token = data.fetch(:token, self.token)
|
412
|
+
self.token_id = data.fetch(:token_id, self.token_id)
|
257
413
|
self.card = data.fetch(:card, self.card)
|
414
|
+
self.card_id = data.fetch(:card_id, self.card_id)
|
415
|
+
self.operations = data.fetch(:operations, self.operations)
|
416
|
+
self.refunds = data.fetch(:refunds, self.refunds)
|
258
417
|
self.name = data.fetch(:name, self.name)
|
259
418
|
self.authorized_amount = data.fetch(:authorized_amount, self.authorized_amount)
|
260
419
|
self.captured_amount = data.fetch(:captured_amount, self.captured_amount)
|
@@ -0,0 +1,248 @@
|
|
1
|
+
# The content of this file was automatically generated
|
2
|
+
|
3
|
+
require "cgi"
|
4
|
+
require "processout/networking/request"
|
5
|
+
require "processout/networking/response"
|
6
|
+
|
7
|
+
module ProcessOut
|
8
|
+
class TransactionOperation
|
9
|
+
|
10
|
+
attr_reader :id
|
11
|
+
attr_reader :transaction
|
12
|
+
attr_reader :transaction_id
|
13
|
+
attr_reader :token
|
14
|
+
attr_reader :token_id
|
15
|
+
attr_reader :card
|
16
|
+
attr_reader :card_id
|
17
|
+
attr_reader :amount
|
18
|
+
attr_reader :is_attempt
|
19
|
+
attr_reader :has_failed
|
20
|
+
attr_reader :is_accountable
|
21
|
+
attr_reader :type
|
22
|
+
attr_reader :error_code
|
23
|
+
attr_reader :metadata
|
24
|
+
attr_reader :gateway_fee
|
25
|
+
attr_reader :created_at
|
26
|
+
|
27
|
+
|
28
|
+
def id=(val)
|
29
|
+
@id = val
|
30
|
+
end
|
31
|
+
|
32
|
+
def transaction=(val)
|
33
|
+
if val.nil?
|
34
|
+
@transaction = val
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
if val.instance_of? Transaction
|
39
|
+
@transaction = val
|
40
|
+
else
|
41
|
+
obj = Transaction.new(@client)
|
42
|
+
obj.fill_with_data(val)
|
43
|
+
@transaction = obj
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def transaction_id=(val)
|
49
|
+
@transaction_id = val
|
50
|
+
end
|
51
|
+
|
52
|
+
def token=(val)
|
53
|
+
if val.nil?
|
54
|
+
@token = val
|
55
|
+
return
|
56
|
+
end
|
57
|
+
|
58
|
+
if val.instance_of? Token
|
59
|
+
@token = val
|
60
|
+
else
|
61
|
+
obj = Token.new(@client)
|
62
|
+
obj.fill_with_data(val)
|
63
|
+
@token = obj
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
def token_id=(val)
|
69
|
+
@token_id = val
|
70
|
+
end
|
71
|
+
|
72
|
+
def card=(val)
|
73
|
+
if val.nil?
|
74
|
+
@card = val
|
75
|
+
return
|
76
|
+
end
|
77
|
+
|
78
|
+
if val.instance_of? Card
|
79
|
+
@card = val
|
80
|
+
else
|
81
|
+
obj = Card.new(@client)
|
82
|
+
obj.fill_with_data(val)
|
83
|
+
@card = obj
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
def card_id=(val)
|
89
|
+
@card_id = val
|
90
|
+
end
|
91
|
+
|
92
|
+
def amount=(val)
|
93
|
+
@amount = val
|
94
|
+
end
|
95
|
+
|
96
|
+
def is_attempt=(val)
|
97
|
+
@is_attempt = val
|
98
|
+
end
|
99
|
+
|
100
|
+
def has_failed=(val)
|
101
|
+
@has_failed = val
|
102
|
+
end
|
103
|
+
|
104
|
+
def is_accountable=(val)
|
105
|
+
@is_accountable = val
|
106
|
+
end
|
107
|
+
|
108
|
+
def type=(val)
|
109
|
+
@type = val
|
110
|
+
end
|
111
|
+
|
112
|
+
def error_code=(val)
|
113
|
+
@error_code = val
|
114
|
+
end
|
115
|
+
|
116
|
+
def metadata=(val)
|
117
|
+
@metadata = val
|
118
|
+
end
|
119
|
+
|
120
|
+
def gateway_fee=(val)
|
121
|
+
@gateway_fee = val
|
122
|
+
end
|
123
|
+
|
124
|
+
def created_at=(val)
|
125
|
+
@created_at = val
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
# Initializes the TransactionOperation object
|
130
|
+
# Params:
|
131
|
+
# +client+:: +ProcessOut+ client instance
|
132
|
+
# +data+:: data that can be used to fill the object
|
133
|
+
def initialize(client, data = {})
|
134
|
+
@client = client
|
135
|
+
|
136
|
+
self.id = data.fetch(:id, nil)
|
137
|
+
self.transaction = data.fetch(:transaction, nil)
|
138
|
+
self.transaction_id = data.fetch(:transaction_id, nil)
|
139
|
+
self.token = data.fetch(:token, nil)
|
140
|
+
self.token_id = data.fetch(:token_id, nil)
|
141
|
+
self.card = data.fetch(:card, nil)
|
142
|
+
self.card_id = data.fetch(:card_id, nil)
|
143
|
+
self.amount = data.fetch(:amount, nil)
|
144
|
+
self.is_attempt = data.fetch(:is_attempt, nil)
|
145
|
+
self.has_failed = data.fetch(:has_failed, nil)
|
146
|
+
self.is_accountable = data.fetch(:is_accountable, nil)
|
147
|
+
self.type = data.fetch(:type, nil)
|
148
|
+
self.error_code = data.fetch(:error_code, nil)
|
149
|
+
self.metadata = data.fetch(:metadata, nil)
|
150
|
+
self.gateway_fee = data.fetch(:gateway_fee, nil)
|
151
|
+
self.created_at = data.fetch(:created_at, nil)
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
# Create a new TransactionOperation using the current client
|
156
|
+
def new(data = {})
|
157
|
+
TransactionOperation.new(@client, data)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Fills the object with data coming from the API
|
161
|
+
# Params:
|
162
|
+
# +data+:: +Hash+ of data coming from the API
|
163
|
+
def fill_with_data(data)
|
164
|
+
if data.nil?
|
165
|
+
return self
|
166
|
+
end
|
167
|
+
if data.include? "id"
|
168
|
+
self.id = data["id"]
|
169
|
+
end
|
170
|
+
if data.include? "transaction"
|
171
|
+
self.transaction = data["transaction"]
|
172
|
+
end
|
173
|
+
if data.include? "transaction_id"
|
174
|
+
self.transaction_id = data["transaction_id"]
|
175
|
+
end
|
176
|
+
if data.include? "token"
|
177
|
+
self.token = data["token"]
|
178
|
+
end
|
179
|
+
if data.include? "token_id"
|
180
|
+
self.token_id = data["token_id"]
|
181
|
+
end
|
182
|
+
if data.include? "card"
|
183
|
+
self.card = data["card"]
|
184
|
+
end
|
185
|
+
if data.include? "card_id"
|
186
|
+
self.card_id = data["card_id"]
|
187
|
+
end
|
188
|
+
if data.include? "amount"
|
189
|
+
self.amount = data["amount"]
|
190
|
+
end
|
191
|
+
if data.include? "is_attempt"
|
192
|
+
self.is_attempt = data["is_attempt"]
|
193
|
+
end
|
194
|
+
if data.include? "has_failed"
|
195
|
+
self.has_failed = data["has_failed"]
|
196
|
+
end
|
197
|
+
if data.include? "is_accountable"
|
198
|
+
self.is_accountable = data["is_accountable"]
|
199
|
+
end
|
200
|
+
if data.include? "type"
|
201
|
+
self.type = data["type"]
|
202
|
+
end
|
203
|
+
if data.include? "error_code"
|
204
|
+
self.error_code = data["error_code"]
|
205
|
+
end
|
206
|
+
if data.include? "metadata"
|
207
|
+
self.metadata = data["metadata"]
|
208
|
+
end
|
209
|
+
if data.include? "gateway_fee"
|
210
|
+
self.gateway_fee = data["gateway_fee"]
|
211
|
+
end
|
212
|
+
if data.include? "created_at"
|
213
|
+
self.created_at = data["created_at"]
|
214
|
+
end
|
215
|
+
|
216
|
+
self
|
217
|
+
end
|
218
|
+
|
219
|
+
# Prefills the object with the data passed as parameters
|
220
|
+
# Params:
|
221
|
+
# +data+:: +Hash+ of data
|
222
|
+
def prefill(data)
|
223
|
+
if data.nil?
|
224
|
+
return self
|
225
|
+
end
|
226
|
+
self.id = data.fetch(:id, self.id)
|
227
|
+
self.transaction = data.fetch(:transaction, self.transaction)
|
228
|
+
self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
|
229
|
+
self.token = data.fetch(:token, self.token)
|
230
|
+
self.token_id = data.fetch(:token_id, self.token_id)
|
231
|
+
self.card = data.fetch(:card, self.card)
|
232
|
+
self.card_id = data.fetch(:card_id, self.card_id)
|
233
|
+
self.amount = data.fetch(:amount, self.amount)
|
234
|
+
self.is_attempt = data.fetch(:is_attempt, self.is_attempt)
|
235
|
+
self.has_failed = data.fetch(:has_failed, self.has_failed)
|
236
|
+
self.is_accountable = data.fetch(:is_accountable, self.is_accountable)
|
237
|
+
self.type = data.fetch(:type, self.type)
|
238
|
+
self.error_code = data.fetch(:error_code, self.error_code)
|
239
|
+
self.metadata = data.fetch(:metadata, self.metadata)
|
240
|
+
self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
|
241
|
+
self.created_at = data.fetch(:created_at, self.created_at)
|
242
|
+
|
243
|
+
self
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
end
|
248
|
+
end
|