File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,4 +71,15 @@ public function setSiteZipCode(?string $siteZipCode): Event
7171
7272 return $ this ;
7373 }
74+
75+ public function toArray (): array
76+ {
77+ return [
78+ 'date ' => $ this ->getDate (),
79+ 'code ' => $ this ->getCode (),
80+ 'labelLong ' => $ this ->getLabelLong (),
81+ 'siteName ' => $ this ->getSiteName (),
82+ 'siteZipCode ' => $ this ->getSiteZipCode (),
83+ ];
84+ }
7485}
Original file line number Diff line number Diff line change @@ -99,4 +99,16 @@ public function setDate(?string $date): Step
9999
100100 return $ this ;
101101 }
102+
103+ public function toArray (): array
104+ {
105+ return [
106+ 'id ' => $ this ->getStepId (),
107+ 'stepLabel ' => $ this ->getStepLabel (),
108+ 'longLabel ' => $ this ->getLongLabel (),
109+ 'status ' => $ this ->getStatus (),
110+ 'country ' => $ this ->getCountry (),
111+ 'date ' => $ this ->getDate (),
112+ ];
113+ }
102114}
Original file line number Diff line number Diff line change @@ -41,14 +41,17 @@ public function validateDataBeforeCall(array $dataToValidate): void
4141 }
4242 }
4343
44+ /**
45+ * @throws TrackingRequestException
46+ */
4447 public function parseResponse ($ response ): TrackingResponse
4548 {
4649 $ responses = $ this ->slsResponseParser ->parse ($ response );
4750
4851 $ body = $ responses [0 ]['body ' ];
4952 $ status = $ body ['status ' ][0 ];
5053 if ($ status ['code ' ] !== "0 " ) {
51- throw new TrackingRequestException ($ status ['message ' ]);
54+ throw new TrackingRequestException ($ status ['message ' ], $ status [ ' code ' ] );
5255 }
5356
5457 $ parcel = $ body ['parcel ' ];
You can’t perform that action at this time.
0 commit comments