Class: ActiveMerchant::Billing::WirecardGateway

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

Constant Summary collapse

ENVELOPE_NAMESPACES =

The Namespaces are not really needed, because it just tells the System, that there’s actually no namespace used. It’s just specified here for completeness.

{
  'xmlns:xsi' => 'http://www.w3.org/1999/XMLSchema-instance',
  'xsi:noNamespaceSchemaLocation' => 'wirecard.xsd'
}
PERMITTED_TRANSACTIONS =
%w[ PREAUTHORIZATION CAPTURE PURCHASE ]
RETURN_CODES =
%w[ ACK NOK ]
VALID_PHONE_FORMAT =

Wirecard only allows phone numbers with a format like this: +xxx(yyy)zzz-zzzz-ppp, where:

xxx = Country code
yyy = Area or city code
zzz-zzzz = Local number
ppp = PBX extension

For example, a typical U.S. or Canadian number would be “+1(202)555-1234-739” indicating PBX extension 739 at phone number 5551234 within area code 202 (country code 1).

/\+\d{1,3}(\(?\d{3}\)?)?\d{3}-\d{4}-\d{3}/

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?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ WirecardGateway

Public: Create a new Wirecard gateway.

options - A hash of options:

:login         - The username
:password      - The password
:signature     - The BusinessCaseSignature


42
43
44
45
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 42

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

Instance Method Details

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



47
48
49
50
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 47

def authorize(money, creditcard, options = {})
  options[:credit_card] = creditcard
  commit(:preauthorization, money, options)
end

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



52
53
54
55
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 52

def capture(money, authorization, options = {})
  options[:preauthorization] = authorization
  commit(:capture, money, options)
end

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



57
58
59
60
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 57

def purchase(money, creditcard, options = {})
  options[:credit_card] = creditcard
  commit(:purchase, money, options)
end

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



67
68
69
70
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 67

def refund(money, identification, options = {})
  options[:preauthorization] = identification
  commit(:bookback, money, options)
end

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



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

def void(identification, options = {})
  options[:preauthorization] = identification
  commit(:reversal, nil, options)
end