@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | - return (object) [ |
|
4 | - 'client' => 'your_clientname', |
|
5 | - 'user' => 'your_username', |
|
6 | - 'pass' => 'your_password', |
|
7 | - 'location' => 'location_number' |
|
8 | - ]; |
|
9 | 3 | \ No newline at end of file |
4 | + return (object) [ |
|
5 | + 'client' => 'your_clientname', |
|
6 | + 'user' => 'your_username', |
|
7 | + 'pass' => 'your_password', |
|
8 | + 'location' => 'location_number' |
|
9 | + ]; |
|
10 | 10 | \ No newline at end of file |
@@ -8,26 +8,26 @@ discard block |
||
8 | 8 | class Atdconnect |
9 | 9 | { |
10 | 10 | |
11 | - public static $wsshead; |
|
12 | - private static $statuswsdl = 'https://testws.atdconnect.com/ws/3_4/orderStatus.wsdl'; |
|
13 | - private static $brandwsdl = 'https://testws.atdconnect.com/ws/3_4/brandstyles.wsdl'; |
|
14 | - private static $locationwsdl = 'https://testws.atdconnect.com/ws/3_4/locations.wsdl'; |
|
15 | - private static $productwsdl = 'https://testws.atdconnect.com/ws/3_4/products.wsdl'; |
|
16 | - private static $orderwsdl = 'https://testws.atdconnect.com/ws/3_4/orders.wsdl'; |
|
11 | + public static $wsshead; |
|
12 | + private static $statuswsdl = 'https://testws.atdconnect.com/ws/3_4/orderStatus.wsdl'; |
|
13 | + private static $brandwsdl = 'https://testws.atdconnect.com/ws/3_4/brandstyles.wsdl'; |
|
14 | + private static $locationwsdl = 'https://testws.atdconnect.com/ws/3_4/locations.wsdl'; |
|
15 | + private static $productwsdl = 'https://testws.atdconnect.com/ws/3_4/products.wsdl'; |
|
16 | + private static $orderwsdl = 'https://testws.atdconnect.com/ws/3_4/orders.wsdl'; |
|
17 | 17 | |
18 | - protected static $location; |
|
18 | + protected static $location; |
|
19 | 19 | |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | 23 | $config = include('config/config.php'); |
24 | 24 | self::$wsshead = $this->getWSSHeader($config->user, $config->pass, $config->client); |
25 | 25 | self::$location = $config->location; |
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - public static function getWSSHeader($user, $pass, $client) |
|
30 | - { |
|
29 | + public static function getWSSHeader($user, $pass, $client) |
|
30 | + { |
|
31 | 31 | $xml = ' |
32 | 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 | 33 | <wsse:UsernameToken atd:clientId="' . $client . '" xmlns:atd="http://api.atdconnect.com/atd"> |
@@ -38,107 +38,107 @@ discard block |
||
38 | 38 | '; |
39 | 39 | |
40 | 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 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public static function apiCall($call,$query,$service) |
|
44 | - { |
|
43 | + public static function apiCall($call,$query,$service) |
|
44 | + { |
|
45 | 45 | $client = new \SoapClient($service); |
46 | 46 | $client->__setSoapHeaders(self::$wsshead); |
47 | 47 | $response = $client->$call($query); |
48 | 48 | return $response; |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public function setLocation($location) |
|
52 | - { |
|
53 | - static::$location = $location; |
|
51 | + public function setLocation($location) |
|
52 | + { |
|
53 | + static::$location = $location; |
|
54 | 54 | return static::$location; |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - public function getLocation() |
|
58 | - { |
|
59 | - return static::$location; |
|
60 | - } |
|
57 | + public function getLocation() |
|
58 | + { |
|
59 | + return static::$location; |
|
60 | + } |
|
61 | 61 | |
62 | - //************************************************ |
|
63 | - // Location Service |
|
64 | - //************************************************ |
|
62 | + //************************************************ |
|
63 | + // Location Service |
|
64 | + //************************************************ |
|
65 | 65 | |
66 | - public static function getLocationByCriteria() |
|
67 | - { |
|
66 | + public static function getLocationByCriteria() |
|
67 | + { |
|
68 | 68 | return self::apiCall('getLocationByCriteria','',self::$locationwsdl); |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | - public static function getLocationCutoffTimes() |
|
72 | - { |
|
71 | + public static function getLocationCutoffTimes() |
|
72 | + { |
|
73 | 73 | return self::apiCall('getLocationCutoffTimes',['location' => self::$location],self::$locationwsdl); |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - public static function getDistributionCenter($dc = '059') |
|
77 | - { |
|
76 | + public static function getDistributionCenter($dc = '059') |
|
77 | + { |
|
78 | 78 | return self::apiCall('getDistributionCenter',array('servicingDC' => $dc),self::$locationwsdl); |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - //************************************************ |
|
82 | - // Brand Styles Service |
|
83 | - //************************************************ |
|
81 | + //************************************************ |
|
82 | + // Brand Styles Service |
|
83 | + //************************************************ |
|
84 | 84 | |
85 | - public static function getBrand($product = null) |
|
86 | - { |
|
87 | - return self::apiCall('getBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$brandwsdl); |
|
88 | - } |
|
85 | + public static function getBrand($product = null) |
|
86 | + { |
|
87 | + return self::apiCall('getBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$brandwsdl); |
|
88 | + } |
|
89 | 89 | |
90 | - public static function getStyle($brand = null) |
|
91 | - { |
|
92 | - return self::apiCall('getStyle',array('locationNumber' => static::$location,'brand' => $brand),self::$brandwsdl); |
|
93 | - } |
|
90 | + public static function getStyle($brand = null) |
|
91 | + { |
|
92 | + return self::apiCall('getStyle',array('locationNumber' => static::$location,'brand' => $brand),self::$brandwsdl); |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | - //************************************************ |
|
97 | - // Products Service |
|
98 | - //************************************************ |
|
96 | + //************************************************ |
|
97 | + // Products Service |
|
98 | + //************************************************ |
|
99 | 99 | |
100 | - public static function getProdBrand($product = null) |
|
101 | - { |
|
102 | - return self::apiCall('getProdBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$productwsdl); |
|
103 | - } |
|
100 | + public static function getProdBrand($product = null) |
|
101 | + { |
|
102 | + return self::apiCall('getProdBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$productwsdl); |
|
103 | + } |
|
104 | 104 | |
105 | - public static function getProductByCriteria($search) |
|
106 | - { |
|
105 | + public static function getProductByCriteria($search) |
|
106 | + { |
|
107 | 107 | return self::apiCall('getProductByCriteria',$search,self::$productwsdl); |
108 | - } |
|
108 | + } |
|
109 | 109 | |
110 | - public static function getProductByKeyword($search) |
|
111 | - { |
|
110 | + public static function getProductByKeyword($search) |
|
111 | + { |
|
112 | 112 | return self::apiCall('getProductByKeyword',$search,self::$productwsdl); |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - //************************************************ |
|
116 | - // Order Service |
|
117 | - //************************************************ |
|
115 | + //************************************************ |
|
116 | + // Order Service |
|
117 | + //************************************************ |
|
118 | 118 | |
119 | - public static function placeOrder($order) |
|
120 | - { |
|
119 | + public static function placeOrder($order) |
|
120 | + { |
|
121 | 121 | return self::apiCall('placeOrder',$order,self::$orderwsdl); |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - public static function previewOrder($order) |
|
125 | - { |
|
124 | + public static function previewOrder($order) |
|
125 | + { |
|
126 | 126 | return self::apiCall('previewOrder',$order,self::$orderwsdl); |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | - //************************************************ |
|
130 | - // Order Status Service |
|
131 | - //************************************************ |
|
129 | + //************************************************ |
|
130 | + // Order Status Service |
|
131 | + //************************************************ |
|
132 | 132 | |
133 | - public static function getOrderDetail($status) |
|
134 | - { |
|
133 | + public static function getOrderDetail($status) |
|
134 | + { |
|
135 | 135 | return self::apiCall('getOrderDetail',$status,self::$statuswsdl); |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - public static function getOrderStatusByCriteria($criteria) |
|
139 | - { |
|
138 | + public static function getOrderStatusByCriteria($criteria) |
|
139 | + { |
|
140 | 140 | return self::apiCall('getOrderStatusByCriteria',$status,self::$statuswsdl); |
141 | - } |
|
141 | + } |
|
142 | 142 | |
143 | 143 | |
144 | 144 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | private static $brandwsdl = 'https://testws.atdconnect.com/ws/3_4/brandstyles.wsdl'; |
14 | 14 | private static $locationwsdl = 'https://testws.atdconnect.com/ws/3_4/locations.wsdl'; |
15 | 15 | private static $productwsdl = 'https://testws.atdconnect.com/ws/3_4/products.wsdl'; |
16 | - private static $orderwsdl = 'https://testws.atdconnect.com/ws/3_4/orders.wsdl'; |
|
16 | + private static $orderwsdl = 'https://testws.atdconnect.com/ws/3_4/orders.wsdl'; |
|
17 | 17 | |
18 | 18 | protected static $location; |
19 | 19 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | { |
31 | 31 | $xml = ' |
32 | 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> |
|
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 | 36 | </wsse:UsernameToken> |
37 | 37 | </wsse:Security> |
38 | 38 | '; |
@@ -40,11 +40,11 @@ discard block |
||
40 | 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 | 41 | } |
42 | 42 | |
43 | - public static function apiCall($call,$query,$service) |
|
43 | + public static function apiCall($call, $query, $service) |
|
44 | 44 | { |
45 | - $client = new \SoapClient($service); |
|
45 | + $client = new \SoapClient($service); |
|
46 | 46 | $client->__setSoapHeaders(self::$wsshead); |
47 | - $response = $client->$call($query); |
|
47 | + $response = $client->$call($query); |
|
48 | 48 | return $response; |
49 | 49 | } |
50 | 50 | |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | |
66 | 66 | public static function getLocationByCriteria() |
67 | 67 | { |
68 | - return self::apiCall('getLocationByCriteria','',self::$locationwsdl); |
|
68 | + return self::apiCall('getLocationByCriteria', '', self::$locationwsdl); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public static function getLocationCutoffTimes() |
72 | 72 | { |
73 | - return self::apiCall('getLocationCutoffTimes',['location' => self::$location],self::$locationwsdl); |
|
73 | + return self::apiCall('getLocationCutoffTimes', ['location' => self::$location], self::$locationwsdl); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public static function getDistributionCenter($dc = '059') |
77 | 77 | { |
78 | - return self::apiCall('getDistributionCenter',array('servicingDC' => $dc),self::$locationwsdl); |
|
78 | + return self::apiCall('getDistributionCenter', array('servicingDC' => $dc), self::$locationwsdl); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | //************************************************ |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | |
85 | 85 | public static function getBrand($product = null) |
86 | 86 | { |
87 | - return self::apiCall('getBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$brandwsdl); |
|
87 | + return self::apiCall('getBrand', array('locationNumber' => static::$location, 'productGroup' => $product), self::$brandwsdl); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | public static function getStyle($brand = null) |
91 | 91 | { |
92 | - return self::apiCall('getStyle',array('locationNumber' => static::$location,'brand' => $brand),self::$brandwsdl); |
|
92 | + return self::apiCall('getStyle', array('locationNumber' => static::$location, 'brand' => $brand), self::$brandwsdl); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | |
100 | 100 | public static function getProdBrand($product = null) |
101 | 101 | { |
102 | - return self::apiCall('getProdBrand',array('locationNumber' => static::$location,'productGroup' => $product),self::$productwsdl); |
|
102 | + return self::apiCall('getProdBrand', array('locationNumber' => static::$location, 'productGroup' => $product), self::$productwsdl); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | public static function getProductByCriteria($search) |
106 | 106 | { |
107 | - return self::apiCall('getProductByCriteria',$search,self::$productwsdl); |
|
107 | + return self::apiCall('getProductByCriteria', $search, self::$productwsdl); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public static function getProductByKeyword($search) |
111 | 111 | { |
112 | - return self::apiCall('getProductByKeyword',$search,self::$productwsdl); |
|
112 | + return self::apiCall('getProductByKeyword', $search, self::$productwsdl); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | //************************************************ |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | |
119 | 119 | public static function placeOrder($order) |
120 | 120 | { |
121 | - return self::apiCall('placeOrder',$order,self::$orderwsdl); |
|
121 | + return self::apiCall('placeOrder', $order, self::$orderwsdl); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public static function previewOrder($order) |
125 | 125 | { |
126 | - return self::apiCall('previewOrder',$order,self::$orderwsdl); |
|
126 | + return self::apiCall('previewOrder', $order, self::$orderwsdl); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | //************************************************ |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | |
133 | 133 | public static function getOrderDetail($status) |
134 | 134 | { |
135 | - return self::apiCall('getOrderDetail',$status,self::$statuswsdl); |
|
135 | + return self::apiCall('getOrderDetail', $status, self::$statuswsdl); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public static function getOrderStatusByCriteria($criteria) |
139 | 139 | { |
140 | - return self::apiCall('getOrderStatusByCriteria',$status,self::$statuswsdl); |
|
140 | + return self::apiCall('getOrderStatusByCriteria', $status, self::$statuswsdl); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 |