-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathn11.class.php
61 lines (51 loc) · 2.31 KB
/
n11.class.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
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
Class N11 {
protected static $_appKey, $_appSecret, $_parameters, $_sclient;
public $_debug = false;
public function __construct(array $attributes = array()) {
self::$_appKey = $attributes['appKey'];
self::$_appSecret = $attributes['appSecret'];
self::$_parameters = ['auth' => ['appKey' => self::$_appKey, 'appSecret' => self::$_appSecret]];
}
public function setUrl($url) {
self::$_sclient = new \SoapClient($url);
}
public function GetTopLevelCategories() {
$this->setUrl('https://api.n11.com/ws/CategoryService.wsdl');
return self::$_sclient->GetTopLevelCategories(self::$_parameters);
}
public function GetCities() {
$this->setUrl('https://api.n11.com/ws/CityService.wsdl');
return self::$_sclient->GetCities(self::$_parameters);
}
public function GetProductList($itemsPerPage, $currentPage) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['pagingData'] = ['itemsPerPage' => $itemsPerPage, 'currentPage' => $currentPage];
return self::$_sclient->GetProductList(self::$_parameters);
}
public function GetProductBySellerCode($sellerCode) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['sellerCode'] = $sellerCode;
return self::$_sclient->GetProductBySellerCode(self::$_parameters);
}
public function SaveProduct(array $product = Array()) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['product'] = $product;
return self::$_sclient->SaveProduct(self::$_parameters);
}
public function DeleteProductBySellerCode($sellerCode) {
$this->setUrl('https://api.n11.com/ws/ProductService.wsdl');
self::$_parameters['productSellerCode'] = $sellerCode;
return self::$_sclient->DeleteProductBySellerCode(self::$_parameters);
}
public function OrderList(array $searchData = Array()) {
$this->setUrl('https://api.n11.com/ws/OrderService.wsdl');
self::$_parameters['searchData'] = $searchData;
return self::$_sclient->OrderList(self::$_parameters);
}
public function __destruct() {
if ($this->_debug) {
print_r(self::$_parameters);
}
}
}