Closed sunil11475-dev closed 2 years ago
https://github.com/zVPS/royal-mail-click-drop-rest-api-client/issues/4
Similar to this issue, going to guess it's a return type which needs switching to a string as PHP doesn't have an in-built type for this.
Have a look at the class it should be returning for this call and see what types have been declared :)
@Caffe1neAdd1ct I am using same libraries path for testing which used in live function.
I have attached the file in this post. Please check ObjectSerializer.txt
I have updated with new ObjectSerializer.php file and it showing error on ObjectSerializer.php on line 299
@Caffe1neAdd1ct found the solution - (float)
"packages" => array(
array(
"weightInGrams"=>(float)250,
"packageFormatIdentifier" => "largeLetter",
),
),
"orderDate" => gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z"),
"specialInstructions" => "",
"subtotal" => (float)0,
"shippingCostCharged" => (float)0,
"total" => (float)0,
Now, Another questions - I am try to add SKU and Qty on label - Is that correct way to do this - > https://github.com/zVPS/royal-mail-click-drop-rest-api-client/blob/main/docs/Model/ProductItemRequest.md
"packages" => array(
array(
"weightInGrams"=>(float)250,
"packageFormatIdentifier" => "largeLetter",
"contents" => array(
array("SKU" => 'Hello_Test1',"quantity" => (float)9),
array("SKU" => 'Hello_Test2',"quantity" => (float)3),
array("SKU" => 'Hello_Test3',"quantity" => (float)2)
)
),
),
@Caffe1neAdd1ct no worries. found the solution for this also -
["SKU" => (string)"Hello_Test3","quantity" =>(int)2,"unitValue"=>(float)0,"unitWeightInGrams"=>(float)0]
may help someone
thanks
I know it's duplicate question, I am sure I had this issue last year and @Caffe1neAdd1ct updated something which resolve this issue. So, I am trying to create test label request but i am getting below error. Now surprising thing is on my live server this code is working perfectly only having issue with test below code - I am adding the address and all details manually but not sure what is wrong?
Fatal error: Uncaught Error: Class 'BigDecimal' not found in application/libraries/royalmailcnd/vendor/zvps/royal-mail-click-and-drop-rest-api-client/lib/ObjectSerializer.php:293 Stack trace: #0 application/libraries/royalmailcnd/vendor/zvps/royal-mail-click-and-drop-rest-api-client/lib/ObjectSerializer.php(310): RoyalMail\ClickAndDrop\Rest\Api\ObjectSerializer::deserialize(0, 'BigDecimal', NULL) #1 application/libraries/royalmailcnd/vendor/zvps/royal-mail-click-and-drop-rest-api-client/lib/ObjectSerializer.php(310): RoyalMail\ClickAndDrop\Rest\Api\ObjectSerializer::deserialize(Object(stdClass), '\\RoyalMail\\Clic...', NULL) #2 application/libraries/royalmailcnd/vendor/zvps/royal-mail-click-and-drop-rest-api-client/lib/ObjectSerializer.php(246): RoyalMail\ClickAndDrop\Rest\Api\ObjectSerializer::deserialize(Object(stdClass), '\\RoyalMail\\Clic...', NULL) #3 application/libraries/royalmailcn in application/libraries/royalmailcnd/vendor/zvps/royal-mail-click-and-drop-rest-api-client/lib/ObjectSerializer.php on line 293
Data i am sending -