File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,13 @@ public function createOrder($shipment_ids) {
251251 $ this ->sendPutRequest ('orders ' , $ request );
252252 $ data = $ this ->convertResponse ($ this ->getResponse ()->data );
253253 $ this ->closeSocket ();
254+ if (!is_array ($ data )) {
255+ return new Order ([
256+ 'order_id ' => 'None ' ,
257+ 'creation_date ' => new \DateTime (),
258+ 'manifest_pdf ' => $ data ,
259+ ]);
260+ }
254261
255262 if (array_key_exists ('errors ' , $ data )) {
256263 foreach ($ data ['errors ' ] as $ error ) {
@@ -476,7 +483,7 @@ private function closeSocket() {
476483 private function convertResponse ($ data ) {
477484 $ response = json_decode ($ data , true );
478485 if ($ data && is_null ($ response )) {
479- throw new \ Exception ( ' Could not decode response ' );
486+ return $ data ; // Could be an inline pdf
480487 }
481488 return $ response ;
482489 }
You can’t perform that action at this time.
0 commit comments