forked from JeremyDunn/php-fedex-api-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-pending-shipment.php
48 lines (36 loc) · 1.51 KB
/
delete-pending-shipment.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
48
<?php
require_once 'credentials.php';
require_once 'bootstrap.php';
use FedEx\ShipService;
use FedEx\ShipService\ComplexType;
use FedEx\ShipService\SimpleType;
$userCredential = new ComplexType\WebAuthenticationCredential();
$userCredential
->setKey(FEDEX_KEY)
->setPassword(FEDEX_PASSWORD);
$webAuthenticationDetail = new ComplexType\WebAuthenticationDetail();
$webAuthenticationDetail->setUserCredential($userCredential);
$clientDetail = new ComplexType\ClientDetail();
$clientDetail
->setAccountNumber(FEDEX_ACCOUNT_NUMBER)
->setMeterNumber(FEDEX_METER_NUMBER);
$version = new ComplexType\VersionId();
$version
->setServiceId('ship')
->setMajor(12)
->setIntermediate(1)
->setMinor(0);
$trackingId = new ComplexType\TrackingId();
$trackingId
->setTrackingNumber('12345')
->setTrackingIdType(SimpleType\TrackingIdType::_FEDEX);
$deleteShipmentRequest = new ComplexType\DeleteShipmentRequest();
$deleteShipmentRequest->setWebAuthenticationDetail($webAuthenticationDetail);
$deleteShipmentRequest->setClientDetail($clientDetail);
$deleteShipmentRequest->setVersion($version);
$deleteShipmentRequest->setTrackingId($trackingId);
$deleteShipmentRequest->setDeletionControl(SimpleType\DeletionControlType::_DELETE_ALL_PACKAGES);
$validateShipmentRequest = new ShipService\Request();
$validateShipmentRequest->getSoapClient()->__setLocation('https://ws.fedex.com:443/web-services/ship');
$response = $validateShipmentRequest->getDeleteShipmentReply($deleteShipmentRequest);
var_dump($response);