# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 34 34: def purchase(money, creditcard, options = {}) 35: post = SecurePayTechPostData.new 36: 37: add_invoice(post, money, options) 38: add_creditcard(post, creditcard) 39: 40: commit(:purchase, post) 41: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 52 52: def add_creditcard(post, creditcard) 53: post[:CardNumber] = creditcard.number 54: post[:CardExpiry] = expdate(creditcard) 55: post[:CardHolderName] = creditcard.name 56: 57: if creditcard.verification_value? 58: post[:EnableCSC] = 1 59: post[:CSC] = creditcard.verification_value 60: end 61: 62: # SPT will autodetect this 63: post[:CardType] = 0 64: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 45 45: def add_invoice(post, money, options) 46: post[:Amount] = amount(money) 47: post[:Currency] = options[:currency] || currency(money) 48: 49: post[:OrderReference] = options[:order_id] 50: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 85 85: def commit(action, post) 86: response = parse( ssl_post(URL, post_data(action, post) ) ) 87: 88: Response.new(response[:result_code] == 1, message_from(response), response, 89: :test => test?, 90: :authorization => response[:merchant_transaction_reference] 91: ) 92: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 104 104: def expdate(creditcard) 105: year = sprintf("%.4i", creditcard.year) 106: month = sprintf("%.2i", creditcard.month) 107: 108: "#{month}#{year[-2..-1]}" 109: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 94 94: def message_from(result) 95: PAYMENT_GATEWAY_RESPONSES[result[:result_code]] 96: end
# File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 66 66: def parse(body) 67: response = CGI.unescape(body).split(',') 68: 69: result = {} 70: result[:result_code] = response[0].to_i 71: 72: if response.length == 2 73: result[:fail_reason] = response[1] 74: else 75: result[:merchant_transaction_reference] = response[1] 76: result[:receipt_number] = response[2] 77: result[:transaction_number] = response[3] 78: result[:authorisation_id] = response[4] 79: result[:batch_number] = response[5] 80: end 81: 82: result 83: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.