0 Standard Payment 4 Refund 6 Client Reversal (Void) 10 Preauthorise 11 Preauth Complete (Advice)
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 61 61: def capture(money, reference, options = {}) 62: commit :capture, build_reference_request(money, reference) 63: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 69 69: def credit(money, reference, options = {}) 70: deprecated CREDIT_DEPRECATION_MESSAGE 71: refund(money, reference) 72: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 51 51: def purchase(money, credit_card, options = {}) 52: requires!(options, :order_id) 53: commit :purchase, build_purchase_request(money, credit_card, options) 54: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 65 65: def refund(money, reference, options = {}) 66: commit :refund, build_reference_request(money, reference) 67: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 80 80: def build_purchase_request(money, credit_card, options) 81: xml = Builder::XmlMarkup.new 82: 83: xml.tag! 'amount', amount(money) 84: xml.tag! 'currency', options[:currency] || currency(money) 85: xml.tag! 'purchaseOrderNo', options[:order_id].to_s.gsub(/[ ']/, '') 86: 87: xml.tag! 'CreditCardInfo' do 88: xml.tag! 'cardNumber', credit_card.number 89: xml.tag! 'expiryDate', expdate(credit_card) 90: xml.tag! 'cvv', credit_card.verification_value if credit_card.verification_value? 91: end 92: 93: xml.target! 94: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 96 96: def build_reference_request(money, reference) 97: xml = Builder::XmlMarkup.new 98: 99: transaction_id, order_id, preauth_id, original_amount = reference.split("*") 100: xml.tag! 'amount', (money ? amount(money) : original_amount) 101: xml.tag! 'currency', options[:currency] || currency(money) 102: xml.tag! 'txnID', transaction_id 103: xml.tag! 'purchaseOrderNo', order_id 104: xml.tag! 'preauthID', preauth_id 105: 106: xml.target! 107: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 109 109: def build_request(action, body) 110: xml = Builder::XmlMarkup.new 111: xml.instruct! 112: xml.tag! 'SecurePayMessage' do 113: xml.tag! 'MessageInfo' do 114: xml.tag! 'messageID', Utils.generate_unique_id.slice(0, 30) 115: xml.tag! 'messageTimestamp', generate_timestamp 116: xml.tag! 'timeoutValue', request_timeout 117: xml.tag! 'apiVersion', API_VERSION 118: end 119: 120: xml.tag! 'MerchantInfo' do 121: xml.tag! 'merchantID', @options[:login] 122: xml.tag! 'password', @options[:password] 123: end 124: 125: xml.tag! 'RequestType', 'Payment' 126: xml.tag! 'Payment' do 127: xml.tag! 'TxnList', "count" => 1 do 128: xml.tag! 'Txn', "ID" => 1 do 129: xml.tag! 'txnType', TRANSACTIONS[action] 130: xml.tag! 'txnSource', 23 131: xml << body 132: end 133: end 134: end 135: end 136: 137: xml.target! 138: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 140 140: def commit(action, request) 141: response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, build_request(action, request))) 142: 143: Response.new(success?(response), message_from(response), response, 144: :test => test?, 145: :authorization => authorization_from(response) 146: ) 147: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 161 161: def expdate(credit_card) 162: "#{format(credit_card.month, :two_digits)}/#{format(credit_card.year, :two_digits)}" 163: end
YYYYDDMMHHNNSSKKK000sOOO
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 186 186: def generate_timestamp 187: time = Time.now.utc 188: time.strftime("%Y%d%m%H%M%S#{time.usec}+000") 189: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 157 157: def message_from(response) 158: response[:response_text] || response[:status_description] 159: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 165 165: def parse(body) 166: xml = REXML::Document.new(body) 167: 168: response = {} 169: 170: xml.root.elements.to_a.each do |node| 171: parse_element(response, node) 172: end 173: 174: response 175: end
# File lib/active_merchant/billing/gateways/secure_pay_au.rb, line 177 177: def parse_element(response, node) 178: if node.has_elements? 179: node.elements.each{|element| parse_element(response, element) } 180: else 181: response[node.name.underscore.to_sym] = node.text 182: end 183: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.