File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -71,4 +71,15 @@ public function setSiteZipCode(?string $siteZipCode): Event
71
71
72
72
return $ this ;
73
73
}
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
+ }
74
85
}
Original file line number Diff line number Diff line change @@ -99,4 +99,16 @@ public function setDate(?string $date): Step
99
99
100
100
return $ this ;
101
101
}
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
+ }
102
114
}
Original file line number Diff line number Diff line change @@ -41,14 +41,17 @@ public function validateDataBeforeCall(array $dataToValidate): void
41
41
}
42
42
}
43
43
44
+ /**
45
+ * @throws TrackingRequestException
46
+ */
44
47
public function parseResponse ($ response ): TrackingResponse
45
48
{
46
49
$ responses = $ this ->slsResponseParser ->parse ($ response );
47
50
48
51
$ body = $ responses [0 ]['body ' ];
49
52
$ status = $ body ['status ' ][0 ];
50
53
if ($ status ['code ' ] !== "0 " ) {
51
- throw new TrackingRequestException ($ status ['message ' ]);
54
+ throw new TrackingRequestException ($ status ['message ' ], $ status [ ' code ' ] );
52
55
}
53
56
54
57
$ parcel = $ body ['parcel ' ];
You can’t perform that action at this time.
0 commit comments