-
Notifications
You must be signed in to change notification settings - Fork 184
/
close-service.php
48 lines (37 loc) · 1.92 KB
/
close-service.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
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';
use FedEx\CloseService\Request;
use FedEx\CloseService\ComplexType;
use FedEx\CloseService\SimpleType;
$closeWithDocumentsRequest = new ComplexType\CloseWithDocumentsRequest();
// Authentication & client details.
$closeWithDocumentsRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$closeWithDocumentsRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$closeWithDocumentsRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$closeWithDocumentsRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;
$closeWithDocumentsRequest->TransactionDetail->CustomerTransactionId = 'ground close with documents test';
// Version.
$closeWithDocumentsRequest->Version->ServiceId = 'clos';
$closeWithDocumentsRequest->Version->Major = 5;
$closeWithDocumentsRequest->Version->Intermediate = 0;
$closeWithDocumentsRequest->Version->Minor = 0;
// Action type.
$closeWithDocumentsRequest->ActionType = SimpleType\CloseActionType::_CLOSE;
// Processing options.
$closeWithDocumentsRequest->ProcessingOptions->Options = [SimpleType\CloseWithDocumentsProcessingOptionType::_ERROR_IF_OPEN_SHIPMENTS_FOUND];
// Carrier code.
$closeWithDocumentsRequest->CarrierCode = SimpleType\CarrierCodeType::_FDXE;
// Reprint close date.
$closeWithDocumentsRequest->ReprintCloseDate = date('c');
// Manifest reference detail.
$closeWithDocumentsRequest->CloseDocumentSpecification->CloseDocumentTypes = [SimpleType\CloseDocumentType::_MANIFEST];
$request = new Request();
try {
$closeWithDocumentsReply = $request->getCloseWithDocumentsReply($closeWithDocumentsRequest);
var_dump($closeWithDocumentsReply);
} catch (\Exception $e) {
echo $e->getMessage();
echo $request->getSoapClient()->__getLastResponse();
}