Class: MerbMerchant::Billing::PslCardGateway
- Defined in:
- lib/merb_merchant/billing/gateways/psl_card.rb
Overview
MerbMerchant PSL Card Gateway
Notes:
-To be able to use the capture function, the IP address of the machine must be
registered with PSL
-ESALE_KEYED should only be used in situations where the cardholder perceives the
transaction to be Internet-based, such as purchasing from a web site/on-line store.
If the Internet is used purely for the transport of information from the merchant
directly to the gateway then the appropriate cardholder present or not present message
type should be used rather than the ‘E’ equivalent.
-The CV2 / AVS policies are set up with the account settings when signing up for an account
Constant Summary collapse
- URL =
PslCard server URL - The url is the same whether testing or live - use the test account when testing…
'https://pslcard3.paymentsolutionsltd.com/secure/transact.asp?'
- MESSAGE_TYPE =
eCommerce sale transaction, details keyed by merchant or cardholder
'ESALE_KEYED'
- RESPONSE_ACTION =
The type of response that we want to get from PSL, options are HTML, XML or REDIRECT
'HTML'
- CURRENCY_CODES =
Currency Codes
{ 'AUD' => 036, 'GBP' => 826, 'USD' => 840 }
- EMV_TERMINAL_TYPE =
The terminal used - only for swipe transactions, so hard coded to 32 for online
32
- DISPATCH_LATER =
Different Dispatch types
'LATER'
- DISPATCH_NOW =
'NOW'
- APPROVED =
Return codes
'00'
- NOMINAL_AMOUNT =
Nominal amount to authorize for a ‘dispatch later’ type The nominal amount is held straight away, when the goods are ready to be dispatched, PSL is informed and the full amount is the taken.
101
- AVS_CODE =
{ "ALL MATCH" => 'Y', "SECURITY CODE MATCH ONLY" => 'N', "ADDRESS MATCH ONLY" => 'Y', "NO DATA MATCHES" => 'N', "DATA NOT CHECKED" => 'R', "SECURITY CHECKS NOT SUPPORTED" => 'X' }
- CVV_CODE =
{ "ALL MATCH" => 'M', "SECURITY CODE MATCH ONLY" => 'M', "ADDRESS MATCH ONLY" => 'N', "NO DATA MATCHES" => 'N', "DATA NOT CHECKED" => 'P', "SECURITY CHECKS NOT SUPPORTED" => 'X' }
Constants inherited from Gateway
Constants included from PostsData
PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, credit_card, options = {}) ⇒ Object
Authorize the transaction.
-
#capture(money, authorization, options = {}) ⇒ Object
Post an authorization.
-
#initialize(options = {}) ⇒ PslCardGateway
constructor
Create a new PslCardGateway.
-
#purchase(money, credit_card, options = {}) ⇒ Object
Purchase the item straight away.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ PslCardGateway
Create a new PslCardGateway
The gateway requires that a valid :login be passed in the options hash
Paramaters:
-options:
:login - the PslCard account login (required)
92 93 94 95 96 97 |
# File 'lib/merb_merchant/billing/gateways/psl_card.rb', line 92 def initialize( = {}) requires!(, :login) @options = super end |
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
Authorize the transaction
Reserves the funds on the customer’s credit card, but does not charge the card.
This implementation does not authorize the full amount, rather it checks that the full amount is available and only ‘reserves’ the nominal amount (currently a pound and a penny)
Parameters:
-money: Money object for the total to be charged
-authorization: the PSL cross reference from the previous authorization
-options:
Returns:
-ActiveRecord::Billing::Response object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/merb_merchant/billing/gateways/psl_card.rb', line 137 def (money, credit_card, = {}) post = {} add_amount(post, money, DISPATCH_LATER, ) add_credit_card(post, credit_card) add_address(post, ) add_invoice(post, ) add_purchase_details(post) commit(post) end |
#capture(money, authorization, options = {}) ⇒ Object
Post an authorization.
Captures the funds from an authorized transaction.
Parameters:
-money: Money object for the total to be charged
-authorization: The PSL Cross Reference
-options:
Returns:
-ActiveRecord::Billing::Response object
161 162 163 164 165 166 167 168 169 |
# File 'lib/merb_merchant/billing/gateways/psl_card.rb', line 161 def capture(money, , = {}) post = {} add_amount(post, money, DISPATCH_NOW, ) add_reference(post, ) add_purchase_details(post) commit(post) end |
#purchase(money, credit_card, options = {}) ⇒ Object
Purchase the item straight away
Parameters:
-money: Money object for the total to be charged
-authorization: the PSL cross reference from the previous authorization
-options:
Returns:
-ActiveRecord::Billing::Response object
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/merb_merchant/billing/gateways/psl_card.rb', line 109 def purchase(money, credit_card, = {}) post = {} add_amount(post, money, DISPATCH_NOW, ) add_credit_card(post, credit_card) add_address(post, ) add_invoice(post, ) add_purchase_details(post) commit(post) end |