Class: ActiveMerchant::Billing::EwayGateway

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

Overview

Public: For more information on the Eway Gateway please visit their Developers Area

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, 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, 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 = {}) ⇒ EwayGateway

Public: Create a new Eway Gateway. options - A hash of options:

:login     - Your Customer ID.
:password  - Your XML Refund Password that you
             specified on the Eway site. (optional)


21
22
23
24
# File 'lib/active_merchant/billing/gateways/eway.rb', line 21

def initialize(options = {})
  requires!(options, :login)
  super
end

Instance Method Details

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



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/active_merchant/billing/gateways/eway.rb', line 26

def purchase(money, creditcard, options = {})
  requires_address!(options)

  post = {}
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_id(post)
  add_invoice_data(post, options)
  add_non_optional_data(post)
  add_amount(post, money)
  post[:CustomerEmail] = options[:email]

  commit(purchase_url(post[:CVN]), money, post)
end

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



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/active_merchant/billing/gateways/eway.rb', line 41

def refund(money, authorization, options={})
  post = {}

  add_customer_id(post)
  add_amount(post, money)
  add_non_optional_data(post)
  post[:OriginalTrxnNumber] = authorization
  post[:RefundPassword] = @options[:password]
  post[:CardExpiryMonth] = nil
  post[:CardExpiryYear] = nil

  commit(refund_url, money, post)
end

#scrub(transcript) ⇒ Object



59
60
61
62
63
64
# File 'lib/active_merchant/billing/gateways/eway.rb', line 59

def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
    gsub(%r((<ewayCardNumber>)\d+(</ewayCardNumber>))i, '\1[FILTERED]\2').
    gsub(%r((<ewayCVN>)\d+(</ewayCVN>))i, '\1[FILTERED]\2')
end

#supports_scrubbingObject



55
56
57
# File 'lib/active_merchant/billing/gateways/eway.rb', line 55

def supports_scrubbing
  true
end