require_once('paAPI_test.php'); $order = new paAPI();//construct paAPI class $order->setUser('ndap_llc','mozllc');//api account username and pass $order->setAccountNum('64366'); // $order->setClient("Sample Client v1");//passes the name of the connection client *optional* $order->set_cust_name('M Мiхail Slеpcоv');//ship to name $order->set_ship_add1('Осtуzhеva, 5a, 201 ');//ship to address1 $order->set_ship_add2('M');//ship to address2 $order->set_ship_city('Вороnеzh');//ship to city $order->set_ship_state('Россia');//ship to state $order->set_ship_zip('11205');//ship to postal code $order->set_ship_meth('FDG');//ship method FDG=Ground, FD2=2nd Day, FDO=Overnight $order->set_order_num('28');//customer PO# $order->set_ship_country('RU');//ship to country code // $order->set_conf_number($ConfNumber);//confirmation from DST // $order->set_paypal_number($BTN);//paypal reference number // $order->set_tax_amount($TAX);//tax on order // $order->set_ship_amount($HSC);//calculated shipping cost of order ///pass line item information $order->addItem(array('line_code'=>'vg','part_num'=>'JV8','quantity'=>2,'cost'=>3.16)); $order->set_status('test');//takes either ('test') or ('live') echo "\r\n"; print_r($order->sendOrder('enterOrder')); $ret = json_decode($order->sendOrder('enterOrder')); //order entry response in json string
if ($CountryId == "US" || $CountryId == "CA") { if ($Address[1]) { $paOrder->set_ship_add2($Address[1]); //ship to address2 } $paOrder->set_ship_city($City); //ship to city $paOrder->set_ship_state($State); //ship to state $paOrder->set_ship_zip($PostalCode); //ship to postal code $paOrder->set_ship_meth($ShippingMethod2); //ship method FDG=Ground, FD2=2nd Day, FDO=Overnight $paOrder->set_order_num($InvoiceId); //customer PO# $paOrder->set_ship_country($CountryId); //ship to country code // $paOrder->set_conf_number($ConfNumber);//confirmation from DST // $paOrder->set_paypal_number($BTN);//paypal reference number // $paOrder->set_tax_amount($TAX);//tax on order // $paOrder->set_ship_amount($HSC);//calculated shipping cost of order } else { // this is a workaround for PA/DST issues with foreign orders // move city to ship_add2, state to ship_city since DST state is 2-char max // Field lengths on PA side are 30 char. Foreign orders where Address line 2 show are going to have issues. // Nick will have to handle this and then we can improve this code. if (empty($State)) { if ($Address[1]) { $paOrder->set_ship_add2($Address[1]); //ship to address2 }
if ($CountryId == "US" || $CountryId == "CA") { if ($Address[1]) { $paOrder->set_ship_add2(normalize_special_characters($Address[1])); //ship to address2 } $paOrder->set_ship_city(normalize_special_characters($City)); //ship to city $paOrder->set_ship_state(normalize_special_characters($State)); //ship to state $paOrder->set_ship_zip($PostalCode); //ship to postal code $paOrder->set_ship_meth($ShippingMethod2); //ship method FDG=Ground, FD2=2nd Day, FDO=Overnight $paOrder->set_order_num($InvoiceId); //customer PO# $paOrder->set_ship_country($CountryId); //ship to country code // $paOrder->set_conf_number($ConfNumber);//confirmation from DST // $paOrder->set_paypal_number($BTN);//paypal reference number // $paOrder->set_tax_amount($TAX);//tax on order // $paOrder->set_ship_amount($HSC);//calculated shipping cost of order } else { // this is a workaround for PA/DST issues with foreign orders // move city to ship_add2, state to ship_city since DST state is 2-char max // Field lengths on PA side are 30 char. Foreign orders where Address line 2 show are going to have issues. // Nick will have to handle this and then we can improve this code. $State = $myOrder->getShippingAddress()->getRegion(); if (empty($State)) { if ($Address[1]) { $paOrder->set_ship_add2(normalize_special_characters($Address[1])); //ship to address2