Class: PaySimple
- Inherits:
-
Object
- Object
- PaySimple
- Defined in:
- lib/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 using the PaySimple SOAP API. [PaySimple API](www.usaepay.com/developer/docs/beta5)
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.key = "123456"
PaySimple.pin = "topsecret"
PaySimple.client_ip = "192.168.0.1"
Defined Under Namespace
Classes: Subscription
Constant Summary collapse
- VERSION =
"1.0.0"
- WSDL_URL =
File.dirname(__FILE__) + '/usaepay.wsdl'
Class Attribute Summary collapse
-
.client_ip ⇒ Object
Returns the value of attribute client_ip.
-
.key ⇒ Object
Returns the value of attribute key.
-
.pin ⇒ Object
Returns the value of attribute pin.
Class Method Summary collapse
Class Attribute Details
.client_ip ⇒ Object
Returns the value of attribute client_ip.
37 38 39 |
# File 'lib/paysimple.rb', line 37 def client_ip @client_ip end |
.key ⇒ Object
Returns the value of attribute key.
37 38 39 |
# File 'lib/paysimple.rb', line 37 def key @key end |
.pin ⇒ Object
Returns the value of attribute pin.
37 38 39 |
# File 'lib/paysimple.rb', line 37 def pin @pin end |
Class Method Details
.send_request(request, *args) ⇒ Object
249 250 251 252 253 |
# File 'lib/paysimple.rb', line 249 def send_request(request, *args) @driver ||= SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver @driver.["protocol.http.ssl_config.verify_mode"] = nil @driver.send(request, token, *args) end |
.symbolize_hash(hash) ⇒ Object
231 232 233 |
# File 'lib/paysimple.rb', line 231 def symbolize_hash(hash) hash.inject({}) { |h,(k,v)| h[k.to_sym] = v; h } end |
.token ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/paysimple.rb', line 235 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 |