# File lib/active_merchant/billing/gateways/exact.rb, line 43 43: def initialize(options = {}) 44: requires!(options, :login, :password) 45: @options = options 46: 47: if TEST_LOGINS.include?( { :login => options[:login], :password => options[:password] } ) 48: @test_mode = true 49: end 50: 51: super 52: end
# File lib/active_merchant/billing/gateways/exact.rb, line 66 66: def capture(money, authorization, options = {}) 67: commit(:capture, build_capture_or_credit_request(money, authorization, options)) 68: end
# File lib/active_merchant/billing/gateways/exact.rb, line 70 70: def credit(money, authorization, options = {}) 71: deprecated CREDIT_DEPRECATION_MESSAGE 72: refund(money, authorization, options) 73: end
# File lib/active_merchant/billing/gateways/exact.rb, line 62 62: def purchase(money, credit_card, options = {}) 63: commit(:sale, build_sale_or_authorization_request(money, credit_card, options)) 64: end
# File lib/active_merchant/billing/gateways/exact.rb, line 156 156: def add_address(xml, options) 157: if address = options[:billing_address] || options[:address] 158: xml.tag! 'ZipCode', address[:zip] 159: end 160: end
# File lib/active_merchant/billing/gateways/exact.rb, line 135 135: def add_amount(xml, money) 136: xml.tag! 'DollarAmount', amount(money) 137: end
# File lib/active_merchant/billing/gateways/exact.rb, line 119 119: def add_credentials(xml) 120: xml.tag! 'ExactID', @options[:login] 121: xml.tag! 'Password', @options[:password] 122: end
# File lib/active_merchant/billing/gateways/exact.rb, line 139 139: def add_credit_card(xml, credit_card) 140: xml.tag! 'Card_Number', credit_card.number 141: xml.tag! 'Expiry_Date', expdate(credit_card) 142: xml.tag! 'CardHoldersName', credit_card.name 143: 144: if credit_card.verification_value? 145: xml.tag! 'CVD_Presence_Ind', '1' 146: xml.tag! 'VerificationStr2', credit_card.verification_value 147: end 148: end
# File lib/active_merchant/billing/gateways/exact.rb, line 150 150: def add_customer_data(xml, options) 151: xml.tag! 'Customer_Ref', options[:customer] 152: xml.tag! 'Client_IP', options[:ip] 153: xml.tag! 'Client_Email', options[:email] 154: end
# File lib/active_merchant/billing/gateways/exact.rb, line 128 128: def add_identification(xml, identification) 129: authorization_num, transaction_tag = identification.split(';') 130: 131: xml.tag! 'Authorization_Num', authorization_num 132: xml.tag! 'Transaction_Tag', transaction_tag 133: end
# File lib/active_merchant/billing/gateways/exact.rb, line 162 162: def add_invoice(xml, options) 163: xml.tag! 'Reference_No', options[:order_id] 164: xml.tag! 'Reference_3', options[:description] 165: end
# File lib/active_merchant/billing/gateways/exact.rb, line 124 124: def add_transaction_type(xml, action) 125: xml.tag! 'Transaction_Type', TRANSACTIONS[action] 126: end
# File lib/active_merchant/billing/gateways/exact.rb, line 109 109: def build_capture_or_credit_request(money, identification, options) 110: xml = Builder::XmlMarkup.new 111: 112: add_identification(xml, identification) 113: add_amount(xml, money) 114: add_customer_data(xml, options) 115: 116: xml.target! 117: end
# File lib/active_merchant/billing/gateways/exact.rb, line 80 80: def build_request(action, body) 81: xml = Builder::XmlMarkup.new 82: 83: xml.instruct! 84: xml.tag! 'env:Envelope', ENVELOPE_NAMESPACES do 85: xml.tag! 'env:Body' do 86: xml.tag! 'n1:SendAndCommit', SEND_AND_COMMIT_ATTRIBUTES do 87: xml.tag! 'SendAndCommitSource', SEND_AND_COMMIT_SOURCE_ATTRIBUTES do 88: add_credentials(xml) 89: add_transaction_type(xml, action) 90: xml << body 91: end 92: end 93: end 94: end 95: xml.target! 96: end
# File lib/active_merchant/billing/gateways/exact.rb, line 171 171: def commit(action, request) 172: response = parse(ssl_post(URL, build_request(action, request), POST_HEADERS)) 173: 174: Response.new(successful?(response), message_from(response), response, 175: :test => test?, 176: :authorization => authorization_from(response), 177: :avs_result => { :code => response[:avs] }, 178: :cvv_result => response[:cvv2] 179: ) 180: end
# File lib/active_merchant/billing/gateways/exact.rb, line 167 167: def expdate(credit_card) 168: "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}" 169: end
# File lib/active_merchant/billing/gateways/exact.rb, line 194 194: def message_from(response) 195: if response[:faultcode] && response[:faultstring] 196: response[:faultstring] 197: elsif response[:error_number] != '0' 198: response[:error_description] 199: else 200: result = response[:exact_message] || '' 201: result << " - #{response[:bank_message]}" unless response[:bank_message].blank? 202: result 203: end 204: end
# File lib/active_merchant/billing/gateways/exact.rb, line 206 206: def parse(xml) 207: response = {} 208: xml = REXML::Document.new(xml) 209: 210: if root = REXML::XPath.first(xml, "//types:TransactionResult") 211: parse_elements(response, root) 212: elsif root = REXML::XPath.first(xml, "//soap:Fault") 213: parse_elements(response, root) 214: end 215: 216: response.delete_if{ |k,v| SENSITIVE_FIELDS.include?(k) } 217: end
# File lib/active_merchant/billing/gateways/exact.rb, line 219 219: def parse_elements(response, root) 220: root.elements.to_a.each do |node| 221: response[node.name.gsub(/EXact/, 'Exact').underscore.to_sym] = (node.text || '').strip 222: end 223: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.