Country problem

Guest (not verified)
Guest's picture
Country problem

Another issue with Linkpoint is the country code is supposed to be 2 letters. For example:

US for USA
CA for Canada.

The problem is Ubercart stores the countries as numbers. For example:

USA is 840
CA is 124

For the time being, I devised a ghetto little rig to convert these numbers to the 2 letters needed by Linkpoint.

Add the lines to the uc_linkpoint_api.module file:

Original file:

$description = substr($description, 0, 255);
*/

  $xml ="<order>";

Modified file:

$description = substr($description, 0, 255);
*/

$countrybill = $order->billing_country;
  if ($countrybill == 840) {
    $countrybill = "US";
  } else if ($countrybill == 124) {
    $countrybill = "CA";
  }

  $xml ="<order>";

After you do that, find the line that says:

$xml .="<country>" . $order->billing_country . "</country>";

and replace it with:

  $xml .="<country>" . $countrybill . "</country>";
Linkpoint API Payment Module By: Nick (51 replies) Sun, 09/30/2007 - 15:02