Class: PaySimple

Inherits:
Object
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/paysimple/paysimple.rb

Overview

[PaySimple](www.paysimple.com) is a payment gateway providing credit card processing, check processing and recurring / subscription billing services.

This library provides a simple interface to find, create, edit, delete, and query subscriptions and single transactions using the PaySimple SOAP API. [PaySimple API](www.usaepay.com/developer/docs/beta6)

Installation

The simple way:

$ sudo gem install paysimple

Directly from repository:

$ ./script/plugin install svn://svn.roundhaus.com/daikini/plugins/paysimple

Directly from repository using piston:

$ piston import svn://svn.roundhaus.com/daikini/plugins/paysimple vendor/plugins/paysimple

Configuration

When you signup for a PaySimple account you can setup a source key and optionally a pin and client ip address. These are your credentials when using the PaySimple API.

PaySimple.source = "My API Source Key Name"
PaySimple.key = "123456"
PaySimple.pin = "topsecret"
PaySimple.client_ip = "192.168.0.1"

Defined Under Namespace

Classes: Subscription, Transaction

Constant Summary collapse

VERSION =
"1.1.0"
WSDL_URL =
File.dirname(__FILE__) + '/usaepay.wsdl'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.client_ipObject

Returns the value of attribute client_ip.



38
39
40
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 38

def client_ip
  @client_ip
end

.keyObject

Returns the value of attribute key.



38
39
40
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 38

def key
  @key
end

.pinObject

Returns the value of attribute pin.



38
39
40
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 38

def pin
  @pin
end

.sourceObject

Returns the value of attribute source.



38
39
40
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 38

def source
  @source
end

Class Method Details

.send_request(request, *args) ⇒ Object



327
328
329
330
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 327

def send_request(request, *args)
  @driver ||= SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
  @driver.send(request, token, *args)
end

.symbolize_hash(hash) ⇒ Object



309
310
311
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 309

def symbolize_hash(hash)
  hash.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
end

.tokenObject



313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/active_merchant/billing/gateways/paysimple/paysimple.rb', line 313

def token
  seed = "#{Time.now.to_i}#{rand(999999)}"
  hash = Digest::SHA1.hexdigest([key, seed, pin].join)
  { 
    'SourceKey' => key,
    'PinHash' => {
      'Type' => "sha1",
      'Seed' => seed,
      'HashValue' => hash
    },
    'ClientIP' => client_ip
  }
end