-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpayment.rb
More file actions
241 lines (231 loc) · 5.24 KB
/
Copy pathpayment.rb
File metadata and controls
241 lines (231 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# frozen_string_literal: true
module Minfraud
module Components
# Payment corresponds to the payment object of a minFraud request.
#
# @see https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en#schema--request--payment
class Payment < Base
include ::Minfraud::Enum
include Minfraud::Validates
# The payment method associated with the transaction. This must be one of
# +:bank_debit+, +:bank_redirect+, +:bank_transfer+, +:buy_now_pay_later+,
# +:card+, +:crypto+, +:digital_wallet+, +:gift_card+,
# +:real_time_payment+, or +:rewards+.
#
# @!attribute method
#
# @return [Symbol, nil]
enum_accessor :method,
%i[
bank_debit
bank_redirect
bank_transfer
buy_now_pay_later
card
crypto
digital_wallet
gift_card
real_time_payment
rewards
]
# The payment processor used for the transaction. The value is one
# listed as a valid value, as a symbol.
#
# @!attribute processor
#
# @return [Symbol, nil]
enum_accessor :processor, %i[
adyen
affirm
afterpay
altapay
amazon_payments
american_express_payment_gateway
apple_pay
aps_payments
authorizenet
balanced
banquest
beanstream
bluepay
bluesnap
boacompra
boku
bpoint
braintree
cardknox
cardpay
cashfree
ccavenue
ccnow
cetelem
chase_paymentech
checkout_com
cielo
collector
commdoo
compropago
concept_payments
conekta
coregateway
creditguard
credorax
cryptomus
ct_payments
cuentadigital
curopayments
cybersource
dalenys
dalpay
datacap
datacash
dibs
digital_river
dlocal
dotpay
ebs
ecomm365
ecommpay
elavon
emerchantpay
epay
epayco
eprocessing_network
epx
eway
exact
fat_zebra
first_atlantic_commerce
first_data
fiserv
g2a_pay
global_payments
gocardless
google_pay
heartland
hipay
ingenico
interac
internetsecure
intuit_quickbooks_payments
iugu
klarna
komoju
lemon_way
mastercard_payment_gateway
mercadopago
mercanet
merchant_esolutions
mirjeh
mollie
moneris_solutions
neopay
neosurf
nmi
oceanpayment
oney
onpay
openbucks
openpaymx
optimal_payments
orangepay
other
pacnet_services
payconex
payeezy
payfast
paygate
paylike
payment_express
paymentwall
payone
paypal
payplus
paysafecard
paysera
paystation
paytm
paytrace
paytrail
payture
payu
payulatam
payvision
payway
payza
pinpayments
placetopay
posconnect
princeton_payment_solutions
psigate
pxp_financial
qiwi
quickpay
raberil
razorpay
rede
redpagos
rewardspay
safecharge
sagepay
securepay
securetrading
shopify_payments
simplify_commerce
skrill
smartcoin
smartdebit
solidtrust_pay
sps_decidir
stripe
summit_payments
synapsefi
systempay
telerecargas
towah
transact_pro
trustly
trustpay
tsys
usa_epay
vantiv
verepay
vericheck
vindicia
virtual_card_services
vme
vpos
windcave
wirecard
worldpay
yaadpay
]
# The authorization outcome from the payment processor. If the
# transaction has not yet been approved or denied, do not include this
# field.
#
# @return [Boolean, nil]
attr_accessor :was_authorized
# The decline code as provided by your payment processor. If the
# transaction was not declined, do not include this field.
#
# @return [String, nil]
attr_accessor :decline_code
# @param params [Hash] Hash of parameters. Each key/value should
# correspond to one of the available attributes.
def initialize(params = {})
@was_authorized = params[:was_authorized]
@decline_code = params[:decline_code]
self.method = params[:method]
self.processor = params[:processor]
validate
end
private
def validate
return if !Minfraud.enable_validation
validate_boolean('was_authorized', @was_authorized)
validate_string('decline_code', 255, @decline_code)
end
end
end
end