|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Nickcheek\Atdconnect; |
|
4
|
|
|
|
|
5
|
|
|
use SoapClient; |
|
6
|
|
|
use Nickcheek\Atdconnect\Arraybuilder; |
|
7
|
|
|
|
|
8
|
|
|
class Atdconnect |
|
9
|
|
|
{ |
|
10
|
|
|
|
|
11
|
|
|
private $wsshead; |
|
12
|
|
|
private $statuswsdl = 'https://testws.atdconnect.com/ws/3_4/orderStatus.wsdl'; |
|
13
|
|
|
private $brandwsdl = 'https://testws.atdconnect.com/ws/3_4/brandstyles.wsdl'; |
|
14
|
|
|
private $locationwsdl = 'https://testws.atdconnect.com/ws/3_4/locations.wsdl'; |
|
15
|
|
|
private $productwsdl = 'https://testws.atdconnect.com/ws/3_4/products.wsdl'; |
|
16
|
|
|
private $orderwsdl = 'https://testws.atdconnect.com/ws/3_4/orders.wsdl'; |
|
17
|
|
|
|
|
18
|
|
|
protected $location; |
|
19
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
public function __construct() |
|
22
|
|
|
{ |
|
23
|
|
|
$config = include('config/config.php'); |
|
24
|
|
|
$this->$wsshead = $this->getWSSHeader($config->user, $config->pass, $config->client); |
|
25
|
|
|
$this->$location = $config->location; |
|
26
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getWSSHeader($user, $pass, $client) |
|
30
|
|
|
{ |
|
31
|
|
|
$xml = ' |
|
32
|
|
|
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> |
|
33
|
|
|
<wsse:UsernameToken atd:clientId="' . $client . '" xmlns:atd="http://api.atdconnect.com/atd"> |
|
34
|
|
|
<wsse:Username>' . $user . '</wsse:Username> |
|
35
|
|
|
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $pass . '</wsse:Password> |
|
36
|
|
|
</wsse:UsernameToken> |
|
37
|
|
|
</wsse:Security> |
|
38
|
|
|
'; |
|
39
|
|
|
|
|
40
|
|
|
return new \SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', new \SoapVar($xml, XSD_ANYXML), true); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function apiCall($call,$query,$service) |
|
44
|
|
|
{ |
|
45
|
|
|
$client = new \SoapClient($service); |
|
46
|
|
|
$client->__setSoapHeaders($this->$wsshead); |
|
47
|
|
|
$response = $client->$call($query); |
|
48
|
|
|
return $response; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function setLocation($location) |
|
52
|
|
|
{ |
|
53
|
|
|
::$location = $location; |
|
|
|
|
|
|
54
|
|
|
return ::$location; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getLocation() |
|
58
|
|
|
{ |
|
59
|
|
|
return ::$location; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function setKeywordSearch($word) |
|
63
|
|
|
{ |
|
64
|
|
|
$search = new Arraybuilder(); |
|
65
|
|
|
return $search->setKeywordSearch($word); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setATDProductNumber($number) |
|
69
|
|
|
{ |
|
70
|
|
|
$search = new Arraybuilder(); |
|
71
|
|
|
return $search->setATDProductNumber($number); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
public function setSizeSearch($size) |
|
76
|
|
|
{ |
|
77
|
|
|
$search = new Arraybuilder(); |
|
78
|
|
|
return $search->setSizeSearch($size); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
//************************************************ |
|
83
|
|
|
// Location Service |
|
84
|
|
|
//************************************************ |
|
85
|
|
|
|
|
86
|
|
|
public function getLocationByCriteria() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->apiCall('getLocationByCriteria','',$this->$locationwsdl); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function getLocationCutoffTimes() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->apiCall('getLocationCutoffTimes',['location' => $this->$location],$this->$locationwsdl); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getDistributionCenter($dc = '059') |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->apiCall('getDistributionCenter',array('servicingDC' => $dc),$this->$locationwsdl); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
//************************************************ |
|
103
|
|
|
// Brand Styles Service |
|
104
|
|
|
//************************************************ |
|
105
|
|
|
|
|
106
|
|
|
|
|
107
|
|
|
public function getBrand($product = null) |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->apiCall('getBrand',array('locationNumber' => ::$location,'productGroup' => $product),$this->$brandwsdl); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function getStyle($brand = null) |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->apiCall('getStyle',array('locationNumber' => ::$location,'brand' => $brand),$this->$brandwsdl); |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
|
|
118
|
|
|
//************************************************ |
|
119
|
|
|
// Products Service |
|
120
|
|
|
//************************************************ |
|
121
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
public function getProdBrand($product = null) |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->apiCall('getProdBrand',array('locationNumber' => ::$location,'productGroup' => $product),$this->$productwsdl); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getProductByCriteria($search) |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->apiCall('getProductByCriteria',$search,$this->$productwsdl); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function getProductByKeyword($search) |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->apiCall('getProductByKeyword',$search,$this->$productwsdl); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
//************************************************ |
|
141
|
|
|
// Order Service |
|
142
|
|
|
//************************************************ |
|
143
|
|
|
|
|
144
|
|
|
public function placeOrder($order) |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->apiCall('placeOrder',$order,$this->$orderwsdl); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
public function previewOrder($order) |
|
150
|
|
|
{ |
|
151
|
|
|
return $this->apiCall('previewOrder',$order,$this->$orderwsdl); |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
//************************************************ |
|
155
|
|
|
// Order Status Service |
|
156
|
|
|
//************************************************ |
|
157
|
|
|
|
|
158
|
|
|
public function getOrderDetail($status) |
|
159
|
|
|
{ |
|
160
|
|
|
return $this->apiCall('getOrderDetail',$status,$this->$statuswsdl); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
public function getOrderStatusByCriteria($criteria) |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->apiCall('getOrderStatusByCriteria',$status,$this->$statuswsdl); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
|
|
169
|
|
|
|
|
170
|
|
|
|
|
171
|
|
|
|
|
172
|
|
|
} |
|
173
|
|
|
|