Class: ActiveMerchant::Billing::MerchantWareVersionFourGateway
- Defined in:
- lib/active_merchant/billing/gateways/merchant_ware_version_four.rb
Constant Summary collapse
- ENV_NAMESPACES =
{ '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://schemas.merchantwarehouse.com/merchantware/40/Credit/'
- ACTIONS =
{ purchase: 'SaleKeyed', reference_purchase: 'RepeatSale', authorize: 'PreAuthorizationKeyed', capture: 'PostAuthorization', void: 'Void', refund: 'Refund' }
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, 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.
-
#initialize(options = {}) ⇒ MerchantWareVersionFourGateway
constructor
Creates a new MerchantWareVersionFourGateway.
-
#purchase(money, payment_source, options = {}) ⇒ Object
Authorize and immediately capture funds from a credit card.
-
#refund(money, identification, options = {}) ⇒ Object
Refund an amount back a cardholder.
- #scrub(transcript) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
- #verify(credit_card, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Void a transaction.
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ MerchantWareVersionFourGateway
Creates a new MerchantWareVersionFourGateway
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.
37 38 39 40 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 37 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.
-
50 51 52 53 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 50 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.
74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 74 def capture(money, , = {}) request = build_capture_request(:capture, money, , ) commit(:capture, request) end |
#purchase(money, payment_source, options = {}) ⇒ Object
Authorize and immediately capture funds from a credit card.
Parameters
-
money
- The amount to be authorized as anInteger value in cents. -
payment_source
- The CreditCard details or ‘token’ from prior transaction -
options
-
:order_id
- A unique reference for this order (required). -
:billing_address
- The billing address for the cardholder.
-
63 64 65 66 67 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 63 def purchase(money, payment_source, = {}) action = payment_source.is_a?(String) ? :reference_purchase : :purchase request = build_purchase_request(action, money, payment_source, ) commit(action, request) end |
#refund(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)
-
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 99 def refund(money, identification, = {}) reference, [:order_id] = split_reference(identification) request = soap_request(:refund) do |xml| add_reference_token(xml, reference) add_invoice(xml, ) add_amount(xml, money, 'overrideAmount') end commit(:refund, request) end |
#scrub(transcript) ⇒ Object
122 123 124 125 126 127 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 122 def scrub(transcript) transcript. gsub(%r((<merchantKey>).+?(</merchantKey>))i, '\1[FILTERED]\2'). gsub(%r((<cardNumber>).+?(</cardNumber>))i, '\1[FILTERED]\2'). gsub(%r((<cardSecurityCode>).+?(</cardSecurityCode>))i, '\1[FILTERED]\2') end |
#supports_scrubbing? ⇒ Boolean
118 119 120 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 118 def supports_scrubbing? true end |
#verify(credit_card, options = {}) ⇒ Object
111 112 113 114 115 116 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 111 def verify(credit_card, = {}) MultiResponse.run(:use_first_response) do |r| r.process { (100, credit_card, ) } r.process(:ignore_result) { void(r., ) } end end |
#void(authorization, options = {}) ⇒ Object
Void a transaction.
Parameters
-
authorization
- The authorization string returned from the initial authorization or purchase.
83 84 85 86 87 88 89 |
# File 'lib/active_merchant/billing/gateways/merchant_ware_version_four.rb', line 83 def void(, = {}) reference, [:order_id] = split_reference() request = soap_request(:void) do |xml| add_reference_token(xml, reference) end commit(:void, request) end |