Class: ActiveMerchant::Billing::WirecardGateway
- 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, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, payment_method, options = {}) ⇒ Object
Authorization - the second parameter may be a CreditCard or a String which represents a GuWID reference to an earlier transaction.
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ WirecardGateway
constructor
Public: Create a new Wirecard gateway.
-
#purchase(money, payment_method, options = {}) ⇒ Object
Purchase - the second parameter may be a CreditCard or a String which represents a GuWID reference to an earlier transaction.
- #refund(money, identification, options = {}) ⇒ Object
-
#store(creditcard, options = {}) ⇒ Object
Store card - Wirecard supports the notion of “Recurring Transactions” by allowing the merchant to provide a reference to an earlier transaction (the GuWID) rather than a credit card.
- #void(identification, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
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( = {}) requires!(, :login, :password, :signature) super end |
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
Authorization - the second parameter may be a CreditCard or a String which represents a GuWID reference to an earlier transaction. If a GuWID is given, rather than a CreditCard, then then the :recurring option will be forced to “Repeated”
51 52 53 54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 51 def (money, payment_method, = {}) if payment_method.respond_to?(:number) [:credit_card] = payment_method else [:preauthorization] = payment_method end commit(:preauthorization, money, ) end |
#capture(money, authorization, options = {}) ⇒ Object
60 61 62 63 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 60 def capture(money, , = {}) [:preauthorization] = commit(:capture, money, ) end |
#purchase(money, payment_method, options = {}) ⇒ Object
Purchase - the second parameter may be a CreditCard or a String which represents a GuWID reference to an earlier transaction. If a GuWID is given, rather than a CreditCard, then then the :recurring option will be forced to “Repeated”
69 70 71 72 73 74 75 76 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 69 def purchase(money, payment_method, = {}) if payment_method.respond_to?(:number) [:credit_card] = payment_method else [:preauthorization] = payment_method end commit(:purchase, money, ) end |
#refund(money, identification, options = {}) ⇒ Object
83 84 85 86 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 83 def refund(money, identification, = {}) [:preauthorization] = identification commit(:bookback, money, ) end |
#store(creditcard, options = {}) ⇒ Object
Store card - Wirecard supports the notion of “Recurring Transactions” by allowing the merchant to provide a reference to an earlier transaction (the GuWID) rather than a credit card. A reusable reference (GuWID) can be obtained by sending a purchase or authorization transaction with the element “RECURRING_TRANSACTION/Type” set to “Initial”. Subsequent transactions can then use the GuWID in place of a credit card by setting “RECURRING_TRANSACTION/Type” to “Repeated”.
This implementation of card store utilizes a Wirecard “Authorization Check” (a Preauthorization that is automatically reversed). It defaults to a check amount of “100” (i.e. $1.00) but this can be overriden (see below).
IMPORTANT: In order to reuse the stored reference, the authorization
from the response should be saved by your application code.
Options specific to store
-
:amount
– The amount, in cents, that should be “validated” by the Authorization Check. This amount will be reserved and then reversed. Default is 100.
Note: This is not the only way to achieve a card store operation at Wirecard. Any purchase
or authorize
can be sent with options = ‘Initial’ to make the returned authorization/GuWID usable in later transactions with options = ‘Repeated’.
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 117 def store(creditcard, = {}) [:credit_card] = creditcard [:recurring] = 'Initial' money = .delete(:amount) || 100 # Amex does not support authorization_check if creditcard.brand == 'american_express' commit(:preauthorization, money, ) else commit(:authorization_check, money, ) end end |
#void(identification, options = {}) ⇒ Object
78 79 80 81 |
# File 'lib/active_merchant/billing/gateways/wirecard.rb', line 78 def void(identification, = {}) [:preauthorization] = identification commit(:reversal, nil, ) end |