Skip to content

Commit ab8fc42

Browse files
authored
Merge pull request #45 from JeremyDunn/validation-and-commitment-service
added Validation availability and commitment service
2 parents c1157d8 + e96a5bb commit ab8fc42

25 files changed

+1559
-1
lines changed

Diff for: CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# CHANGELOG
22

3+
## 2.2 (released 2017-08-19)
4+
- Added Validation Availability and Commitment Service
5+
6+
|Service|Version|
7+
|---|---|
8+
|Address Validation|2|
9+
|Close|2|
10+
|Courier Dispatch|3|
11+
|Locator|2|
12+
|Package Movement Information|5|
13+
|Pickup|3|
14+
|Rate|10|
15+
|Return Tag|1|
16+
|Ship|12|
17+
|Track|5|
18+
|Upload Document|1|
19+
|Open Ship|11|
20+
|Validation Availability and Commitment Service|6|
21+
322
## 2.1 (release 2017-08-19)
423
- Added Open Ship service
524

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Each web service has it's own class namespace. See the official FedEx web servic
2222
* [Track Service](src/FedEx/TrackService)
2323
* [Upload Document Service](src/FedEx/UploadDocumentService)
2424
* [Open Ship Service](src/FedEx/OpenShipService)
25+
* [Validation Availability and Commitment Service](src/FedEx/ValidationAvailabilityAndCommitmentService)
2526

2627
## Using the library
2728

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
require_once 'credentials.php';
4+
require_once 'bootstrap.php';
5+
6+
use FedEx\ValidationAvailabilityAndCommitmentService\Request;
7+
use FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
8+
use FedEx\ValidationAvailabilityAndCommitmentService\SimpleType;
9+
10+
$shipDate = new \DateTime();
11+
12+
$serviceAvailabilityRequest = new ComplexType\ServiceAvailabilityRequest();
13+
//web authentication detail
14+
$serviceAvailabilityRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
15+
$serviceAvailabilityRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
16+
//client detail
17+
$serviceAvailabilityRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
18+
$serviceAvailabilityRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;
19+
//version
20+
$serviceAvailabilityRequest->Version->ServiceId = 'vacs';
21+
$serviceAvailabilityRequest->Version->Major = 6;
22+
$serviceAvailabilityRequest->Version->Intermediate = 0;
23+
$serviceAvailabilityRequest->Version->Minor = 0;
24+
//origin
25+
$serviceAvailabilityRequest->Origin->PostalCode = '38115';
26+
$serviceAvailabilityRequest->Origin->CountryCode = 'US';
27+
//destination
28+
$serviceAvailabilityRequest->Destination->PostalCode = '20171';
29+
$serviceAvailabilityRequest->Destination->CountryCode = 'US';
30+
//ship date
31+
$serviceAvailabilityRequest->ShipDate = $shipDate->format('Y-m-d');
32+
33+
$request = new Request();
34+
35+
try {
36+
$serviceAvailabilityReply = $request->getServiceAvailabilityReply($serviceAvailabilityRequest);
37+
var_dump($serviceAvailabilityReply);
38+
} catch (\Exception $e) {
39+
var_dump($request->getSoapClient()->__getLastResponse());
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
namespace FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
3+
4+
use FedEx\AbstractComplexType;
5+
6+
/**
7+
* Descriptive data for a physical location. May be used as an actual physical address (place to which one could go), or as a container of "address parts" which should be handled as a unit (such as a city-state-ZIP combination within the US).
8+
*
9+
* @author Jeremy Dunn <[email protected]>
10+
* @package PHP FedEx API wrapper
11+
* @subpackage Validation Availability And Commitment Service Service
12+
*
13+
* @property string $PostalCode
14+
* @property string $CountryCode
15+
16+
*/
17+
class Address extends AbstractComplexType
18+
{
19+
/**
20+
* Name of this complex type
21+
*
22+
* @var string
23+
*/
24+
protected $name = 'Address';
25+
26+
/**
27+
* Identification of a region (usually small) for mail/package delivery. Format and presence of this field will vary, depending on country.
28+
*
29+
* @param string $postalCode
30+
* @return $this
31+
*/
32+
public function setPostalCode($postalCode)
33+
{
34+
$this->values['PostalCode'] = $postalCode;
35+
return $this;
36+
}
37+
38+
/**
39+
* The two-letter code used to identify a country.
40+
*
41+
* @param string $countryCode
42+
* @return $this
43+
*/
44+
public function setCountryCode($countryCode)
45+
{
46+
$this->values['CountryCode'] = $countryCode;
47+
return $this;
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
namespace FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
3+
4+
use FedEx\AbstractComplexType;
5+
6+
/**
7+
* Descriptive data for the client submitting a transaction.
8+
*
9+
* @author Jeremy Dunn <[email protected]>
10+
* @package PHP FedEx API wrapper
11+
* @subpackage Validation Availability And Commitment Service Service
12+
*
13+
* @property string $AccountNumber
14+
* @property string $MeterNumber
15+
* @property Localization $Localization
16+
17+
*/
18+
class ClientDetail extends AbstractComplexType
19+
{
20+
/**
21+
* Name of this complex type
22+
*
23+
* @var string
24+
*/
25+
protected $name = 'ClientDetail';
26+
27+
/**
28+
* The FedEx account number associated with this transaction.
29+
*
30+
* @param string $accountNumber
31+
* @return $this
32+
*/
33+
public function setAccountNumber($accountNumber)
34+
{
35+
$this->values['AccountNumber'] = $accountNumber;
36+
return $this;
37+
}
38+
39+
/**
40+
* This number is assigned by FedEx and identifies the unique device from which the request is originating
41+
*
42+
* @param string $meterNumber
43+
* @return $this
44+
*/
45+
public function setMeterNumber($meterNumber)
46+
{
47+
$this->values['MeterNumber'] = $meterNumber;
48+
return $this;
49+
}
50+
51+
/**
52+
* The language to be used for human-readable Notification.localizedMessages in responses to the request containing this ClientDetail object. Different requests from the same client may contain different Localization data. (Contrast with TransactionDetail.localization, which governs data payload language/translation.)
53+
*
54+
* @param Localization $localization
55+
* @return $this
56+
*/
57+
public function setLocalization(Localization $localization)
58+
{
59+
$this->values['Localization'] = $localization;
60+
return $this;
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
namespace FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
3+
4+
use FedEx\AbstractComplexType;
5+
6+
/**
7+
* Identifies the representation of human-readable text.
8+
*
9+
* @author Jeremy Dunn <[email protected]>
10+
* @package PHP FedEx API wrapper
11+
* @subpackage Validation Availability And Commitment Service Service
12+
*
13+
* @property string $LanguageCode
14+
* @property string $LocaleCode
15+
16+
*/
17+
class Localization extends AbstractComplexType
18+
{
19+
/**
20+
* Name of this complex type
21+
*
22+
* @var string
23+
*/
24+
protected $name = 'Localization';
25+
26+
/**
27+
* Two-letter code for language (e.g. EN, FR, etc.)
28+
*
29+
* @param string $languageCode
30+
* @return $this
31+
*/
32+
public function setLanguageCode($languageCode)
33+
{
34+
$this->values['LanguageCode'] = $languageCode;
35+
return $this;
36+
}
37+
38+
/**
39+
* Two-letter code for the region (e.g. us, ca, etc..).
40+
*
41+
* @param string $localeCode
42+
* @return $this
43+
*/
44+
public function setLocaleCode($localeCode)
45+
{
46+
$this->values['LocaleCode'] = $localeCode;
47+
return $this;
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
namespace FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
3+
4+
use FedEx\AbstractComplexType;
5+
6+
/**
7+
* The descriptive data regarding the result of the submitted transaction.
8+
*
9+
* @author Jeremy Dunn <[email protected]>
10+
* @package PHP FedEx API wrapper
11+
* @subpackage Validation Availability And Commitment Service Service
12+
*
13+
* @property \FedEx\ValidationAvailabilityAndCommitmentService\SimpleType\NotificationSeverityType|string $Severity
14+
* @property string $Source
15+
* @property string $Code
16+
* @property string $Message
17+
* @property string $LocalizedMessage
18+
* @property NotificationParameter[] $MessageParameters
19+
20+
*/
21+
class Notification extends AbstractComplexType
22+
{
23+
/**
24+
* Name of this complex type
25+
*
26+
* @var string
27+
*/
28+
protected $name = 'Notification';
29+
30+
/**
31+
* The severity of this notification. This can indicate success or failure or some other information about the request. The values that can be returned are SUCCESS - Your transaction succeeded with no other applicable information. NOTE - Additional information that may be of interest to you about your transaction. WARNING - Additional information that you need to know about your transaction that you may need to take action on. ERROR - Information about an error that occurred while processing your transaction. FAILURE - FedEx was unable to process your transaction at this time due to a system failure. Please try again later
32+
*
33+
* @param \FedEx\ValidationAvailabilityAndCommitmentService\SimpleType\NotificationSeverityType|string $severity
34+
* @return $this
35+
*/
36+
public function setSeverity($severity)
37+
{
38+
$this->values['Severity'] = $severity;
39+
return $this;
40+
}
41+
42+
/**
43+
* Indicates the source of this notification. Combined with the Code it uniquely identifies this notification
44+
*
45+
* @param string $source
46+
* @return $this
47+
*/
48+
public function setSource($source)
49+
{
50+
$this->values['Source'] = $source;
51+
return $this;
52+
}
53+
54+
/**
55+
* A code that represents this notification. Combined with the Source it uniquely identifies this notification.
56+
*
57+
* @param string $code
58+
* @return $this
59+
*/
60+
public function setCode($code)
61+
{
62+
$this->values['Code'] = $code;
63+
return $this;
64+
}
65+
66+
/**
67+
* Human-readable text that explains this notification.
68+
*
69+
* @param string $message
70+
* @return $this
71+
*/
72+
public function setMessage($message)
73+
{
74+
$this->values['Message'] = $message;
75+
return $this;
76+
}
77+
78+
/**
79+
* The translated message. The language and locale specified in the ClientDetail. Localization are used to determine the representation. Currently only supported in a TrackReply.
80+
*
81+
* @param string $localizedMessage
82+
* @return $this
83+
*/
84+
public function setLocalizedMessage($localizedMessage)
85+
{
86+
$this->values['LocalizedMessage'] = $localizedMessage;
87+
return $this;
88+
}
89+
90+
/**
91+
* A collection of name/value pairs that provide specific data to help the client determine the nature of an error (or warning, etc.) without having to parse the message string.
92+
*
93+
* @param NotificationParameter[] $messageParameters
94+
* @return $this
95+
*/
96+
public function setMessageParameters(array $messageParameters)
97+
{
98+
$this->values['MessageParameters'] = $messageParameters;
99+
return $this;
100+
}
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
namespace FedEx\ValidationAvailabilityAndCommitmentService\ComplexType;
3+
4+
use FedEx\AbstractComplexType;
5+
6+
/**
7+
* NotificationParameter
8+
*
9+
* @author Jeremy Dunn <[email protected]>
10+
* @package PHP FedEx API wrapper
11+
* @subpackage Validation Availability And Commitment Service Service
12+
*
13+
* @property string $Id
14+
* @property string $Value
15+
16+
*/
17+
class NotificationParameter extends AbstractComplexType
18+
{
19+
/**
20+
* Name of this complex type
21+
*
22+
* @var string
23+
*/
24+
protected $name = 'NotificationParameter';
25+
26+
/**
27+
* Identifies the type of data contained in Value (e.g. SERVICE_TYPE, PACKAGE_SEQUENCE, etc..).
28+
*
29+
* @param string $id
30+
* @return $this
31+
*/
32+
public function setId($id)
33+
{
34+
$this->values['Id'] = $id;
35+
return $this;
36+
}
37+
38+
/**
39+
* The value of the parameter (e.g. PRIORITY_OVERNIGHT, 2, etc..).
40+
*
41+
* @param string $value
42+
* @return $this
43+
*/
44+
public function setValue($value)
45+
{
46+
$this->values['Value'] = $value;
47+
return $this;
48+
}
49+
}

0 commit comments

Comments
 (0)