class ActiveMerchant::Billing::BarclaysEpdqGateway
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
ActiveMerchant::Billing::Gateway::new
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 14 def initialize(options = {}) requires!(options, :login, :password, :client_id) super end
Public Instance Methods
capture(money, authorization, options = {})
click to toggle source
authorization is your unique order ID, not the authorization code returned by ePDQ
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 52 def capture(money, authorization, options = {}) document = Document.new(self, @options) do add_order_form(authorization) do add_transaction(:PostAuth, money) end end commit(document) end
credit(money, creditcard_or_authorization, options = {})
click to toggle source
authorization is your unique order ID, not the authorization code returned by ePDQ
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 64 def credit(money, creditcard_or_authorization, options = {}) if creditcard_or_authorization.is_a?(String) ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE refund(money, creditcard_or_authorization, options) else credit_new_order(money, creditcard_or_authorization, options) end end
purchase(money, creditcard, options = {})
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 32 def purchase(money, creditcard, options = {}) # disable fraud checks if this is a repeat order: if options[:payment_number] && (options[:payment_number] > 1) no_fraud = true else no_fraud = options[:no_fraud] end document = Document.new(self, @options, :no_fraud => no_fraud) do add_order_form(options[:order_id], options[:group_id]) do add_consumer(options) do add_creditcard(creditcard) end add_transaction(:Auth, money, options) end end commit(document) end
refund(money, authorization, options = {})
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 73 def refund(money, authorization, options = {}) credit_existing_order(money, authorization, options) end
void(authorization, options = {})
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 77 def void(authorization, options = {}) document = Document.new(self, @options) do add_order_form(authorization) do add_transaction(:Void) end end commit(document) end
Private Instance Methods
commit(document)
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 125 def commit(document) url = (test? ? self.test_url : self.live_url) data = ssl_post(url, document.to_xml) parse(data) end
credit_existing_order(money, authorization, options)
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 101 def credit_existing_order(money, authorization, options) order_id, _ = authorization.split(":") document = Document.new(self, @options) do add_order_form(order_id) do add_transaction(:Credit, money) end end commit(document) end
credit_new_order(money, creditcard, options)
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 88 def credit_new_order(money, creditcard, options) document = Document.new(self, @options) do add_order_form do add_consumer(options) do add_creditcard(creditcard) end add_transaction(:Credit, money) end end commit(document) end
parse(body)
click to toggle source
# File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 112 def parse(body) parser = Parser.new(body) response = parser.parse Response.new(response[:success], response[:message], response, :test => test?, :authorization => response[:authorization], :avs_result => response[:avsresponse], :cvv_result => response[:cvv_result], :order_id => response[:order_id], :raw_response => response[:raw_response] ) end