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/refund.rb
DELETED
@@ -1,277 +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
|
-
attr_reader :invoice_detail_ids
|
22
|
-
|
23
|
-
|
24
|
-
def id=(val)
|
25
|
-
@id = val
|
26
|
-
end
|
27
|
-
|
28
|
-
def transaction=(val)
|
29
|
-
if val.nil?
|
30
|
-
@transaction = val
|
31
|
-
return
|
32
|
-
end
|
33
|
-
|
34
|
-
if val.instance_of? Transaction
|
35
|
-
@transaction = val
|
36
|
-
else
|
37
|
-
obj = Transaction.new(@client)
|
38
|
-
obj.fill_with_data(val)
|
39
|
-
@transaction = obj
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def transaction_id=(val)
|
45
|
-
@transaction_id = val
|
46
|
-
end
|
47
|
-
|
48
|
-
def amount=(val)
|
49
|
-
@amount = val
|
50
|
-
end
|
51
|
-
|
52
|
-
def reason=(val)
|
53
|
-
@reason = val
|
54
|
-
end
|
55
|
-
|
56
|
-
def information=(val)
|
57
|
-
@information = val
|
58
|
-
end
|
59
|
-
|
60
|
-
def has_failed=(val)
|
61
|
-
@has_failed = val
|
62
|
-
end
|
63
|
-
|
64
|
-
def metadata=(val)
|
65
|
-
@metadata = val
|
66
|
-
end
|
67
|
-
|
68
|
-
def sandbox=(val)
|
69
|
-
@sandbox = val
|
70
|
-
end
|
71
|
-
|
72
|
-
def created_at=(val)
|
73
|
-
@created_at = val
|
74
|
-
end
|
75
|
-
|
76
|
-
def invoice_detail_ids=(val)
|
77
|
-
@invoice_detail_ids = val
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
# Initializes the Refund object
|
82
|
-
# Params:
|
83
|
-
# +client+:: +ProcessOut+ client instance
|
84
|
-
# +data+:: data that can be used to fill the object
|
85
|
-
def initialize(client, data = {})
|
86
|
-
@client = client
|
87
|
-
|
88
|
-
self.id = data.fetch(:id, nil)
|
89
|
-
self.transaction = data.fetch(:transaction, nil)
|
90
|
-
self.transaction_id = data.fetch(:transaction_id, nil)
|
91
|
-
self.amount = data.fetch(:amount, nil)
|
92
|
-
self.reason = data.fetch(:reason, nil)
|
93
|
-
self.information = data.fetch(:information, nil)
|
94
|
-
self.has_failed = data.fetch(:has_failed, nil)
|
95
|
-
self.metadata = data.fetch(:metadata, nil)
|
96
|
-
self.sandbox = data.fetch(:sandbox, nil)
|
97
|
-
self.created_at = data.fetch(:created_at, nil)
|
98
|
-
self.invoice_detail_ids = data.fetch(:invoice_detail_ids, nil)
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
# Create a new Refund using the current client
|
103
|
-
def new(data = {})
|
104
|
-
Refund.new(@client, data)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Overrides the JSON marshaller to only send the fields we want
|
108
|
-
def to_json(options)
|
109
|
-
{
|
110
|
-
"id": self.id,
|
111
|
-
"transaction": self.transaction,
|
112
|
-
"transaction_id": self.transaction_id,
|
113
|
-
"amount": self.amount,
|
114
|
-
"reason": self.reason,
|
115
|
-
"information": self.information,
|
116
|
-
"has_failed": self.has_failed,
|
117
|
-
"metadata": self.metadata,
|
118
|
-
"sandbox": self.sandbox,
|
119
|
-
"created_at": self.created_at,
|
120
|
-
"invoice_detail_ids": self.invoice_detail_ids,
|
121
|
-
}.to_json
|
122
|
-
end
|
123
|
-
|
124
|
-
# Fills the object with data coming from the API
|
125
|
-
# Params:
|
126
|
-
# +data+:: +Hash+ of data coming from the API
|
127
|
-
def fill_with_data(data)
|
128
|
-
if data.nil?
|
129
|
-
return self
|
130
|
-
end
|
131
|
-
if data.include? "id"
|
132
|
-
self.id = data["id"]
|
133
|
-
end
|
134
|
-
if data.include? "transaction"
|
135
|
-
self.transaction = data["transaction"]
|
136
|
-
end
|
137
|
-
if data.include? "transaction_id"
|
138
|
-
self.transaction_id = data["transaction_id"]
|
139
|
-
end
|
140
|
-
if data.include? "amount"
|
141
|
-
self.amount = data["amount"]
|
142
|
-
end
|
143
|
-
if data.include? "reason"
|
144
|
-
self.reason = data["reason"]
|
145
|
-
end
|
146
|
-
if data.include? "information"
|
147
|
-
self.information = data["information"]
|
148
|
-
end
|
149
|
-
if data.include? "has_failed"
|
150
|
-
self.has_failed = data["has_failed"]
|
151
|
-
end
|
152
|
-
if data.include? "metadata"
|
153
|
-
self.metadata = data["metadata"]
|
154
|
-
end
|
155
|
-
if data.include? "sandbox"
|
156
|
-
self.sandbox = data["sandbox"]
|
157
|
-
end
|
158
|
-
if data.include? "created_at"
|
159
|
-
self.created_at = data["created_at"]
|
160
|
-
end
|
161
|
-
if data.include? "invoice_detail_ids"
|
162
|
-
self.invoice_detail_ids = data["invoice_detail_ids"]
|
163
|
-
end
|
164
|
-
|
165
|
-
self
|
166
|
-
end
|
167
|
-
|
168
|
-
# Prefills the object with the data passed as parameters
|
169
|
-
# Params:
|
170
|
-
# +data+:: +Hash+ of data
|
171
|
-
def prefill(data)
|
172
|
-
if data.nil?
|
173
|
-
return self
|
174
|
-
end
|
175
|
-
self.id = data.fetch(:id, self.id)
|
176
|
-
self.transaction = data.fetch(:transaction, self.transaction)
|
177
|
-
self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
|
178
|
-
self.amount = data.fetch(:amount, self.amount)
|
179
|
-
self.reason = data.fetch(:reason, self.reason)
|
180
|
-
self.information = data.fetch(:information, self.information)
|
181
|
-
self.has_failed = data.fetch(:has_failed, self.has_failed)
|
182
|
-
self.metadata = data.fetch(:metadata, self.metadata)
|
183
|
-
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
184
|
-
self.created_at = data.fetch(:created_at, self.created_at)
|
185
|
-
self.invoice_detail_ids = data.fetch(:invoice_detail_ids, self.invoice_detail_ids)
|
186
|
-
|
187
|
-
self
|
188
|
-
end
|
189
|
-
|
190
|
-
# Get the transaction's refunds.
|
191
|
-
# Params:
|
192
|
-
# +transaction_id+:: ID of the transaction
|
193
|
-
# +options+:: +Hash+ of options
|
194
|
-
def fetch_transaction_refunds(transaction_id, options = {})
|
195
|
-
self.prefill(options)
|
196
|
-
|
197
|
-
request = Request.new(@client)
|
198
|
-
path = "/transactions/" + CGI.escape(transaction_id) + "/refunds"
|
199
|
-
data = {
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
response = Response.new(request.get(path, data, options))
|
204
|
-
return_values = Array.new
|
205
|
-
|
206
|
-
a = Array.new
|
207
|
-
body = response.body
|
208
|
-
for v in body['refunds']
|
209
|
-
tmp = Refund.new(@client)
|
210
|
-
tmp.fill_with_data(v)
|
211
|
-
a.push(tmp)
|
212
|
-
end
|
213
|
-
|
214
|
-
return_values.push(a)
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
return_values[0]
|
219
|
-
end
|
220
|
-
|
221
|
-
# Find a transaction's refund by its ID.
|
222
|
-
# Params:
|
223
|
-
# +transaction_id+:: ID of the transaction on which the refund was applied
|
224
|
-
# +refund_id+:: ID of the refund
|
225
|
-
# +options+:: +Hash+ of options
|
226
|
-
def find(transaction_id, refund_id, options = {})
|
227
|
-
self.prefill(options)
|
228
|
-
|
229
|
-
request = Request.new(@client)
|
230
|
-
path = "/transactions/" + CGI.escape(transaction_id) + "/refunds/" + CGI.escape(refund_id) + ""
|
231
|
-
data = {
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
response = Response.new(request.get(path, data, options))
|
236
|
-
return_values = Array.new
|
237
|
-
|
238
|
-
body = response.body
|
239
|
-
body = body["refund"]
|
240
|
-
|
241
|
-
|
242
|
-
obj = Refund.new(@client)
|
243
|
-
return_values.push(obj.fill_with_data(body))
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
return_values[0]
|
248
|
-
end
|
249
|
-
|
250
|
-
# Create a refund for a transaction.
|
251
|
-
# Params:
|
252
|
-
# +options+:: +Hash+ of options
|
253
|
-
def create(options = {})
|
254
|
-
self.prefill(options)
|
255
|
-
|
256
|
-
request = Request.new(@client)
|
257
|
-
path = "/transactions/" + CGI.escape(@transaction_id) + "/refunds"
|
258
|
-
data = {
|
259
|
-
"amount" => @amount,
|
260
|
-
"metadata" => @metadata,
|
261
|
-
"reason" => @reason,
|
262
|
-
"information" => @information,
|
263
|
-
"invoice_detail_ids" => @invoice_detail_ids
|
264
|
-
}
|
265
|
-
|
266
|
-
response = Response.new(request.post(path, data, options))
|
267
|
-
return_values = Array.new
|
268
|
-
|
269
|
-
return_values.push(response.success)
|
270
|
-
|
271
|
-
|
272
|
-
return_values[0]
|
273
|
-
end
|
274
|
-
|
275
|
-
|
276
|
-
end
|
277
|
-
end
|