Class: ActiveMerchant::Billing::ItransactGateway
- Defined in:
- lib/active_merchant/billing/gateways/itransact.rb
Overview
iTransact, Inc. is an authorized reseller of the PaymentClearing gateway. If your merchant service provider uses PaymentClearing.com to process payments, you can use this module.
Please note, the username and API Access Key are not what you use to log into the Merchant Control Panel.
How to get your GatewayID and API Access Key
-
If you don’t already have a Gateway Account, go to www.itransact.com/merchant/test.html to sign up.
-
Go to support.paymentclearing.com and login or register, if necessary.
-
Click on “Submit a Ticket.”
-
Select “Merchant Support” as the department and click “Next”
-
Enter both your company name and GatewayID. Put “API Access Key” in the subject. In the body, you can request a username, but it may already be in use.
Initialization
Once you have the username, API Access Key, and your GatewayId, you’re ready to begin. You initialize the Gateway like so:
gateway = ActiveMerchant::Billing::ItransactGateway.new(
:login => "#{THE_USERNAME}",
:password => "#{THE_API_ACCESS_KEY}",
:gateway_id => "#{THE_GATEWAY_ID}"
)
Important Notes
-
Recurring is not implemented
-
CreditTransactions are not implemented (these are credits not related to a previously run transaction).
-
TransactionStatus is not implemented
Constant Summary collapse
- URL =
'https://secure.paymentclearing.com/cgi-bin/rc/xmltrans2.cgi'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, payment_source, options = {}) ⇒ Object
Performs an authorize transaction.
-
#capture(money, authorization, options = {}) ⇒ Object
Captures the funds from an authorize transaction.
-
#credit(money, authorization, options = {}) ⇒ Object
This will reverse a previously run transaction which has settled.
-
#initialize(options = {}) ⇒ ItransactGateway
constructor
Creates a new instance of the iTransact Gateway.
-
#purchase(money, payment_source, options = {}) ⇒ Object
Performs an authorize and capture in single transaction.
-
#void(money, authorization, options = {}) ⇒ Object
This will reverse a previously run transaction which has not settled.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ ItransactGateway
Creates a new instance of the iTransact Gateway.
Parameters
-
options
- A Hash of options
Options Hash
-
:login
- A String containing your PaymentClearing assigned API Access Username -
:password
- A String containing your PaymentClearing assigned API Access Key -
:gateway_id
- A String containing your PaymentClearing assigned GatewayID -
:test_mode
-true
orfalse
. Run all transactions with the ‘TestMode’ element set to ‘TRUE’.
61 62 63 64 65 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 61 def initialize( = {}) requires!(, :login, :password, :gateway_id) @options = super end |
Instance Method Details
#authorize(money, payment_source, options = {}) ⇒ Object
Performs an authorize transaction. In PaymentClearing’s documentation this is known as a “PreAuth” transaction.
Parameters
-
money
- The amount to be captured. Should be an Integer amount in cents. -
creditcard
- The CreditCard details for the transaction -
options
- A Hash of options
Options Hash
The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
-
:order_items
- An Array of Hash objects with the keys:description
,:cost
(in cents!), and:quantity
. If this is provided,:description
andmoney
will be ignored. -
:vendor_data
- An Array of Hash objects with the keys being the name of the VendorData element and value being the value. -
:send_customer_email
-true
orfalse
. Runs the transaction with the ‘SendCustomerEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:send_merchant_email
-true
orfalse
. Runs the transaction with the ‘SendMerchantEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:email_text
- An Array of (up to ten (10)) String objects to be included in emails -
:test_mode
-true
orfalse
. Runs the transaction with the ‘TestMode’ element set to ‘TRUE’ or ‘FALSE’.
Examples
response = gateway.authorize(1000, creditcard,
:order_id => '1212', :address => {...}, :email => '[email protected]',
:order_items => [
{:description => 'Line Item 1', :cost => '8.98', :quantity => '6'},
{:description => 'Line Item 2', :cost => '6.99', :quantity => '4'}
],
:vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
:send_customer_email => true,
:send_merchant_email => true,
:email_text => ['line1', 'line2', 'line3'],
:test_mode => true
)
98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 98 def (money, payment_source, = {}) payload = Nokogiri::XML::Builder.new do |xml| xml.AuthTransaction { xml.Preauth add_customer_data(xml, payment_source, ) add_invoice(xml, money, ) add_payment_source(xml, payment_source) add_transaction_control(xml, ) add_vendor_data(xml, ) } end.doc commit(payload) end |
#capture(money, authorization, options = {}) ⇒ Object
Captures the funds from an authorize transaction. In PaymentClearing’s documentation this is known as a “PostAuth” transaction.
Parameters
-
money
- The amount to be captured. Should be an Integer amount in cents -
authorization
- The authorization returned from the previous capture or purchase request -
options
- A Hash of options, all are optional.
Options Hash
The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
-
:vendor_data
- An Array of Hash objects with the keys being the name of the VendorData element and value being the value. -
:send_customer_email
-true
orfalse
. Runs the transaction with the ‘SendCustomerEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:send_merchant_email
-true
orfalse
. Runs the transaction with the ‘SendMerchantEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:email_text
- An Array of (up to ten (10)) String objects to be included in emails -
:test_mode
-true
orfalse
. Runs the transaction with the ‘TestMode’ element set to ‘TRUE’ or ‘FALSE’.
Examples
response = gateway.capture(1000, creditcard,
:vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
:send_customer_email => true,
:send_merchant_email => true,
:email_text => ['line1', 'line2', 'line3'],
:test_mode => true
)
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 183 def capture(money, , = {}) payload = Nokogiri::XML::Builder.new do |xml| xml.PostAuthTransaction { xml.OperationXID() add_invoice(xml, money, ) add_transaction_control(xml, ) add_vendor_data(xml, ) } end.doc commit(payload) end |
#credit(money, authorization, options = {}) ⇒ Object
This will reverse a previously run transaction which has settled.
Parameters
-
money
- The amount to be credited. Should benil
or an Integer amount in cents -
authorization
- The authorization returned from the previous capture or purchase request -
options
- A Hash of options, all are optional
Options Hash
The standard options (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address) are ignored.
-
:vendor_data
- An Array of Hash objects with the keys being the name of the VendorData element and value being the value. -
:send_customer_email
-true
orfalse
. Runs the transaction with the ‘SendCustomerEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:send_merchant_email
-true
orfalse
. Runs the transaction with the ‘SendMerchantEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:email_text
- An Array of (up to ten (10)) String objects to be included in emails -
:test_mode
-true
orfalse
. Runs the transaction with the ‘TestMode’ element set to ‘TRUE’ or ‘FALSE’.
Examples
response = gateway.credit(nil, '9999999999',
:vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
:send_customer_email => true,
:send_merchant_email => true,
:email_text => ['line1', 'line2', 'line3'],
:test_mode => true
)
256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 256 def credit(money, , = {}) payload = Nokogiri::XML::Builder.new do |xml| xml.TranCreditTransaction { xml.OperationXID() add_invoice(xml, money, ) add_transaction_control(xml, ) add_vendor_data(xml, ) } end.doc commit(payload) end |
#purchase(money, payment_source, options = {}) ⇒ Object
Performs an authorize and capture in single transaction. In PaymentClearing’s documentation this is known as an “Auth” or a “Sale” transaction
Parameters
-
money
- The amount to be captured. Should benil
or an Integer amount in cents. -
creditcard
- The CreditCard details for the transaction -
options
- A Hash of options
Options Hash
The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
-
:order_items
- An Array of Hash objects with the keys:description
,:cost
(in cents!), and:quantity
. If this is provided,:description
andmoney
will be ignored. -
:vendor_data
- An Array of Hash objects with the keys being the name of the VendorData element and value being the value. -
:send_customer_email
-true
orfalse
. Runs the transaction with the ‘SendCustomerEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:send_merchant_email
-true
orfalse
. Runs the transaction with the ‘SendMerchantEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:email_text
- An Array of (up to ten (10)) String objects to be included in emails -
:test_mode
-true
orfalse
. Runs the transaction with the ‘TestMode’ element set to ‘TRUE’ or ‘FALSE’.
Examples
response = gateway.purchase(1000, creditcard,
:order_id => '1212', :address => {...}, :email => '[email protected]',
:order_items => [
{:description => 'Line Item 1', :cost => '8.98', :quantity => '6'},
{:description => 'Line Item 2', :cost => '6.99', :quantity => '4'}
],
:vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
:send_customer_email => true,
:send_merchant_email => true,
:email_text => ['line1', 'line2', 'line3'],
:test_mode => true
)
144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 144 def purchase(money, payment_source, = {}) payload = Nokogiri::XML::Builder.new do |xml| xml.AuthTransaction { add_customer_data(xml, payment_source, ) add_invoice(xml, money, ) add_payment_source(xml, payment_source) add_transaction_control(xml, ) add_vendor_data(xml, ) } end.doc commit(payload) end |
#void(money, authorization, options = {}) ⇒ Object
This will reverse a previously run transaction which has not settled.
Parameters
-
money
- This parameter is ignored – the PaymentClearing gateway does not allow partial voids. -
authorization
- The authorization returned from the previous capture or purchase request -
options
- A Hash of options, all are optional
Options Hash
The standard options (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address) are ignored.
-
:vendor_data
- An Array of Hash objects with the keys being the name of the VendorData element and value being the value. -
:send_customer_email
-true
orfalse
. Runs the transaction with the ‘SendCustomerEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:send_merchant_email
-true
orfalse
. Runs the transaction with the ‘SendMerchantEmail’ element set to ‘TRUE’ or ‘FALSE’. -
:email_text
- An Array of (up to ten (10)) String objects to be included in emails -
:test_mode
-true
orfalse
. Runs the transaction with the ‘TestMode’ element set to ‘TRUE’ or ‘FALSE’.
Examples
response = gateway.void(nil, '9999999999',
:vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
:send_customer_email => true,
:send_merchant_email => true,
:email_text => ['line1', 'line2', 'line3'],
:test_mode => true
)
220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/active_merchant/billing/gateways/itransact.rb', line 220 def void(money, , = {}) payload = Nokogiri::XML::Builder.new do |xml| xml.VoidTransaction { xml.OperationXID() add_transaction_control(xml, ) add_vendor_data(xml, ) } end.doc commit(payload) end |