Class: ActiveMerchant::Billing::LinkpointGateway
- Defined in:
- lib/active_merchant/billing/gateways/linkpoint.rb
Overview
Initialization Options :login Your store number :pem The text of your linkpoint PEM file. Note
this is not the path to file, but its
contents. If you are only using one PEM
file on your site you can declare it
globally and then you won't need to
include this option
A valid store number is required. Unfortunately, with LinkPoint YOU CAN’T JUST USE ANY OLD STORE NUMBER. Also, you can’t just generate your own PEM file. You’ll need to use a special PEM file provided by LinkPoint.
Go to www.linkpoint.com/support/sup_teststore.asp to set up a test account and obtain your PEM file.
Declaring PEM file Globally ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + ‘/../mycert.pem’ )
Valid Order Options :result =>
LIVE Production mode
GOOD Approved response in test mode
DECLINE Declined response in test mode
DUPLICATE Duplicate response in test mode
:ponumber Order number
:transactionorigin => Source of the transaction
ECI Email or Internet
MAIL Mail order
MOTO Mail order/Telephone
TELEPHONE Telephone
RETAIL Face-to-face
:ordertype =>
SALE Real live sale
PREAUTH Authorize only
POSTAUTH Forced Ticket or Ticket Only transaction
VOID
CREDIT
CALCSHIPPING For shipping charges calculations
CALCTAX For sales tax calculations
Recurring Options
:action =>
SUBMIT
MODIFY
CANCEL
:installments Identifies how many recurring payments to charge the customer :startdate Date to begin charging the recurring payments. Format: YYYYMMDD or “immediate” :periodicity =>
MONTHLY
BIMONTHLY
WEEKLY
BIWEEKLY
YEARLY
DAILY
:threshold Tells how many times to retry the transaction (if it fails) before contacting the merchant. :comments Uh… comments
For reference:
www.linkpointcentral.com/lpc/docs/Help/APIHelp/lpintguide.htm
Entities = {
:payment => [:subtotal, :tax, :vattax, :shipping, :chargetotal],
:billing => [:name, :address1, :address2, :city, :state, :zip, :country, :email, :phone, :fax, :addrnum],
:shipping => [:name, :address1, :address2, :city, :state, :zip, :country, :weight, :items, :carrier, :total],
:creditcard => [:cardnumber, :cardexpmonth, :cardexpyear, :cvmvalue, :track],
:telecheck => [:routing, :account, :checknumber, :bankname, :bankstate, :dl, :dlstate, :void, :accounttype, :ssn],
:transactiondetails => [:transactionorigin, :oid, :ponumber, :taxexempt, :terminaltype, :ip, :reference_number, :recurring, :tdate],
:periodic => [:action, :installments, :threshold, :startdate, :periodicity, :comments],
:notes => [:comments, :referred]
}
IMPORTANT NOTICE:
LinkPoint’s Items entity is not yet supported in this module.
Constant Summary collapse
- TEST_URL =
'https://staging.linkpt.net:1129/'
- LIVE_URL =
'https://secure.linkpt.net:1129/'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#authorize(money, creditcard, options = {}) ⇒ Object
Authorize the transaction.
-
#capture(money, authorization, options = {}) ⇒ Object
Post an authorization.
-
#credit(money, identification, options = {}) ⇒ Object
Refund an order.
-
#initialize(options = {}) ⇒ LinkpointGateway
constructor
}.update(options).
-
#purchase(money, creditcard, options = {}) ⇒ Object
Buy the thing.
-
#recurring(money, creditcard, options = {}) ⇒ Object
Send a purchase request with periodic options Recurring Options :action => SUBMIT MODIFY CANCEL :installments Identifies how many recurring payments to charge the customer :startdate Date to begin charging the recurring payments.
- #test? ⇒ Boolean
-
#void(identification, options = {}) ⇒ Object
Void a previous transaction.
Methods inherited from Gateway
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ LinkpointGateway
}.update(options)
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 135 def initialize( = {}) requires!(, :login) @options = { :result => 'LIVE' }.update() @pem = @options[:pem] || LinkpointGateway.pem_file raise ArgumentError, "You need to pass in your pem file using the :pem parameter or set it globally using ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) or similar" if @pem.nil? end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
118 119 120 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 118 def @options end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
117 118 119 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 117 def response @response end |
Class Method Details
.supported_cardtypes ⇒ Object
239 240 241 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 239 def self.supported_cardtypes [:visa, :master, :discover, :american_express] end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
Authorize the transaction
Reserves the funds on the customer’s credit card, but does not charge the card.
195 196 197 198 199 200 201 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 195 def (money, creditcard, = {}) requires!(, :order_id) .update( :ordertype => "PREAUTH" ) commit(money, creditcard, ) end |
#capture(money, authorization, options = {}) ⇒ Object
Post an authorization.
Captures the funds from an authorized transaction. Order_id must be a valid order id from a prior authorized transaction.
209 210 211 212 213 214 215 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 209 def capture(money, , = {}) .update( :order_id => , :ordertype => "POSTAUTH" ) commit(money, nil, ) end |
#credit(money, identification, options = {}) ⇒ Object
Refund an order
identification must be a valid order id previously submitted by SALE
231 232 233 234 235 236 237 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 231 def credit(money, identification, = {}) .update( :ordertype => "CREDIT", :order_id => identification ) commit(money, nil, ) end |
#purchase(money, creditcard, options = {}) ⇒ Object
Buy the thing
182 183 184 185 186 187 188 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 182 def purchase(money, creditcard, ={}) requires!(, :order_id) .update( :ordertype => "SALE" ) commit(money, creditcard, ) end |
#recurring(money, creditcard, options = {}) ⇒ Object
Send a purchase request with periodic options Recurring Options
:action =>
SUBMIT
MODIFY
CANCEL
:installments Identifies how many recurring payments to charge the customer :startdate Date to begin charging the recurring payments. Format: YYYYMMDD or “immediate” :periodicity =>
:monthly
:bimonthly
:weekly
:biweekly
:yearly
:daily
:threshold Tells how many times to retry the transaction (if it fails) before contacting the merchant. :comments Uh… comments
166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 166 def recurring(money, creditcard, ={}) requires!(, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily], :installments, :order_id ) .update( :ordertype => "SALE", :action => "SUBMIT", :installments => [:installments] || 12, :startdate => [:startdate] || "immediate", :periodicity => [:periodicity].to_s || "monthly", :comments => [:comments] || nil, :threshold => [:threshold] || 3 ) commit(money, creditcard, ) end |
#test? ⇒ Boolean
243 244 245 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 243 def test? @options[:test] || Base.gateway_mode == :test end |
#void(identification, options = {}) ⇒ Object
Void a previous transaction
218 219 220 221 222 223 224 |
# File 'lib/active_merchant/billing/gateways/linkpoint.rb', line 218 def void(identification, = {}) .update( :order_id => identification, :ordertype => "VOID" ) commit(nil, nil, ) end |