Skip to content

Instantly share code, notes, and snippets.

View nickcoyne's full-sized avatar
👾

Nick Coyne nickcoyne

👾
View GitHub Profile
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /usr/www/users/sarahw/blog/wp-includes/media.php on line 1006
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /usr/www/users/sarahw/blog/wp-includes/media.php on line 424
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/www/users/sarahw/blog/wp-includes/media.php on line 455
@nickcoyne
nickcoyne / paygate.rb
Created October 16, 2009 05:56
Paygate gateway for ActiveMerchant
require 'rexml/document'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# Paygate is one of the leading CC gateways in South Africa
# see http://www.paygate.co.za
# Contributed by Nick Coyne (http://www.codevader.com)
class PaygateGateway < Gateway
URL = 'https://www.paygate.co.za/payxml/process.trans'
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!