# File lib/active_merchant/billing/gateways/epay.rb, line 83 83: def capture(money, authorization, options = {}) 84: post = {} 85: 86: add_reference(post, authorization) 87: add_amount_without_currency(post, money) 88: 89: commit(:capture, post) 90: end
# File lib/active_merchant/billing/gateways/epay.rb, line 109 109: def credit(money, identification, options = {}) 110: deprecated CREDIT_DEPRECATION_MESSAGE 111: refund(money, identification, options) 112: end
# File lib/active_merchant/billing/gateways/epay.rb, line 72 72: def purchase(money, credit_card_or_reference, options = {}) 73: post = {} 74: 75: add_amount(post, money, options) 76: add_creditcard_or_reference(post, credit_card_or_reference) 77: add_invoice(post, options) 78: add_instant_capture(post, true) 79: 80: commit(:authorize, post) 81: end
# File lib/active_merchant/billing/gateways/epay.rb, line 100 100: def refund(money, identification, options = {}) 101: post = {} 102: 103: add_amount_without_currency(post, money) 104: add_reference(post, identification) 105: 106: commit(:credit, post) 107: end
# File lib/active_merchant/billing/gateways/epay.rb, line 116 116: def add_amount(post, money, options) 117: post[:amount] = amount(money) 118: post[:currency] = CURRENCY_CODES[(options[:currency] || currency(money)).to_sym] 119: end
# File lib/active_merchant/billing/gateways/epay.rb, line 121 121: def add_amount_without_currency(post, money) 122: post[:amount] = amount(money) 123: end
# File lib/active_merchant/billing/gateways/epay.rb, line 133 133: def add_creditcard(post, credit_card) 134: post[:cardno] = credit_card.number 135: post[:cvc] = credit_card.verification_value 136: post[:expmonth] = credit_card.month 137: post[:expyear] = credit_card.year 138: end
# File lib/active_merchant/billing/gateways/epay.rb, line 140 140: def add_creditcard_or_reference(post, credit_card_or_reference) 141: if credit_card_or_reference.respond_to?(:number) 142: add_creditcard(post, credit_card_or_reference) 143: else 144: add_reference(post, credit_card_or_reference.to_s) 145: end 146: end
# File lib/active_merchant/billing/gateways/epay.rb, line 148 148: def add_instant_capture(post, option) 149: post[:instantcapture] = option ? 1 : 0 150: end
# File lib/active_merchant/billing/gateways/epay.rb, line 129 129: def add_invoice(post, options) 130: post[:orderid] = format_order_number(options[:order_id]) 131: end
# File lib/active_merchant/billing/gateways/epay.rb, line 125 125: def add_reference(post, identification) 126: post[:transaction] = identification 127: end
# File lib/active_merchant/billing/gateways/epay.rb, line 152 152: def commit(action, params) 153: response = send("do_#{action}", params) 154: 155: if action == :authorize 156: Response.new response['accept'].to_i == 1, 157: response['errortext'], 158: response, 159: :test => test?, 160: :authorization => response['tid'] 161: else 162: Response.new response['result'] == 'true', 163: messages(response['epay'], response['pbs']), 164: response, 165: :test => test?, 166: :authorization => params[:transaction] 167: end 168: end
# File lib/active_merchant/billing/gateways/epay.rb, line 206 206: def do_capture(params) 207: response = soap_post('capture', params) 208: { 209: 'result' => response.elements['//captureResponse/captureResult'].text, 210: 'pbs' => response.elements['//captureResponse/pbsResponse'].text, 211: 'epay' => response.elements['//captureResponse/epayresponse'].text 212: } 213: end
# File lib/active_merchant/billing/gateways/epay.rb, line 215 215: def do_credit(params) 216: response = soap_post('credit', params) 217: { 218: 'result' => response.elements['//creditResponse/creditResult'].text, 219: 'pbs' => response.elements['//creditResponse/pbsresponse'].text, 220: 'epay' => response.elements['//creditResponse/epayresponse'].text 221: } 222: end
# File lib/active_merchant/billing/gateways/epay.rb, line 224 224: def do_void(params) 225: response = soap_post('delete', params) 226: { 227: 'result' => response.elements['//deleteResponse/deleteResult'].text, 228: 'epay' => response.elements['//deleteResponse/epayresponse'].text 229: } 230: end
Limited to 20 digits max
# File lib/active_merchant/billing/gateways/epay.rb, line 269 269: def format_order_number(number) 270: number.to_s.gsub(/[^\w_]/, '').rjust(4, "0")[0...20] 271: end
# File lib/active_merchant/billing/gateways/epay.rb, line 232 232: def make_headers(data, soap_call) 233: { 234: 'Content-Type' => 'text/xml; charset=utf-8', 235: 'Host' => API_HOST, 236: 'Content-Length' => data.size.to_s, 237: 'SOAPAction' => SOAP_URL + '/' + soap_call 238: } 239: end
# File lib/active_merchant/billing/gateways/epay.rb, line 170 170: def messages(epay, pbs = nil) 171: response = "ePay: #{epay}" 172: response << " PBS: #{pbs}" if pbs 173: return response 174: end
# File lib/active_merchant/billing/gateways/epay.rb, line 176 176: def soap_post(method, params) 177: data = xml_builder(params, method) 178: headers = make_headers(data, method) 179: REXML::Document.new(ssl_post('https://' + API_HOST + '/remote/payment.asmx', data, headers)) 180: end
# File lib/active_merchant/billing/gateways/epay.rb, line 241 241: def xml_builder(params, soap_call) 242: xml = Builder::XmlMarkup.new(:indent => 2) 243: xml.instruct! 244: xml.tag! 'soap:Envelope', { 'xmlns:xsi' => 'http://schemas.xmlsoap.org/soap/envelope/', 245: 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 246: 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' } do 247: xml.tag! 'soap:Body' do 248: xml.tag! soap_call, { 'xmlns' => SOAP_URL } do 249: xml.tag! 'merchantnumber', @options[:login] 250: xml.tag! 'transactionid', params[:transaction] 251: xml.tag! 'amount', params[:amount].to_s if soap_call != 'delete' 252: end 253: end 254: end 255: xml.target! 256: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.