Class: TrustCommerce

Inherits:
Object
  • Object
show all
Defined in:
lib/trustcommerce.rb,
lib/version.rb

Overview

[TrustCommerce](www.trustcommerce.com) is a payment gateway providing credit card processing and recurring / subscription billing services.

This library provides a simple interface to create, edit, delete, and query subscriptions using TrustCommerce.

Background

TrustCommerce’s recurring / subscription billing solution is implemented through a service called [Citadel](www.trustcommerce.com/citadel.php). A Citadel-enabled account is required to use the subscription-based features implemented by this library.

Citadel Basics

  • Citadel stores customer profiles which can include credit card information and billing frequency.

  • Citadel will automatically bill customers on their respective schedules.

  • Citadel identifies each customer by a Billing ID (six-character alphanumeric string).

  • A customer’s profile, credit card, and billing frequency can be modified using the Billing ID.

Installation

The simple way:

$ sudo gem install trustcommerce

Directly from repository:

$ svn co svn://rubyforge.org/var/svn/trustcommerce/trunk trustcommerce

It is highly recommended to download and install the [TCLink ruby extension](www.trustcommerce.com/tclink.php). This extension provides failover capability and enhanced security features. If this library is not installed, standard POST over SSL will be used.

Configuration

When you signup for a TrustCommerce account you are issued a custid and a password. These are your credentials when using the TrustCommerce API.

TrustCommerce.custid   = '123456'
TrustCommerce.password = 'topsecret'

# optional - sets Vault password for use in query() calls
TrustCommerce.vault_password = 'supersecure'

The password that TrustCommerce issues never changes or expires when used through the TCLink extension. However if you choose to use SSL over HTTP instead (the fallback option if the TCLink library is not installed), be aware that you need to set the password to your Vault password. Likewise, if your application uses the query() method you must set the vault_password. The reason is that TrustCommerce currently routes these query() calls through the vault and therefore your password must be set accordingly. To make matters more complicated, TrustCommerce currently forces you to change the Vault password every 90 days.

Defined Under Namespace

Modules: VERSION Classes: Result, Subscription

Constant Summary collapse

Version =
[VERSION::MAJOR, VERSION::MINOR, VERSION::TINY].compact * '.'
API_SETTINGS =

Settings for standard POST over SSL Only used if TCLink library is not installed

{ 
  :domain => 'vault.trustcommerce.com',
  :query_path => '/query/', 
  :trans_path => '/trans/', 
  :port => 443  
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.custidObject

Returns the value of attribute custid.



57
58
59
# File 'lib/trustcommerce.rb', line 57

def custid
  @custid
end

.passwordObject

Returns the value of attribute password.



58
59
60
# File 'lib/trustcommerce.rb', line 58

def password
  @password
end

.vault_passwordObject

Returns Vault password.



62
63
64
# File 'lib/trustcommerce.rb', line 62

def vault_password
  @vault_password
end

Class Method Details

.tclink?Boolean

It is highly recommended to download and install the [TCLink ruby extension](www.trustcommerce.com/tclink.php). This extension provides failover capability and enhanced security features. If this library is not installed, standard POST over SSL will be used.

Returns:

  • (Boolean)


181
182
183
184
185
186
187
188
# File 'lib/trustcommerce.rb', line 181

def self.tclink?
  begin
    require 'tclink'
    true
  rescue LoadError
    false
  end
end