Class Index [+]

Quicksearch

ActiveMerchant::Billing::SecurePayTechGateway

Constants

URL
PAYMENT_GATEWAY_RESPONSES

Public Class Methods

new(options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 28
28:       def initialize(options = {})
29:         requires!(options, :login, :password)
30:         @options = options
31:         super
32:       end

Public Instance Methods

purchase(money, creditcard, options = {}) click to toggle source
    # 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

Private Instance Methods

add_creditcard(post, creditcard) click to toggle source
    # 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
add_invoice(post, money, options) click to toggle source
    # 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
commit(action, post) click to toggle source
    # 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
expdate(creditcard) click to toggle source
     # 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
message_from(result) click to toggle source
    # 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
parse(body) click to toggle source
    # 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
post_data(action, post) click to toggle source
     # File lib/active_merchant/billing/gateways/secure_pay_tech.rb, line 98
 98:       def post_data(action, post)
 99:         post[:MerchantID] = @options[:login]
100:         post[:MerchantKey] = @options[:password]
101:         post.to_s
102:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.