NetSuite add customer address - php

I have seen the other examples here on StackOverflow but neither are working for me, my code creates an address line in NetSuite but the addr1, city, state and zip are empty, the default billing and shipping do show false or if I set it to true it shows true so that part is updating.. The response doesn't show any errors. Any ideas?
Here is my code:
$customer = new Customer();
$customer->internalId = 16;
$customer->firstName = 'Joe';
$customer->middleName = 'A';
$customer->lastName = 'Smith';
$customer->email = 'joe#email.com';
$address = new CustomerAddressBook();
$address->defaultShipping = false;
$address->defaultBilling = false;
$address->isResidential = true;
$address->addr1 = '123 Street';
$address->city = 'New York';
$address->zip = '12345';
$address->state = 'NY';
$addressBook = new CustomerAddressbookList();
$addressBook->addressbook = array($address);
$addressBook->replaceAll = false;
// add address to cutomer
$customer->addressbookList = $addressBook;
$request = new UpdateRequest();
$request->record = $customer;
$netsuiteService = new NetSuiteService();
$response = $netsuiteService->update($request);

$address = new Address();
$address->addr1 = '123 Street';
$address->city = 'New York';
$address->zip = '12345';
$address->state = 'NY';
$address_book = new CustomerAddressBook();
$address_book->defaultShipping = false;
$address_book->defaultBilling = false;
$address_book->isResidential = true;
$address_book->addressbookAddress = $address;
$address_book_list = new CustomerAddressbookList();
$address_book_list->addressbook = $address_book;
$address_book_list->replaceAll = false;
$customer = new Customer();
$customer->internalId = 16;
$customer->firstName = 'Joe';
$customer->middleName = 'A';
$customer->lastName = 'Smith';
$customer->email = 'joe#email.com';
$customer->addressbookList = $address_book_list;
$request = new UpdateRequest();
$request->record = $customer;
$netsuiteService = new NetSuiteService();
$response = $netsuiteService->update($request);
if (!$response->writeResponse->status->isSuccess) {
echo "UPDATE ERROR";
} else {
echo "UPDATE SUCCESS, id " . $response->writeResponse->baseRef->internalId;
}

Related

edit text value pass wrong to the server in Hebrew langaue

I am trying to pass a strret address from my application to my PHP server.
when i print the address in the Log.d i got:
העמק 57 גבעת אלה
but the server response is:
$place = $_POST["address"];
$output["addressEditText"] = $place;
and this is what i got from the server:
???? 57 ???? ???
i need that the server will support also hebrew alphabet.
just for notice this response is not from the DB i just copy and past the value of the parameter into the output response.
this is my page code:
<?php
/**
* Created by PhpStorm.
* User: matant
* Date: 9/17/2015
* Time: 2:56 PM
*/
include 'response_process.php';
include 'gcm.php';
require_once 'DBFunctions.php';
class CreateEvent implements ResponseProcess {
public function dataProcess($dblink)
{
$output = array();
$dbF = new DBFunctions($dblink);
$sport = $_POST["sport_type"];
$date = date("Y-m-d",strtotime(str_replace('/','-',$_POST["date"])));
$s_time =$date." ".$_POST["s_time"];
$e_time = $date." ".$_POST["e_time"];
$s_time =date("Y-m-d H:i:s",strtotime($s_time));
$e_time = date("Y-m-d H:i:s",strtotime($e_time));
$lon = $_POST["lon"];
$lat = $_POST["lat"];
$event_type = $_POST["event_type"];
$max_p = $_POST["max_participants"];
$sched = $_POST["scheduled"];
$gen = $_POST["gender"];
$min_age = $_POST["minAge"];
$manager = $_POST["manager"];
$mng_name = $_POST["manager_name"];
$place = $_POST["address"];
$output["addressEditText"] = $place;
$mode = $_POST["mode"];
if($sched == "true"){
$exp_val = "";
$type = "";
$repeat = $_POST["repeat"];
$duration = $_POST["duration"];
$expiration_tag = $_POST["sched_tag"];
switch($expiration_tag){
case "unlimited":{
$exp_val = "unlimited";
$type = $exp_val;
break;
}
case "Year":{
$exp_val = date("Y-m-d",strtotime($_POST["value"]));
$type = "date";
break;
}
case "events_number":
$exp_val = $_POST["value"];
$type = "counter";
break;
case "by_date":
$exp_val = date("Y-m-d",strtotime($_POST["value"]));
$type = "date";
break;
}
$output["repeat"] = $repeat;
$output["duration"] = $duration;
$output["exp_val"] = $exp_val;
$output["type"] = $type;
}
if($mode == "edit"){
$event_id = $_POST["event_id"];
$invited_users_size = 0;
if(isset($_POST["invitedUsers"])){
$participants = $_POST["invitedUsers"];
$json_uesr_ids = json_decode($participants);
$invited_users_size = count($json_uesr_ids);
}
if(isset($_POST["invitedUsers"])){
$result_q = $dbF -> DeleteEventFromAttending($event_id);
if(!$result_q)
{
$output["flag"]= "delete failed";
$output["msg"] = $result_q;
return json_encode($output);
}else {
$participants = $_POST["invitedUsers"];
$json_uesr_ids = json_decode($participants);
$output["json_users"] = $json_uesr_ids;
$get_users_reg_ids = $dbF->getUserSByIds($json_uesr_ids, count($json_uesr_ids));
$reg_ids = array();
$i = 0;
while ($row_user = mysqli_fetch_assoc($get_users_reg_ids)) {
$reg_ids[$i] = $row_user["gcm_id"];
$i++;
}
$output["ids"] = $reg_ids;
$output["size"] = count($json_uesr_ids);
$result_q = $dbF->InsertIntoAttendingUpdatedUsers($json_uesr_ids, $event_id, count($json_uesr_ids),"awaiting reply");
$output["insert_res"] = $result_q;
if (!$result_q) {
$output["flag"] = "update_insert failed";
$output["msg"] = $result_q;
return json_encode($output);
} else {
$output["flag"] = "update_success";
$output["msg"] = $result_q;
}
//send notification on update to users
$gcm = new GCM();
$data = array();
$message = "The event " . $sport . " in " . $place . " in " . $date . " updated,Please click on Join in order to confirm registration.";
$data['message'] = $message;
$data['date'] = $date;
$data['private'] = $event_type;
$data['start_time'] = date("H:i", strtotime($s_time));
$data['end_time'] = date("H:i", strtotime($e_time));
$data['inviter'] = $mng_name;
$data['event_id'] = $event_id;
$data['location'] = $place;
$gcm_res = $gcm->send_notification($reg_ids, $data);
$output["gcm_res"] = $gcm_res;
//send notification on update to users
}
}
$result_q = $dbF ->checkIfEventIsExistBeforeUpdate($lon,$lat,$date,$s_time,$e_time,$event_id);
if(!$result_q)
{
$output["flag"]= "select failed";
$output["msg"] = $result_q;
return json_encode($output);
}
else {
$no_of_rows_check_event = mysqli_num_rows($result_q);
if ($no_of_rows_check_event > 0) {
$output["flag"] = "failed";
$output["msg"] = "Place is already occupied in this time";
}else{
$result_q = $dbF -> UpdateEvent($event_id,$sport,$s_time,$e_time,$place,$lon,$lat,$event_type,$gen,$min_age,$max_p,'1',$invited_users_size,$sched,$output["repeat"],$output["duration"],$output["type"],$output["exp_val"]);
$output["res"] = $result_q;
$output["sched"] = $sched;
if($sched == "true")
{
$output["sched_res"] = "true";
}
else{
$output["sched_res"] = "false";
}
$affected_row = mysqli_affected_rows($dblink);
if(!$result_q)
{
$output["flag"]= "update_failed";
$output["query_res"] = $result_q;
$output["msg"] = "failed to update event";
$output["affected row"] = $affected_row;
}
else{
$output["flag"]= "update_success";
$output["query_res"] = $result_q;
$output["msg"] = "success to update event";
$output["affected row"] = $affected_row;
}
}
}
}
else{
$result_q = $dbF ->checkIfEventIsExist($lon,$lat,$date,$s_time,$e_time);
$output["query"] = $result_q;
if(!$result_q)
{
$output["flag"]= "select failed";
$output["msg"] = $result_q;
return json_encode($output);
}
else{
$no_of_rows_check_event = mysqli_num_rows($result_q);
$output["no_of_rows"] = $no_of_rows_check_event;
if($no_of_rows_check_event > 0)
{
$output["flag"] = "failed";
$output["msg"] = "Place is already occupied in this time";
}else{
$output["flag"] = "success";
$output["msg"] = "insert event";
$num_of_invited_users = 0;
if(isset($_POST["jsoninvited"])){
$json = $_POST["jsoninvited"];
$json = json_decode($json);
$num_of_invited_users = (count($json));
$output["size_invited"] = count($json);
}
$result = $dbF -> InsertNewEvent($manager,$sport,$s_time,$e_time,$place,$lon,$lat,$event_type,$gen,$min_age,$max_p,$num_of_invited_users,$sched,$output["repeat"],$output["duration"],$output["type"],$output["exp_val"]);
if (!$result) {
$output["flag"] = "failed to create event";
// return (json_encode($output));
}
else{
if(isset($_POST["jsoninvited"])){
$event_s_res = $dbF ->getEventIdByDateAndTime($date,$s_time,$e_time);
$output["my_squery"] =$event_s_res;
if(!$event_s_res)
{
$output["flag"] = "failed";
$output["msg"] = "Event id not found";
}
else{
$row = mysqli_fetch_assoc($event_s_res);
$no_of_rows = mysqli_num_rows($event_s_res);
if($no_of_rows > 1 || $no_of_rows == 0)
{
$output["flag"] = "failed";
$output["msg"] = "Event id not found";
}
else{
$event_id = $row["event_id"];
$json = $_POST["jsoninvited"];
$json = json_decode($json);
$output["size_invited"] = count($json);
$size_of_param = (count($json));
$event_user_s_res = $dbF -> getUserIdAndRegId($json,$size_of_param);
if(!$event_user_s_res)
{
$output["flag"] = "failed";
$output["msg"] = "user id not found";
}
$result = $dbF->insertIntoAttendingTable($event_user_s_res, $event_id, $size_of_param);
$insert_query_res = $result["res"];
$output["query"] = $result["query"];
$registration_ids = $result["reg_ids"];
if(!$insert_query_res)
{
$output["flag"] = "failed";
$output["msg"] = "failed to insert to attending table";
}
else{
$output["registred_ids"] = $registration_ids;
$output["msg"] = "success to insert into attending";
$gcm = new GCM();
$data = array();
$message = "Would like to invite you to play ".$sport.", Please click on Join in order to add you into the event.";
$data['message'] = $message;
$data['date'] = $date;
$data['start_time'] = date("H:i",strtotime($s_time));
$data['end_time'] = date("H:i",strtotime($e_time));
$data['inviter'] = $mng_name;
$data['private'] = $event_type;
$data['event_id'] = $event_id;
$data['location'] = $place;
$output["gcm_message"]=$data;
$gcm_res = $gcm->send_notification($registration_ids,$data);
$output["gcm_res"] = $gcm_res;
} //els of $insert_query_res
} //else of $no_of_rows > 1 || $no_of_rows == 0
} // else of $event_s_res
} //if isset($_POST["invitedUsers"]
} // if $result
}
}
}//get inside creating event mode.
return json_encode($output);
}
}
this is my client side:
public void sendDataToDBController() {
BasicNameValuePair mode_req;
LatLng lonlat = locationTool.getLocationFromAddress(addressEditText.getText().toString());
if(lonlat == null)
{
Log.d("location is:","location not found");
sv.scrollTo(0, 0);
addressEditText.setError("Location was not found!");
return;
}
Log.d("found location",lonlat.latitude+""+lonlat.longitude);
BasicNameValuePair tagreq = new BasicNameValuePair(Constants.TAG_REQUEST,"create_event");
Log.d("event mode",mode);
if(mode.equals(Constants.MODE_CREATE))
{
Log.d("event mode","create");
mode_req = new BasicNameValuePair(Constants.TAG_MODE,Constants.MODE_CREATE);
}
else {
Log.d("event mode","update");
mode_req = new BasicNameValuePair(Constants.TAG_MODE, Constants.MODE_UPDATE);
}
Log.d("addressEditText",addressEditText.getText().toString());
BasicNameValuePair address = new BasicNameValuePair("address",addressEditText.getText().toString());
BasicNameValuePair sport = new BasicNameValuePair("sport_type",sportSpinner.getSelectedItem().toString());
Log.d("sport_type",sportSpinner.getSelectedItem().toString());
BasicNameValuePair date = new BasicNameValuePair("date",btnStartdate.getText().toString());
BasicNameValuePair startTime = new BasicNameValuePair("s_time",btnstartTime.getText().toString());
BasicNameValuePair endTime = new BasicNameValuePair("e_time",btnendTime.getText().toString());
BasicNameValuePair longtitude = new BasicNameValuePair(Constants.TAG_LONG,String.valueOf(lonlat.longitude));
BasicNameValuePair latitude = new BasicNameValuePair(Constants.TAG_LAT,String.valueOf(lonlat.latitude));
BasicNameValuePair event_type = new BasicNameValuePair("event_type",String.valueOf(privateEventCbox.isChecked()));
BasicNameValuePair gender = new BasicNameValuePair(Constants.TAG_GEN,String.valueOf(genderSpinner.getSelectedItem().toString()));
BasicNameValuePair min_age = new BasicNameValuePair("minAge",String.valueOf(minAgeEditText.getText()));
BasicNameValuePair participants = new BasicNameValuePair("max_participants",maxParticipantsEdittext.getText().toString());
BasicNameValuePair scheduled = new BasicNameValuePair("scheduled",String.valueOf(reccuringEventCbox.isChecked()));
BasicNameValuePair mob_manager = new BasicNameValuePair("manager",sm.getUserDetails().get(Constants.TAG_USERID));
BasicNameValuePair manager_name = new BasicNameValuePair("manager_name",sm.getUserDetails().get(Constants.TAG_NAME));
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
if(mode.equals(Constants.MODE_UPDATE)){
BasicNameValuePair eventId = new BasicNameValuePair("event_id",event_id);
nameValuePairList.add(eventId);
}
if(invitedUsers != null)
{
if(invitedUsers.size() > 0)
{
String[] users = new String[invitedUsers.size()];
JSONArray invited = new JSONArray();
for(int i=0 ; i < invitedUsers.size(); i++)
{
if(mode.equals(Constants.MODE_CREATE))
users[i]= invitedUsers.get(i).getMobile();
else
users[i]= invitedUsers.get(i).getId();
invited.put(users[i]);
}
String json = invited.toString();
Log.d("string array", Arrays.toString(users));
BasicNameValuePair invitedusers = new BasicNameValuePair("invitedUsers",Arrays.toString(users));
BasicNameValuePair jsonInvited = new BasicNameValuePair("jsoninvited",json);
nameValuePairList.add(invitedusers);
nameValuePairList.add(jsonInvited);
}
}
if(sched_res != null && reccuringEventCbox.isChecked() == true){
String repeatval ="";
String duration ="";
String tag = "";
String val = "";
BasicNameValuePair sched_val = null;
try {
repeatval = sched_res.getString("repeat");
duration = sched_res.getString("duration");
JSONArray jsonarr = new JSONArray(sched_res.getString("radio_group"));
tag = jsonarr.getJSONObject(0).getString(Constants.TAG_REQUEST);
sched_val = new BasicNameValuePair("value",jsonarr.getJSONObject(0).getString("val"));
} catch (JSONException e) {
e.printStackTrace();
}
BasicNameValuePair sched_repeat = new BasicNameValuePair("repeat",repeatval);
BasicNameValuePair sched_duration = new BasicNameValuePair("duration",duration);
BasicNameValuePair sched_tag = new BasicNameValuePair("sched_tag",tag);
nameValuePairList.add(sched_repeat);
nameValuePairList.add(sched_duration);
nameValuePairList.add(sched_tag);
if(sched_val != null)
nameValuePairList.add(sched_val);
}
nameValuePairList.add(manager_name);
nameValuePairList.add(mob_manager);
nameValuePairList.add(tagreq);
nameValuePairList.add(mode_req);
nameValuePairList.add(sport);
nameValuePairList.add(date);
nameValuePairList.add(address);
nameValuePairList.add(startTime);
nameValuePairList.add(endTime);
nameValuePairList.add(min_age);
nameValuePairList.add(longtitude);
nameValuePairList.add(latitude);
nameValuePairList.add(event_type);
nameValuePairList.add(participants);
nameValuePairList.add(scheduled);
nameValuePairList.add(gender);
dbController = new DBcontroller(getActivity().getApplicationContext(),this);
dbController.execute(nameValuePairList);
}
after searching for a while i solved this issue by:
add this code in my server side:
if(!mysqli_set_charset($dblink, 'utf8')) {
echo 'the connection is not in utf8';
exit();
}

PayPal adaptive payment API Add item details + shipping cost

i'm using paypal adaptive payment API.
When a user submit the buy button on my site he redirect to paypal page,
in the paypal page he see only the cost amount for the item, and the seller store name. no shiping details , no item details . just seller name + amount.
what i'm missing?
how can i add the shiping cost + the item details to the paypal page .
here is what i done so far:
$receiver[0] = new Receiver();
$receiver[0]->amount = $total_amount;
$receiver[0]->email = $seller_email;
$itemData[0] = new InvoiceItem();
$itemData[0]->name = "test_item";
$itemData[0]->identifier = "123";
$itemData[0]->price = "10.00";
$itemData[0]->itemCount = "1";
$itemData[0]->itemPrice = "10.00";
$invoiceData->totalTax = "0";
$invoiceData->totalShipping = "10";
$invoiceData->item = $itemData;
$senderOptions = new SenderOptions();
$senderOptions->addressOverride = "1";
$senderOptions->requireShippingAddressSelection = "1";
$receiverOptions = new ReceiverOptions();
$receiverOptions->customId = "customID";
$receiverOptions->receiver = $receiverInvoice;
$receiverOptions->invoiceData = $invoiceData;
$receiverOptions->SenderOptions = $senderOptions;
$receiverList = new ReceiverList($receiver);
$requestEnvelope = new RequestEnvelope("en_US");
$payRequest = new PayRequest();
$payRequest->requestEnvelope = $requestEnvelope;
$payRequest->receiverOptions = $receiverOptions;
$payRequest->receiverList = $receiverList;
$payRequest->actionType = "PAY";
$payRequest->cancelUrl = "http://pay.php?success=cancel";
$payRequest->returnUrl = "http://pay.php?success=true";
$payRequest->currencyCode = "USD";
$payRequest->ipnNotificationUrl = "http://replaceIpnUrl.com";
$adaptivePaymentsService = new AdaptivePaymentsService($sdkConfig);
$payResponse = $adaptivePaymentsService->Pay($payRequest);
$ack = strtoupper($payResponse->responseEnvelope->ack);
if ($ack == "SUCCESS") {
$payKey = $payResponse->payKey;
$payPalURL = PAYPAL_REDIRECT_URL. $payKey;
} else {
die();
}
header('Location:' . $payPalURL);

Laravel Eloquent Save Item Error?

When I try saving an item's to my database I get
Method Clients::__toString() must return a string value
Current code
$name = Input::get('email');
$client = Input::get('client');
$website = Input::get('website');
$userassign = Input::get('userassign');
$client = new Clients();
$client->name = $name;
$client->client = $client;
$client->website = $website;
$client->parent = $userassign;
$client->save();
Any ideas?
You're redefining $client.
$name = Input::get('email');
$clientInput = Input::get('client');
$website = Input::get('website');
$userassign = Input::get('userassign');
$client = new Clients();
$client->name = $name;
$client->client = $clientInput; //Here was your problem
$client->website = $website;
$client->parent = $userassign;
$client->save();

Adding a new Address to a Customer Record with Netsuite PHPToolKit

I am looking to add a new Address to an existing customers AddressBook. I am able to add an address for a new customer, but when adding/updating an address to an existing customer, the InternalID of the customform to update the address is a negative number which netsuite is rejecting. Is my code off, or is there a different customform I need to update.
$shipService = new NetSuiteService();
$gr = new GetRequest();
$gr->baseRef = new RecordRef();
$gr->baseRef->internalId = $internalId;
$gr->baseRef->type = "customer";
$getResponse = $shipService->get($gr);
//look in response for customer record
$customer = $getResponse->readResponse->record;
//add new address
$address = new CustomerAddressBook();
$address->defaultShipping = true;
$address->defaultBilling = true;
$address->attention = $customer_first . ' ' . $customer_last;
$address->addr1 = $customer_addr1;
$address->addr2 = $customer_addr2;
$address->city = $customer_city;
$address->zip = $customer_zip;
$address->state = $customer_state;
//add new Address book list
$addressBook = new CustomerAddressbookList();
$addressBook->addressbook = array($address);
$addressBook->replaceAll = false;
//add address book to customer record
$customer->addressbookList = $addressBook;
$shipService2 = new NetSuiteService();
$addrRequest = new UpdateRequest();
$addrRequest->record = $customer;
$addrResponse = $shipService2->update($addrRequest);
this returns
"Invalid customform reference key -10002."
The solution is to actually create a New Customer(); instead of doing a baseref to an existing customer. It is still an update request, but you assign the update to the internalId of an existing customer. So, the address update code looks like this:
$shipService = new NetSuiteService();
$address = new CustomerAddressBook();
$address->defaultShipping = true;
$address->defaultBilling = true;
$address->attention = $customer_first.' '.$customer_last;
$address->addr1 = $customer_addr1;
$address->addr2 = $customer_addr2;
$address->city = $customer_city;
$address->zip = $customer_zip;
$address->state = $customer_state;
$addressBook = new CustomerAddressbookList();
$addressBook->addressbook = array($address);
$addressBook->replaceAll = false;
$customer = new Customer();
$customer->addressbookList = $addressBook;
$customer->internalId = $internalId;
$customer->customForm = new RecordRef();
$customer->customForm->internalId = 24;
$customer->addressbookList = $addressBook;
$shipService2 = new NetSuiteService();
$addrRequest = new UpdateRequest();
$addrRequest->record = $customer;
$addrResponse = $shipService2->update($addrRequest);
This seems very odd to me. Try setting the customform to the internal ID of a Customer form that is active in NetSuite (-2) is the standard Customer form, but make sure it is not inactive before using it.
Other than that, I'd say you have to look at other scripts or workflows that could interfere with your script, such as one that would process some beforeSubit functionality.

Create Booking with Temando API

I am testing Temando API and trying to create a Booking. I have followed the instructions given by their manual Temando API R1_11 Developers Guide.
My problem is that when I create the call makeBookingByRequest with the following required information:
Anythings, Anywhere, Anytime, General, Origin, Destination, Quote, Payment, Instructions, Comments, Promotion Code.
It returns an error 500 : Internal Server Error. If it's something got to do with the permission, I have already fixed that.
By the way here's the rest of my code:
ini_set("soap.wsdl_cache_enabled", "1");
$client = new SoapClient("https://training-api.temando.com/schema/XXXX/server.wsdl", array('soap_version' => SOAP_1_2));
$username = "xxxxxxxxxx";
$password = "xxxxxxxxxx";
$headerSecurityStr = "<Security><UsernameToken><Username>".$username."</Username><Password>".htmlentities($password)."</Password></UsernameToken></Security>";
$headerSecurityVar = new SoapVar($headerSecurityStr, XSD_ANYXML);
$soapHeader = new SoapHeader('wsse:http://schemas.xmlsoap.org/ws/2002/04/secext', 'soapenv:Header', $headerSecurityVar);
$client->__setSoapHeaders(array($soapHeader));
$destination = array();
$destination["destinationCountry"] = "AU";
$destination["destinationCode"] = "2000";
$destination["destinationSuburb"] = "Sydney";
$destination["destinationIs"] = "Residence";
$destination["destinationResPostalBox"] = "N";
$destination["destinationResUnattended"] = "N";
$destination["destinationResInside"] = "N";
$destination["destinationResLimitedAccess"] = "N";
$destination["destinationResHeavyLift"] = "N";
$origin = array();
$origin["originDescription"] = "ABC Suppliers";
$origin["originBusUnattended"] = "N";
$origin["originBusInside"] = "N";
$origin["originBusHeavyLift"] = "N";
$origin["originBusTailgateLifter"] = "N";
$origin["originBusContainerSwingLifter"] = "N";
$quote = array();
$quote["totalPrice"] = "110.00";
$quote["basePrice"] = "100.00";
$quote["tax"] = "10.00";
$quote["currency"] = "AUD";
$quote["deliveryMethod"] = "Off-peak";
$quote["etaFrom"] = "2";
$quote["etaTo"] = "3";
$quote["guaranteedEta"] = "Y";
$payment = array();
$payment["paymentType"] = "Credit Card";
$payment["cardType"] = "Mastercard";
$payment["cardExpiryDate"] = "05-2010";
$payment["cardNumber"] = "5163190000000000";
$payment["cardName"] = "JANE DOE";
$comments = "No Comment";
$reference = "ABC200000";
$makeBookingByRequest = array();
$makeBookingByRequest["anything"] = $anything1;
$makeBookingByRequest["anytime"] = $anytime;
$makeBookingByRequest["anywhere"] = $anywhere;
$makeBookingByRequest["general"] = $general;
$makeBookingByRequest["origin"] = $origin;
$makeBookingByRequest["destination"] = $destination;
$makeBookingByRequest["quote"] = $quote;
$makeBookingByRequest["payment"] = $payment;
$makeBookingByRequest["instructions"] = $instructions;
$makeBookingByRequest["comments"] = $comments;
$makeBookingByRequest["reference"] = $reference;
$anythings = array();
$anything1 = array();
$anything1["class"] = "Freight";
$anything1["mode"] = "Less than load";
$anything1["packaging"] = "Carton";
$anything1["qualifierFreightGeneralFragile"] = "N";
$anything1["distanceMeasurementType"] = "Centimetres";
$anything1["weightMeasurementType"] = "Kilograms";
/** get the data below from POST DATA **/
$anything1["length"] = "30";
$anything1["width"] = "10";
$anything1["height"] = "10";
$anything1["weight"] = "10";
$anything1["quantity"] = "1";
$anything1["description"] = "Contains bottle lids and liquors.";
/*****************/
array_push($anythings, $anything1);
$anywhere = array();
$anywhere["itemNature"] = "Domestic";
$anywhere["itemMethod"] = "Door to Door";
$anywhere["originCountry"] = "AU";
$anywhere["originCode"] = "4000";
$anywhere["originSuburb"] = "Brisbane";
$anywhere["originIs"] = "Business";
$anywhere["originBusUnattended"] = "N";
$anywhere["originBusDock"] = "Y";
$anywhere["originBusForklift"] = "N";
$anywhere["originBusLoadingFacilities"] = "N";
$anywhere["originBusInside"] = "N";
$anywhere["originBusLimitedAccess"] = "N";
$anywhere["originBusHeavyLift"] = "N";
$anywhere["originBusTailgateLifter"] = "N";
$anywhere["originBusContainerSwingLifter"] = "N";
$anywhere["destinationCountry"] = "AU";
$anywhere["destinationCode"] = "2000";
$anywhere["destinationSuburb"] = "Sydney";
$anywhere["destinationIs"] = "Residence";
$anywhere["destinationResPostalBox"] = "N";
$anywhere["destinationResUnattended"] = "N";
$anywhere["destinationResInside"] = "N";
$anywhere["destinationResLimitedAccess"] = "N";
$anywhere["destinationResHeavyLift"] = "N";
$anytime = array();
$anytime["readyDate"] = "2012-06-01";
$anytime["readyTime"] = "PM";
$general = array();
$general["goodsValue"] = "2000.00";
call method:
try{
$makeBookingByRequestResponse = $client->makeBookingByRequest($makeBookingByRequest);
p($makeBookingByRequestResponse);
}catch (SoapFault $exception){
p($exception);
// Nothing is done with the exception yet. Will be processed later in the display code.
}
function p($arr){
echo '<pre>';
print_r($arr);
echo '</pre>';
}
Is there anyone who has experience in using Temando API? Any help would be appreciated.
Try to create your SOAP request using soapUI. It's a free software very useful to deal with SOAP web services. When it works, you can focus on build this request using PHP.

Categories