Class: ActiveMerchant::Billing::MerchantWareGateway
- Defined in:
- lib/active_merchant/billing/gateways/merchant_ware.rb
Constant Summary collapse
- ENV_NAMESPACES =
{ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", "xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/" }
- ENV_NAMESPACES_V4 =
{ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", "xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/" }
- TX_NAMESPACE =
"http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail"
- TX_NAMESPACE_V4 =
"http://schemas.merchantwarehouse.com/merchantware/40/Credit/"
- ACTIONS =
{ :purchase => "IssueKeyedSale", :authorize => "IssueKeyedPreAuth", :capture => "IssuePostAuth", :void => "VoidPreAuthorization", :credit => "IssueKeyedRefund", :reference_credit => "IssueRefundByReference" }
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, credit_card, options = {}) ⇒ Object
Authorize a credit card for a given amount.
-
#capture(money, authorization, options = {}) ⇒ Object
Capture authorized funds from a credit card.
-
#credit(money, identification, options = {}) ⇒ Object
Refund an amount back a cardholder.
-
#initialize(options = {}) ⇒ MerchantWareGateway
constructor
Creates a new MerchantWareGateway.
-
#purchase(money, credit_card, options = {}) ⇒ Object
Authorize and immediately capture funds from a credit card.
- #refund(money, reference, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Void a transaction.
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 = {}) ⇒ MerchantWareGateway
Creates a new MerchantWareGateway
The gateway requires that a valid login, password, and name be passed in the options
hash.
Options
-
:login
- The MerchantWARE SiteID. -
:password
- The MerchantWARE Key. -
:name
- The MerchantWARE Name.
45 46 47 48 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 45 def initialize( = {}) requires!(, :login, :password, :name) super end |
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
Authorize a credit card for a given amount.
Parameters
-
money
- The amount to be authorized as an Integer value in cents. -
credit_card
- The CreditCard details for the transaction. -
options
-
:order_id
- A unique reference for this order (required). -
:billing_address
- The billing address for the cardholder.
-
58 59 60 61 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 58 def (money, credit_card, = {}) request = build_purchase_request(:authorize, money, credit_card, ) commit(:authorize, request) end |
#capture(money, authorization, options = {}) ⇒ Object
Capture authorized funds from a credit card.
Parameters
-
money
- The amount to be captured as anInteger value in cents. -
authorization
- The authorization string returned from the initial authorization.
81 82 83 84 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 81 def capture(money, , = {}) request = build_capture_request(:capture, money, , ) commit(:capture, request) end |
#credit(money, identification, options = {}) ⇒ Object
Refund an amount back a cardholder
Parameters
-
money
- The amount to be refunded as an Integer value in cents. -
identification
- The credit card you want to refund or the authorization for the existing transaction you are refunding. -
options
-
:order_id
- A unique reference for this order (required when performing a non-referenced credit)
-
106 107 108 109 110 111 112 113 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 106 def credit(money, identification, = {}) if identification.is_a?(String) ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE refund(money, identification, ) else perform_credit(money, identification, ) end end |
#purchase(money, credit_card, options = {}) ⇒ Object
Authorize and immediately capture funds from a credit card.
Parameters
-
money
- The amount to be authorized as anInteger value in cents. -
credit_card
- The CreditCard details for the transaction. -
options
-
:order_id
- A unique reference for this order (required). -
:billing_address
- The billing address for the cardholder.
-
71 72 73 74 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 71 def purchase(money, credit_card, = {}) request = build_purchase_request(:purchase, money, credit_card, ) commit(:purchase, request) end |
#refund(money, reference, options = {}) ⇒ Object
115 116 117 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 115 def refund(money, reference, = {}) perform_reference_credit(money, reference, ) end |
#void(authorization, options = {}) ⇒ Object
Void a transaction.
Parameters
-
authorization
- The authorization string returned from the initial authorization or purchase.
90 91 92 93 94 95 96 |
# File 'lib/active_merchant/billing/gateways/merchant_ware.rb', line 90 def void(, = {}) reference, [:order_id] = split_reference() request = v4_soap_request(:void) do |xml| add_reference_token(xml, reference) end commit(:void, request, true) end |