Payment API Version
Transactions hash
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 82 82: def capture(money, authorization, options = {}) 83: requires!(options, :order_id) 84: post = {} 85: add_invoice(post, options) 86: post[:numappel] = authorization[0,10] 87: post[:numtrans] = authorization[10,10] 88: commit('capture', money, post) 89: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 101 101: def credit(money, identification, options = {}) 102: deprecated CREDIT_DEPRECATION_MESSAGE 103: refund(money, identification, options) 104: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 75 75: def purchase(money, creditcard, options = {}) 76: post = {} 77: add_invoice(post, options) 78: add_creditcard(post, creditcard) 79: commit('purchase', money, post) 80: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 106 106: def refund(money, identification, options = {}) 107: post = {} 108: add_invoice(post, options) 109: add_reference(post, identification) 110: commit('refund', money, post) 111: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 113 113: def test? 114: @options[:test] || Base.gateway_mode == :test 115: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 91 91: def void(identification, options = {}) 92: requires!(options, :order_id, :amount) 93: post ={} 94: add_invoice(post, options) 95: add_reference(post, identification) 96: post[:porteur] = '000000000000000' 97: post[:dateval] = '0000' 98: commit('void', options[:amount], post) 99: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 123 123: def add_creditcard(post, creditcard) 124: post[:porteur] = creditcard.number 125: post[:dateval] = expdate(creditcard) 126: post[:cvv] = creditcard.verification_value if creditcard.verification_value? 127: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 119 119: def add_invoice(post, options) 120: post[:reference] = options[:order_id] 121: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 129 129: def add_reference(post, identification) 130: post[:numappel] = identification[0,10] 131: post[:numtrans] = identification[10,10] 132: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 144 144: def commit(action, money = nil, parameters = nil) 145: parameters[:montant] = ('0000000000' + (money ? amount(money) : ''))[10..1] 146: parameters[:devise] = CURRENCY_CODES[options[:currency] || currency(money)] 147: request_data = post_data(action,parameters) 148: response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, request_data)) 149: response = parse(ssl_post(LIVE_URL_BACKUP, request_data)) if service_unavailable?(response) && !test? 150: Response.new(success?(response), message_from(response), response.merge( 151: :timestamp => parameters[:dateq]), 152: :test => test?, 153: :authorization => response[:numappel].to_s + response[:numtrans].to_s, 154: :fraud_review => fraud_review?(response), 155: :sent_params => parameters.delete_if{|key,value| ['porteur','dateval','cvv'].include?(key.to_s)} 156: ) 157: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 198 198: def expdate(credit_card) 199: year = sprintf("%.4i", credit_card.year) 200: month = sprintf("%.2i", credit_card.month) 201: 202: "#{month}#{year[-2..-1]}" 203: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 163 163: def fraud_review?(response) 164: FRAUD_CODES.include?(response[:codereponse]) 165: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 171 171: def message_from(response) 172: success?(response) ? SUCCESS_MESSAGE : (response[:commentaire] || FAILURE_MESSAGE) 173: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 134 134: def parse(body) 135: body = Iconv.iconv("UTF-8","LATIN1", body.to_s).join 136: results = {} 137: body.split(/&/).each do |pair| 138: key,val = pair.split(/\=/) 139: results[key.downcase.to_sym] = CGI.unescape(val) if val 140: end 141: results 142: end
# File lib/active_merchant/billing/gateways/paybox_direct.rb, line 175 175: def post_data(action, parameters = {}) 176: 177: parameters.update( 178: :version => API_VERSION, 179: :type => TRANSACTIONS[action.to_sym], 180: :dateq => Time.now.strftime('%d%m%Y%H%M%S'), 181: :numquestion => unique_id(parameters[:order_id]), 182: :site => @options[:login].to_s[0,7], 183: :rang => @options[:login].to_s[7..1], 184: :cle => @options[:password], 185: :pays => '', 186: :archivage => parameters[:order_id] 187: ) 188: 189: parameters.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join("&") 190: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.