Class: ActiveMerchant::Billing::WorldpayUsGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/worldpay_us.rb

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

card_brand, #card_brand, #generate_unique_id, inherited, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ WorldpayUsGateway

Returns a new instance of WorldpayUsGateway


20
21
22
23
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 20

def initialize(options={})
  requires!(options, :acctid, :subid, :merchantpin)
  super
end

Instance Method Details

#authorize(money, payment, options = {}) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 34

def authorize(money, payment, options={})
  post = {}
  add_invoice(post, money, options)
  add_credit_card(post, payment)
  add_customer_data(post, options)

  commit('authorize', options, post)
end

#capture(amount, authorization, options = {}) ⇒ Object


43
44
45
46
47
48
49
50
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 43

def capture(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)

  commit('capture', options, post)
end

#purchase(money, payment_method, options = {}) ⇒ Object


25
26
27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 25

def purchase(money, payment_method, options={})
  post = {}
  add_invoice(post, money, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)

  commit('purchase', options, post)
end

#refund(amount, authorization, options = {}) ⇒ Object


52
53
54
55
56
57
58
59
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 52

def refund(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)

  commit("refund", options, post)
end

#verify(credit_card, options = {}) ⇒ Object


68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 68

def verify(credit_card, options={})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

#void(authorization, options = {}) ⇒ Object


61
62
63
64
65
66
# File 'lib/active_merchant/billing/gateways/worldpay_us.rb', line 61

def void(authorization, options={})
  post = {}
  add_reference(post, authorization)

  commit('void', options, post)
end