Class: ActiveMerchant::Billing::WorldpayGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::WorldpayGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/worldpay.rb
Constant Summary
collapse
- CARD_CODES =
{
'visa' => 'VISA-SSL',
'master' => 'ECMC-SSL',
'discover' => 'DISCOVER-SSL',
'american_express' => 'AMEX-SSL',
}
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
#format
Constructor Details
Returns a new instance of WorldpayGateway.
21
22
23
24
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 21
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
33
34
35
36
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 33
def authorize(money, payment_method, options = {})
requires!(options, :order_id)
authorize_request(money, payment_method, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 38
def capture(money, authorization, options = {})
MultiResponse.run do |r|
r.process{inquire_request(authorization, options, "AUTHORISED")} unless options[:authorization_validated]
r.process{capture_request(money, authorization, options)}
end
end
|
#purchase(money, payment_method, options = {}) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 26
def purchase(money, payment_method, options = {})
MultiResponse.run do |r|
r.process{authorize(money, payment_method, options)}
r.process{capture(money, r.authorization, options.merge(:authorization_validated => true))}
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 52
def refund(money, authorization, options = {})
MultiResponse.run do |r|
r.process{inquire_request(authorization, options, "CAPTURED")}
r.process{refund_request(money, authorization, options)}
end
end
|
#void(authorization, options = {}) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 45
def void(authorization, options = {})
MultiResponse.run do |r|
r.process{inquire_request(authorization, options, "AUTHORISED")}
r.process{cancel_request(authorization, options)}
end
end
|