File tree Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -116,9 +116,9 @@ This package type is only available for shipments in the Netherlands that fit in
116
116
$parcel->mailboxpackage();
117
117
```
118
118
119
- ### Send a shipment to a pick up location
119
+ ### Send a shipment to a service point
120
120
121
- You can set set the package to be delivered to a pick up location when you create a parcel:
121
+ You may send a parcel to a PostNL service point where a customer can pick up the parcel:
122
122
123
123
``` php
124
124
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
@@ -136,16 +136,24 @@ $parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
136
136
]);
137
137
```
138
138
139
- Or you may set the pick up location after you have created the parcel:
139
+ ### Retrieving service points
140
+
141
+ ``` php
142
+ $servicepoints = $myparcel->servicePoints->setPostalcode('1234AA')->setHousenumber('1')->get();
143
+ ```
144
+
145
+ This will return a collection of ` ServicePoint ` objects:
146
+
140
147
```
141
- $parcel->pickup = [
142
- 'name' => 'Name of the location',
143
- 'street' => 'Poststraat',
144
- 'number' => '1',
145
- 'postal_code' => '1234AA',
146
- 'city' => 'Amsterdam',
147
- 'cc' => 'NL,
148
- ];
148
+ $servicepoints->each(function ($item) {
149
+ $item->id;
150
+ $item->name;
151
+ $item->latitude;
152
+ $item->longitude;
153
+ $item->distance;
154
+ $item->distanceForHumans();
155
+ $item->opening_hours;
156
+ });
149
157
```
150
158
151
159
### Get a shipment
Original file line number Diff line number Diff line change @@ -62,16 +62,11 @@ protected function boot()
62
62
/**
63
63
* Get delivery options for an address based on postal code and house number.
64
64
*
65
- * @param string $postal_code
66
- * @param int $housenumber
67
65
* @param array $filters
68
66
* @return \Tightenco\Collect\Support\Collection
69
67
*/
70
- public function get ($ postal_code , $ housenumber , array $ filters = [])
68
+ public function get (array $ filters = [])
71
69
{
72
- $ this ->setPostalCode ($ postal_code );
73
- $ this ->setHousenumber ($ housenumber );
74
-
75
70
$ response = $ this ->performApiCall (
76
71
'GET ' ,
77
72
'delivery_options ' . $ this ->buildQueryString ($ this ->getFilters ($ filters ))
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public function setting_an_invalid_housenumber_throws_exception()
85
85
*/
86
86
public function it_can_retrieve_delivery_options ()
87
87
{
88
- $ locations = $ this ->servicePoints ->get ('1012NP ' , '2 ' )->take (2 );
88
+ $ locations = $ this ->servicePoints ->setPostalcode ('1012NP ' )-> setHousenumber ( '2 ' )-> get ( )->take (2 );
89
89
90
90
$ this ->assertInstanceOf (\Tightenco \Collect \Support \Collection::class, $ locations );
91
91
$ this ->assertEquals (2 , $ locations ->count ());
You can’t perform that action at this time.
0 commit comments