forked from gyorgygilanyi/dpd-shipping-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api-test.php
48 lines (38 loc) · 1.33 KB
/
api-test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
if (is_file(__DIR__ . '/vendor/autoload.php')) {
require __DIR__ . '/vendor/autoload.php';
}
$api = new DPD\API([
'username' => 'demo',
'password' => 'o2Ijwe2!',
'log_dir' => dirname(__FILE__).'/'
]);
// Parcel generation test
$parcel_generate = array(
'setName1' => 'Alex',
'setStreet' => 'Kesmark u 4',
'setCity' => 'Budapest',
'setCountry' => 'HU',
'setPcode' => '1158',
'setWeight' => '1',
'setNumOfParcel' => 1,
'setParcelType' => 'BC',
'setOrderNumber' => '1234',
'setCodAmount' => '',
'setCodPurpose' => '',
'setEmail' => '[email protected]',
'setPhone' => '0636516516',
'setSMSNumber' => '0636516516',
'setRemark' => 'Customer comments',
);
$parcel_number = $api->generateParcel($parcel_generate);
echo 'Number is: ' . $parcel_number . '<br>';
// Transfer parcel data test
//$number_parcels_sent = $api->transferData();
//echo $number_parcels_sent . ' Parcels are transfered to internal DPD DB<br>';
// Parcel status test
echo 'Status is: ' . $api->getParcelStatus($parcel_number).'<br>';
// Parcel delete test
//$parcel_delete_result = $api->deleteParcel(DPD\Form\ParcelDelete::newInstance()->setParcels($numbers[0]));
//
//echo "delete result: " . print_r(var_dump($parcel_delete_result), true);