Payment api multidimensional array issue in php - php

My payment provider issued the following example code for their API:
$order = $mollie->orders->create([
"amount" => [
"value" => "1027.99",
"currency" => "EUR"
],
"billingAddress" => [
"streetAndNumber" => "Keizersgracht 313",
"postalCode" => "1016 EE",
"city" => "Amsterdam",
"country" => "nl",
"givenName" => "Luke",
"familyName" => "Skywalker",
"email" => "luke#skywalker.com",
],
"shippingAddress" => [
"streetAndNumber" => "Keizersgracht 313",
"postalCode" => "1016 EE",
"city" => "Amsterdam",
"country" => "nl",
"givenName" => "Luke",
"familyName" => "Skywalker",
"email" => "luke#skywalker.com",
],
"metadata" => [
"order_id" => $orderId
],
"consumerDateOfBirth" => "1958-01-31",
"locale" => "en_US",
"orderNumber" => strval($orderId),
"redirectUrl" => "{$protocol}://{$hostname}{$path}/orders/return.php?order_id={$orderId}",
"webhookUrl" => "{$protocol}://{$hostname}{$path}/orders/webhook.php",
"method" => "ideal",
"lines" => [
[
"sku" => "5702016116977",
"name" => "LEGO 42083 Bugatti Chiron",
"productUrl" => "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083",
"imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$',
"quantity" => 2,
"vatRate" => "21.00",
"unitPrice" => [
"currency" => "EUR",
"value" => "399.00"
],
"totalAmount" => [
"currency" => "EUR",
"value" => "698.00"
],
"discountAmount" => [
"currency" => "EUR",
"value" => "100.00"
],
"vatAmount" => [
"currency" => "EUR",
"value" => "121.14"
]
],
[
"type" => "digital",
"sku" => "5702015594028",
"name" => "LEGO 42056 Porsche 911 GT3 RS",
"productUrl" => "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056",
"imageUrl" => 'https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$',
"quantity" => 1,
"vatRate" => "21.00",
"unitPrice" => [
"currency" => "EUR",
"value" => "329.99"
],
"totalAmount" => [
"currency" => "EUR",
"value" => "329.99"
],
"vatAmount" => [
"currency" => "EUR",
"value" => "57.27"
]
]
]
]);
What I'd like to do is to replace the hard coded second dimension "lines" with data from these session vars.
foreach ($_SESSION['cart_products'] as $cart_itm) {
$name = $cart_itm['cat_item_titel_' . $lang . ''];
$unitPrice = $cart_itm['cat_item_prijs'];
$sku = $cart_itm['cat_item_code'];
}
And this is the solution I came up with but this just doesn't work. The reason, I assume, is that the data in the $orders array is echoed as a string and not functional code as i should be. But I haven't got a clue how to aproach this issue.
$i = 0;
$lngth = count($_SESSION['cart_products']);
foreach ($_SESSION['cart_products'] as $cart_itm) {
$orders[] = '[';
$orders[] .= '"sku" => ' . $cart_itm['cat_item_code'] . ',';
$orders[] .= '"name" => ' . $cart_itm['cat_item_titel_en'] . ',';
$orders[] .= '"quantity" => 1,';
$orders[] .= '"vatRate" => "0.00",';
$orders[] .= '"unitPrice" => [
"currency" => "EUR",
"value" => "15.50"],';
$orders[] .= '"totalAmount" => [
"currency" => "EUR",
"value" => "15.50"],';
$orders[] .= '"vatAmount" => [
"currency" => "EUR",
"value" => "0.00"]';
if ($i == $lngth - 1) {
$orders[] .= ']';
}
else {
$orders[] .= '],';
}
$i++;
}
$echoOrders = implode($orders);
$order = $mollie->orders->create([
"amount" => [
"value" => "15.50",
"currency" => "EUR"
],
"billingAddress" => [
"streetAndNumber" => $address,
"postalCode" => $postalcode,
"city" => $city,
"country" => $country,
"givenName" => $firstname,
"familyName" => $name,
"email" => $email,
],
"shippingAddress" => [
"streetAndNumber" => $addressa,
"postalCode" => $postalcodea,
"city" => $citya,
"country" => $countrya,
"givenName" => $firstnamea,
"familyName" => $namea,
"email" => $email,
],
"metadata" => [
"order_id" => $orderId
],
"locale" => "nl_BE",
"orderNumber" => strval($orderId),
"redirectUrl" => "{$protocol}://{$hostname}{$path}/thankyou.php?order_id={$orderId}",
"webhookUrl" => "https://www.cluster-park.com/dev/includes/webhook.php",
"lines" => [ $echoOrders ]
]);
All suggestions are more than welcome.
Thanks!

You need to build an associative array, at the moment you are building a string. This should give you a starting point...
$lines = [];
foreach ($_SESSION['cart_products'] as $cart_itm) {
$lines[] = [ "sku" => $cart_itm['cat_item_code'],
"name" => $cart_itm['cat_item_titel_en'],
"quantity" => 1,
"vatRate" => "0.00",
"unitPrice" => [
"currency" => "EUR",
"value" => "15.50"]
],
// Add all of the other data you have
];
}
then later in your code, you add them in using...
"lines" => $lines

Related

echo a list of values by foreach loop in a multidimensional array in PHP [duplicate]

This question already has answers here:
Can I get all keys of an multi level associative arrays in php
(5 answers)
Closed last year.
In PHP I want to echo some values in the array by foreach loop, but I don't know how to do this.
I tried many ways such as $key => $value and print_r or echo codes but They didn't work.
for example in this array I want to echo all score values one by one:
$students = array(
"Beginner" => [
"levelA" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
"levelB" => [
[
"firstname" => "peyman",
"lastname" => "tabibi",
"phonenumber" => 933964353,
"score" => 50
],
[
"firstname" => "pari",
"lastname" => "ehsani",
"phonenumber" => 9175389988,
"score" => 75
],
],
],
"Intermediate" => [
"levelD" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
"levelE" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
],
);
I tried with these codes but I couldn't do it:
// foreach ($students as $key => $value) {
// if ($value < 75)continue;
// print_r($key);echo "<br>";
// print_r($value); echo "<br>";
// echo "$key : {$value["levelA"][0]["firstname"]}
// {$value["levelA"][0]["lastname"]} <br>";
// }
I would be very grateful if anyone could help me.
If only the scores are what you want you could simply use array_walk_recursive as below.
array_walk_recursive($students, function($val, $key) {
if ($key === 'score') {
echo "score: $val" . PHP_EOL;
}
});
Result:
score: 100
score: 80
score: 50
score: 75
score: 100
score: 80
score: 100
score: 80
For the next time, just RTFM and use var_dunp. for debugging.
foreach($students as $outerKey => $outerValue)
{
foreach($outerValue as $key => $value)
{
for($i = 0; $i<count($value); $i++)
{
echo $value[$i]['score'].'<br/>';
}
}
}
Outputs:
100
80
50
75
100
80
100
80
$students = array(
"Beginner" => [
"levelA" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
"levelB" => [
[
"firstname" => "peyman",
"lastname" => "tabibi",
"phonenumber" => 933964353,
"score" => 50
],
[
"firstname" => "pari",
"lastname" => "ehsani",
"phonenumber" => 9175389988,
"score" => 75
],
],
],
"Intermediate" => [
"levelD" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
"levelE" => [
[
"firstname" => "Pouya",
"lastname" => "Parsaei",
"phonenumber" => 9339658613,
"score" => 100
],
[
"firstname" => "Ali",
"lastname" => "Soli",
"phonenumber" => 9179892233,
"score" => 80
],
],
],
);
foreach ($students as $key => $value) {
echo $key . ': <br> <br>';
foreach ($value as $key => $value_1) {
echo $key . ': <br><br>';
foreach ($value_1 as $key => $value_2) {
$key++;
echo 'Serial Number: ' . $key . '<br> First Name: ' . $value_2['firstname'] . '<br> Last Name: ' . $value_2['lastname'] .
'<br> Phone Number: ' . $value_2['phonenumber'] . '<br> Score: ' . $value_2['score'] . '<br><br>';
}
}
}
Result Image

PHP merging arrays by multiple factors

I have an array of arrays like so:
[
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "GBP",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
"color" => "red",
"size" => "large",
"refundAllowed" => true,
"method" => "deniero"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "GBP",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 9.99,
"color" => "blue",
"size" => "small",
"refundAllowed" => true,
"method" => "BTC"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "HomeWare",
"Currency" => "GBP",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99,
"color" => "yellow",
"size" => "small",
"refundAllowed" => true,
"method" => "deniero"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
"color" => "green",
"size" => "medium",
"refundAllowed" => true,
"method" => "cash"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 9.99,
"color" => "pink",
"size" => "medium",
"refundAllowed" => true,
"method" => "cash"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "HomeWare",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99,
"color" => "blue",
"size" => "medium",
"refundAllowed" => true,
"method" => "card"
],
[
"reference" => "CUSTOMER-USA",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
"color" => "yellow",
"size" => "small",
"refundAllowed" => true,
"method" => "card",
],
[
"reference" => "CUSTOMER-USA",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 9.99,
"color" => "blue",
"size" => "XXL",
"refundAllowed" => true,
"method" => "cash"
],
[
"reference" => "CUSTOMER-USA",
"Type" => "HomeWare",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99, ,
"color" => "blue",
"size" => "small",
"refundAllowed" => true,
"method" => "cash"
]
]
I am trying to loop through this array and merge them based on these rules:
If the reference, type, currency, shoppingBreakdownType, method are an exact match, then they should be merged into a single array with the difference in breakdowns added as new sub arrays like so:
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "GBP",
"color" => "red",
"size" => "large",
"refundAllowed" => true,
"method" => "deniero",
"breakdownTypes": [
{
"shoppingBreakdownType" => "Mens",
"breakdowns": [
{
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
},
{
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99
}
]
}
]
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "GBP",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 9.99,
"color" => "blue",
"size" => "small",
"refundAllowed" => true,
"method" => "BTC"
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
"color" => "green",
"size" => "medium",
"refundAllowed" => true,
"method" => "cash",
"breakdownTypes": [
{
"shoppingBreakdownType" => "Mens",
"breakdowns": [
{
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
},
{
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 1.99
}
]
}
]
],
[
"reference" => "CUSTOMER-USA",
"Type" => "Clothing",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
"color" => "yellow",
"size" => "small",
"refundAllowed" => true,
"method" => "card",
"breakdownTypes": [
{
"shoppingBreakdownType" => "Mens",
"breakdowns": [
{
"shoppingBreakdown" => "socks",
"shoppingBreakdownPrice" => 3.99,
},
{
"shoppingBreakdown" => "Trousers",
"shoppingBreakdownPrice" => 9.99,
},
{
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99,
}
]
}
]
],
[
"reference" => "CUSTOMER-LONDON",
"Type" => "HomeWare",
"Currency" => "USD",
"shoppingBreakdownType" => "Mens",
"shoppingBreakdown" => "towel",
"shoppingBreakdownPrice" => 1.99,
"color" => "blue",
"size" => "medium",
"refundAllowed" => true,
"method" => "card"
]
as you can see, where those 5 values match. Then then a new child array is created called breakdownTypes, which has arrays grouped by shoppingBreakdownType with multiple items stored as arrays in breakdowns
I have spent nearly two days trying foreach loops and filters but I seem to get stuck in the loops and am unable to to get previous iteration data etc..
Is there a simple way to do this?
You can try something like this:
You compared some of the subarrays keys to make the merge, but other keys like color are not considered and they could have different values, in this situation I preserve the first subarray value.
I don't unset subarrays values (shoppingBreakdown, shoppingBreakdownPrice, etc) because in your example in one case you unset them and in other case you don't. Unset lines are commented. You can't unset shoppingBreakdownType there because you need it to compare.
I don't compare shoppingBreakdown and shoppingBreakdownPrice to check if they are equal or not when two subarrays match, I put both of them into breakdownTypes.
<?php
$res = array();
$keysToCompare = array("reference", "Type", "Currency", "shoppingBreakdownType", "method");
foreach($data as $dataSubArray) {
$find = false;
foreach($res as $resKey => $resSubArray) {
$same = true;
foreach($keysToCompare as $key) {
if($dataSubArray[$key] != $resSubArray[$key]) {
$same = false;
}
}
if($same) {
$find = true;
break;
}
}
if($find) {
if(array_key_exists("breakdownTypes", $res[$resKey])) {
$res[$resKey]["breakdownTypes"]["breakdowns"][] = array("shoppingBreakdown" => $dataSubArray["shoppingBreakdown"], "shoppingBreakdownPrice" => $dataSubArray["shoppingBreakdownPrice"]);
} else {
$res[$resKey]["breakdownTypes"] = array("shoppingBreakdownType" => $res[$resKey]["shoppingBreakdownType"],
"breakdowns" => array (array("shoppingBreakdown" => $res[$resKey]["shoppingBreakdown"], "shoppingBreakdownPrice" => $res[$resKey]["shoppingBreakdownPrice"]),
array("shoppingBreakdown" => $dataSubArray["shoppingBreakdown"], "shoppingBreakdownPrice" => $dataSubArray["shoppingBreakdownPrice"]))
);
/*
unset($res[$resKey]["shoppingBreakdown"]);
unset($res[$resKey]["shoppingBreakdownPrice"]);
*/
}
$find = false;
} else {
$res[] = $dataSubArray;
}
}
?>

Correct Logic for PHP Array

I need to produce an output like this:
{
"properties": [
{
"name": "name",
"value": "A company name"
},
{
"name": "description",
"value": "A company description"
}
]
}
And i've written the logic as such:
$data = array(
"properties" => array(
"name" => "name",
"value" => $companyname,
"name" => "address",
"value" => $AddressLine1,
"name" => "address2",
"value" => $AddressLine2,
"name" => "address3",
"value" => $AddressLine3,
"name" => "locality",
"value" => $Locality,
"name" => "city",
"value" => $Town,
"name" => "state",
"value" => $County,
"name" => "zip",
"value" => $PostCode,
"name" => "country",
"value" => $Country,
"name" => "phone",
"value" => $Telephone,
"name" => "domain",
"value" => $Website,
"name" => "lead_forensics_business_id",
"value" => $hubspotcompanyid
)
);
Can someone highlight the correct way to produce the above output?
Each name and value pair should be their own arrays. Like this:
$data = [
"properties" => [
[
"name" => "name",
"value" => $companyname,
],
[
"name" => "address",
"value" => $AddressLine1,
],
// And so on
]
];
(I've opted for the shorthand version of creating arrays [] instead of array() since it's, in my opinion, easier to read).
This should do the trick if i remember correctly:
$data = array(
"properties" => array(
array(
"name" => "name",
"value" => $companyname
),
array(
"name" => "address",
"value" => $AddressLine1
),
...
)
);
PHP automatically builds an {} or [] depending on the contents.
So u just use the array() function to build the entire structure.
Something like this ...
$data = array();
array_push($data, array('name' => 'name', 'value' => $companyname));
array_push($data, array('name' => 'address', 'value' => $AddressLine1));
array_push($data, array('name' => 'address2', 'value' => $AddressLine2));
$output = array();
$output['properties'] = $data;
echo json_encode($output);

Cannot create order Woocommerce rest Api php

I tried the following code and tried to post values from android to place an order but every time i test it on chrome it give http 500 error, and Android gives volly server error. Dont know where i am messing up, serious help would be appriciated. Thank You
Ask me if you need to take a look at the android Code, but i think that doesnot matter here because i am giving hard coded values in $data.
<?php
require_once( 'lib/woocommerce-api.php' );
$pageNum=1;
$pageNum=$_GET['page_num'];
$options = array(
'debug' => true,
'return_as_array' => false,
'validate_url' => false,
'timeout' => 30,
'ssl_verify' => false,
);
try {
$client = new WC_API_Client( 'https://www.move2mart.com/', 'ck_0afa3a49305683160fe34189553a660053bd4e6239', 'cs_7dc38a7b52c3fdd34qw61e34090be636ae3364b196', $options );
//$data=array();
$data=[
'payment_method' => 'cod',
'payment_method_title' => 'Cash on Delivery',
'set_paid' => false,
'billing' => [
'first_name' => 'John',
'last_name' => 'Doe',
'address_1' => '969 Market',
'city' => 'Karachi',
'email' => 'princeali#testing.com',
'phone' => '03123121995'
], 'line_items' => [
[
'product_id' => 779,
'quantity' => 1
]
]
];
print_r($client->post('orders', $data));
if($_POST !=null) {
}
else{
echo "Null POST Request";
}
} catch ( WC_API_Client_Exception $e ) {
echo $e->getMessage() . PHP_EOL;
echo $e->getCode() . PHP_EOL;
if ( $e instanceof WC_API_Client_HTTP_Exception ) {
print_r( $e->get_request() );
print_r( $e->get_response() );
}
}
$orderData = array(
"order" => array(
"billing_address" => array(
array(
"first_name" => "",
"last_name" => "",
"company" => "",
"address_1" => "",
"address_2" => "",
"city" => "",
"state" => "",
"postcode" => "",
"country" => "",
"email" => "",
"phone" => "",
)
),
"shipping_address" => array(
array(
"first_name" => "",
"last_name" => "",
"company" => "",
"address_1" => "",
"address_2" => "",
"city" => "",
"state" => "",
"postcode" => "",
"country" => "",
)
),
"customer_id" => 1,
"line_items" => array(
array(
"product_id" => 1,
"quantity" => 1
)
)
)
);
$client->orders->create($orderData);
Would you please try above code?
Finally, I figured it out after some research. Below is working code of woocommerce checkout webservice that may Help you -
/*** Just Copy & Paste and change your varriables **/
//do your initial stuff
header('Content-type: application/json');
$json_file=file_get_contents('php://input');
$jsonvalue= json_decode($json_file,true);
$user_id = $jsonvalue['user_id'];
$product_id = $jsonvalue['product_id'];
$quantity = $jsonvalue['quantity'];
//start order data
$orderData = array(
"order" => array(
'payment_method' => 'paypal',
'payment_method_title' => 'Paypal',
'set_paid' => true,
"billing_address" => array(
"first_name" => "bfname",
"last_name" => "blname",
"company" => "testcompanybilling",
"address_1" => "sec8",
"address_2" => "e32",
"city" => "noida",
"state" => "Noida",
"postcode" => "99999",
"country" => "IN",
"email" => "test#gmail.com",
"phone" => "888899999999"
),
"shipping_address" => array(
"first_name" => "sfname",
"last_name" => "slname",
"company" => "testcompanyshipping",
"address_1" => "shakkarpur",
"address_2" => "laxminigar",
"city" => "New Delhi",
"state" => "Delhi",
"postcode" => "110092",
"country" => "IN",
"email" => "testsh#gmail.com",
"phone" => "11009999"
),
"customer_id" => $user_id,
"line_items" => array(
array(
"product_id" => $product_id,
"quantity" => $quantity
)
),
'shipping_lines' => array(
array(
'method_id' => 'flat_rate',
'method_title' => 'Flat Rate',
'total' => 10
)
)
)
);
//Create order usind order data
$data = $client->orders->create($orderData);
//echo '<pre>';
//print_r($data);
$result['success']='true';
$result['error']="0";
$result['msg']='Your order has been successfully placed.';
$result['data']=$data;
echo json_encode($result); `
cheers!!!

PHP SOAP Object Reference Not Set to Reference of Object

I'm attempting to communicate with a SOAP Service to post some data to the database.
Here's the WSDL.
As you can see, the required data is quite cumbersome so apologies for the length of the code, you will need to scroll through to see everything. Here is how I am attempting to communicate with the service, however I'm getting the error System.NullReferenceException: Object reference not set to an instance of an object
PHP:
$soapClient = new soapClient("https://secure.quickflora.com/Admin/scripts/ws/QuickfloraOrders.asmx?WSDL");
$orderArray = array(
"Token" => $token,
"OrderErrorEmail" => "edwardsalexk#gmail.com",
"Billing" => array("CustomerID" => "1",
"FullName" => "Jack Nichols",
"FirstName" => "Jack",
"LastName" => "Nichols",
"Address1" => "9725 E Windrose Drive",
"Address2" => "",
"Address3" => "",
"City" => "Scottsdale",
"State" => "Arizona",
"Zip" => "85260",
"Phone"=> "4807218374",
"PhoneExt" => "123",
"Fax" => "1234",
"Email"=> "edwardsalexk#gmail.com",
"Cell" =>"480 721 8374",
),
"Shipping" => array("Attention "=> "Alexander",
"Salutation" => "Alexander",
"FirstName" => "Alexander",
"LastName" => "Edwards",
"Address1"=> "9725 E Windrose Drive",
"Address2" => "",
"Address3" => "",
"City"=>"Scottsdale",
"State" =>"Arizona",
"Zip" => "85260",
"Country" => "United States",
"Phone" => "480 721 8374",
"PhoneExt" => "123",
"Fax" => "123",
"Email" => "edwardsalexk#gmail.com",
"Cell" => "480 721 8374",
"CardMessage" => "I hope these flowers find you well!",
"DestinationType" => "House",
"DriverRouteInfo" => "None",
"Priority" => "Highest",
"Order Ship Date" => "4/20/2017",
),
"Payment" => array("MethodID" => "1",
"Check" =>array("Number" => "123",
"CheckID" => "1",
"ChkDate" => "4/20/2017,"),
"CreditCard" => array("TypeID" => "1",
"Name" => "Alexander Edwards",
"Account Number" => "12345678",
"Expiration Date" => "11/14/1993",
"SecurityCode" => "123",
"ApprovalCode" => "123")),
"WireServiceInfo" => array("WireService" => "Alexander Service",
"WireServiceCode" => "123",
"ReferenceID" => "123",
"TransmitMethod" => "123",
"RepresentativeTalkedTo" => "Alexander",
"FloristName" => "Alexander",
"FloristPhone" => "480 721 8734",
"FloristCity" => "Scottsdale",
"FloristState" => "Arizona"),
"Orderdetails" => array("OccasionCodeID" => "123",
"SourceCodeID" => "123",
"Comments" => "Hello",
"TaxGroupID" => "123",
"Currency" => array("ID" => "123",
"ExchangeRate" => 1.2),
"DeliveryCharge" => 12.5,
"ServiceCharge" => 12.5,
"Discounts" => array("Percentage" => 12.5,
"Amount" => 12.5),
"Tax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"GSTTax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"PSTTax" => array("Percentage" => 12.5,
"Amount" => 12.5),
"Total" => 123.34
),
"OrderItemsdetails" => array(
"Itemno" => array("String", "String"),
"Itemid" => array("String", "String"),
"UpcCode" => array("String", "String"),
"ItemName" => array("String", "String"),
"Description" => array("String", "String"),
"Quantity" => array("String", "String"),
"UnitOfMeasurement" => array("String", "String"),
"DiscountPercentage" => array("String", "String"),
"UnitPrice" => array("String", "String")
)
);
$response = $soapClient->PostOrder($orderArray);
echo var_dump($response);

Categories