@@ -75,6 +75,83 @@ class ServicesTest extends TestCase
75
75
'phone' => '+22123456',*/
76
76
];
77
77
78
+
79
+ /* public function test_add_packages_with_services()
80
+ {
81
+ $dpd = new DPDService();
82
+ $dpd->setSender($this->sender);
83
+
84
+ $services1 = [
85
+ 'declaredValue' => [
86
+ 'amount' => 10000,
87
+ 'currency' => 'PLN'
88
+ ]
89
+ ];
90
+
91
+ $services2 = [
92
+ 'guarantee' => [
93
+ 'type' => 'B2C',
94
+ 'value' => '15:00-18:00'
95
+ ]
96
+ ];
97
+
98
+ $services3 = [
99
+ 'cod' => [
100
+ 'amount' => 989.32,
101
+ 'currency' => 'PLN'
102
+ ]
103
+ ];
104
+
105
+ $services4 = [
106
+ 'inpers' => '',
107
+ 'carryin'
108
+ ];
109
+
110
+ $packages = [];
111
+
112
+ // prepare packages
113
+ array_push($packages, $dpd->createPackage($this->parcels, $this->receiver, 'SENDER', $services1, 'REF123'));
114
+ array_push($packages, $dpd->createPackage($this->parcels2, $this->receiver, 'SENDER', $services2, 'REF456'));
115
+ array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER', $services3, 'REF789'));
116
+ array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER', $services4));
117
+
118
+ $result = $dpd->sendPackages($packages);
119
+
120
+ $this->assertTrue(isset($result->packages) && count($result->packages) == count($packages));
121
+
122
+ // generate speedlabel
123
+ $speedlabel = $dpd->generateSpeedLabelsBySessionId($dpd->getSessionId(), $this->pickupAddress);
124
+ $this->assertTrue(isset($speedlabel->filedata));
125
+
126
+ // save speedlabel to pdf file
127
+ //file_put_contents('pdf/slbl-sid' . $dpd->getSessionId() . '.pdf', $speedlabel->filedata);
128
+
129
+ // generate protocol
130
+ $protocol = $dpd->generateProtocolBySessionId($dpd->getSessionId(), $this->pickupAddress);
131
+
132
+ $this->assertTrue(isset($protocol->filedata));
133
+
134
+ // save protocol to pdf file
135
+ //file_put_contents('pdf/prot-sid' . $dpd->getSessionId() . '.pdf', $protocol->filedata);
136
+
137
+ // pickup call
138
+ $pickupDate = '2017-08-23';
139
+ $pickupTimeFrom = '13:00';
140
+ $pickupTimeTo = '16:00';
141
+ $contactInfo = [
142
+ 'name' => 'Janusz Biznesu',
143
+ 'company' => 'INCO',
144
+ 'phone' => '12 5555555',
145
+ 'email' => 'januszbiznesu@_inco.pl',
146
+ 'comments' => 'proszę dzownić domofonem'
147
+
148
+ ];
149
+
150
+ $pickup = $dpd->pickupRequest([$protocol->documentId], $pickupDate, $pickupTimeFrom, $pickupTimeTo, $contactInfo, $this->pickupAddress);
151
+
152
+
153
+ }
154
+
78
155
public function test_add_package()
79
156
{
80
157
@@ -115,6 +192,7 @@ public function test_add_packages()
115
192
array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER'));
116
193
117
194
$result = $dpd->sendPackages($packages);
195
+
118
196
$this->assertTrue(isset($result->packages) && count($result->packages) == count($packages));
119
197
120
198
// generate speedlabel
@@ -150,6 +228,8 @@ public function test_add_packages()
150
228
151
229
}
152
230
231
+
232
+
153
233
154
234
public function test_post_code()
155
235
{
@@ -170,6 +250,15 @@ public function test_post_code()
170
250
$pc5 = $dpd->checkPostCode('00-000');
171
251
$this->assertFalse(isset($pc5->status) && $pc5->status == 'OK');
172
252
253
+ }*/
254
+
255
+ public function test_courier_availability ()
256
+ {
257
+ $ dpd = new DPDService ();
258
+
259
+ $ pc = $ dpd ->checkCourierAvailability ('33-100 ' );
260
+ $ this ->assertTrue (isset ($ pc ->status ) && $ pc ->status == 'OK ' );
261
+
173
262
}
174
263
175
264
}
0 commit comments