Payment Modules
PayPal Express – no shipping options?
May 15th
I was working on the ‘official’ PayPal Express release for osCommerce:
https://cms.paypal.com/cms_content/GB/en_GB/files/developer/osc_PayPal_v177.zip
Installation was fine (other than the recurring payments bits which I did not install) but, when I was testing it on the PayPal Sandbox I found that I was being presented with no shipping fee at checkout_confirmation – just the single character ‘r’
Tracking down the reason took awhiles but here it is – in the file ext/modules/payment/paypal/express.php find the following at around line 300:
// select cheapest shipping method $shipping = $shipping_modules->cheapest(); $shipping = $shipping['id'];
Change this by commenting out the last line
// select cheapest shipping method $shipping = $shipping_modules->cheapest(); //$shipping = $shipping['id'];
US States Drop Down for Payment Selection
Dec 17th
I’ve just spent a happy twenty minutes setting up a drop down box of US States for use in a First Data Global Gateway Telecheck Payment module. This will display the full state name in an alphabetical list and pass the two letter, upper case abbreviation as the value.
Save yourself some time and grab the list here:
$bank_state =
array(array('id' => 'AL', 'text' =>'Alabama'),
array('id' => 'AK', 'text' =>'Alaska'),
array('id' => 'AZ', 'text' =>'Arizona'),
array('id' => 'AR', 'text' =>'Arkansas'),
array('id' => 'CA', 'text' =>'California'),
array('id' => 'CO', 'text' =>'Colorado'),
array('id' => 'CT', 'text' =>'Connecticut'),
array('id' => 'DE', 'text' =>'Delaware'),
array('id' => 'FL', 'text' =>'Florida'),
array('id' => 'GA', 'text' =>'Georgia'),
array('id' => 'HI', 'text' =>'Hawaii'),
array('id' => 'ID', 'text' =>'Idaho'),
array('id' => 'IL', 'text' =>'Illinois'),
array('id' => 'IN', 'text' =>'Indiana'),
array('id' => 'IA', 'text' =>'Iowa'),
array('id' => 'KS', 'text' =>'Kansas'),
array('id' => 'KY', 'text' =>'Kentucky'),
array('id' => 'LA', 'text' =>'Louisiana'),
array('id' => 'ME', 'text' =>'Maine'),
array('id' => 'MD', 'text' =>'Maryland'),
array('id' => 'MA', 'text' =>'Massachusetts'),
array('id' => 'MI', 'text' =>'Michigan'),
array('id' => 'MN', 'text' =>'Minnesota'),
array('id' => 'MS', 'text' =>'Mississippi'),
array('id' => 'MO', 'text' =>'Missouri'),
array('id' => 'MT', 'text' =>'Montana'),
array('id' => 'NE', 'text' =>'Nebraska'),
array('id' => 'NV', 'text' =>'Nevada'),
array('id' => 'NH', 'text' =>'New Hampshire'),
array('id' => 'NJ', 'text' =>'New Jersey'),
array('id' => 'NM', 'text' =>'New Mexico'),
array('id' => 'NY', 'text' =>'New York'),
array('id' => 'NC', 'text' =>'North Carolina'),
array('id' => 'ND', 'text' =>'North Dakota'),
array('id' => 'OH', 'text' =>'Ohio'),
array('id' => 'OK', 'text' =>'Oklahoma'),
array('id' => 'OR', 'text' =>'Oregon'),
array('id' => 'PA', 'text' =>'Pennsylvania'),
array('id' => 'RI', 'text' =>'Rhode Island'),
array('id' => 'SC', 'text' =>'South Carolina'),
array('id' => 'SD', 'text' =>'South Dakota'),
array('id' => 'TN', 'text' =>'Tennessee'),
array('id' => 'TX', 'text' =>'Texas'),
array('id' => 'UT', 'text' =>'Utah'),
array('id' => 'VT', 'text' =>'Vermont'),
array('id' => 'VA', 'text' =>'Virginia'),
array('id' => 'WA', 'text' =>'Washington'),
array('id' => 'WV', 'text' =>'West Virginia'),
array('id' => 'WI', 'text' =>'Wisconsin'),
array('id' => 'WY', 'text' =>'Wyoming'));
And then call the dropdown:
array('title' => MODULE_PAYMENT_LINKPOINT_ECHECK_E_TEXT_BANK_STATE,
'field' => tep_draw_pull_down_menu('linkpoint_echeck_bank_state', $bank_state)),
ANZ Egate not displaying in the front end
Nov 27th
If you install the ANZ Egate payment module that uses MIGS ( get it here ) and, after activation it in the admin, you may be puzzled to find that it does not display in the front end. You then spend ages bug hunting. I did.
The front end will not display unless you insert both a MIGS Merchant ID and MIGS Access Code in the admin page – both these can be any dummy numbers that you like but, without those two fields filled in the module will not display in checkout_payment.php
Discussed here.
Pagseguro::Erro 165 – O VALOR do item 1 não foi informado.
Nov 4th
Came across this one recently – Pagseguro is a Brazilian payment processor
with a built in postal calculation function.
All of a sudden the client’s store was throwing errors on checkout:
O VALOR do item 1 não foi informado.
O VALOR do item 2 não foi informado.
and so on.
Using HttpFox I could see that the correct value for the currency (tep_draw_hidden_field(‘moeda’, ‘BR’)) was being passed to the payment server but no values for the individual items in the order.
After a bit of digging I found that the client (ahem!) had been in the store admin and he had changed the currency code for Brazilian Reals to ‘BR’ from the existing ISO-4217 code ‘BRL’ so that it would match the ‘BR’ required by Pagseguro as per their moeda field.
The Pagseguro payment module passes individual prices for each item in the order to the payment server by using the osCommerce function $currencies->get_value($currency) – changing the currency code in the admin to BR will make this function return a zero value.
So if you find that your Reals are not being correctly calculated then check that admin currency setting.
