vantuz 3.4.2 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +21 -0
- package/.openclaw/completions/openclaw.bash +227 -0
- package/.openclaw/completions/openclaw.fish +1552 -0
- package/.openclaw/completions/openclaw.ps1 +1966 -0
- package/.openclaw/completions/openclaw.zsh +3571 -0
- package/.openclaw/gateway.cmd +10 -0
- package/.openclaw/identity/device.json +7 -0
- package/.openclaw/openclaw.json +40 -0
- package/.windsurf/workflows/vantuz-dev.md +31 -0
- package/DOCS_TR.md +80 -0
- package/LICENSE +45 -45
- package/README.md +52 -21
- package/cli.js +685 -585
- package/config.js +733 -733
- package/core/agent-loop.js +190 -190
- package/core/ai-provider.js +298 -261
- package/core/automation.js +523 -523
- package/core/brand-analyst.js +101 -0
- package/core/channels.js +167 -167
- package/core/dashboard.js +230 -230
- package/core/database.js +135 -37
- package/core/eia-monitor.js +3 -1
- package/core/engine.js +648 -636
- package/core/gateway.js +447 -447
- package/core/learning.js +214 -214
- package/core/license.js +113 -0
- package/core/marketplace-adapter.js +168 -168
- package/core/memory.js +190 -190
- package/core/migrations/001-initial-schema.sql +1 -1
- package/core/queue.js +120 -120
- package/core/self-healer.js +314 -314
- package/core/unified-product.js +214 -214
- package/core/vision-service.js +113 -113
- package/index.js +217 -174
- package/modules/crm/sentiment-crm.js +231 -231
- package/modules/healer/listing-healer.js +201 -201
- package/modules/oracle/predictor.js +214 -214
- package/modules/researcher/agent.js +169 -169
- package/modules/team/agents/base.js +92 -92
- package/modules/team/agents/dev.js +33 -33
- package/modules/team/agents/josh.js +40 -40
- package/modules/team/agents/marketing.js +33 -33
- package/modules/team/agents/milo.js +36 -36
- package/modules/team/index.js +78 -78
- package/modules/team/shared-memory.js +87 -87
- package/modules/war-room/competitor-tracker.js +250 -250
- package/modules/war-room/pricing-engine.js +308 -308
- package/n11docs.md +1680 -0
- package/nodes/warehouse.js +238 -238
- package/onboard.js +1 -1
- package/openclawdocs.md +3 -0
- package/package.json +7 -5
- package/platforms/pttavm.js +14 -14
- package/plugins/vantuz/index.js +528 -528
- package/plugins/vantuz/memory/hippocampus.js +465 -465
- package/plugins/vantuz/package.json +20 -20
- package/plugins/vantuz/platforms/_template.js +118 -118
- package/plugins/vantuz/platforms/amazon.js +236 -236
- package/plugins/vantuz/platforms/ciceksepeti.js +166 -166
- package/plugins/vantuz/platforms/hepsiburada.js +180 -180
- package/plugins/vantuz/platforms/index.js +165 -165
- package/plugins/vantuz/platforms/n11.js +229 -229
- package/plugins/vantuz/platforms/pazarama.js +154 -154
- package/plugins/vantuz/platforms/pttavm.js +127 -127
- package/plugins/vantuz/platforms/trendyol.js +326 -326
- package/plugins/vantuz/services/alerts.js +253 -253
- package/plugins/vantuz/services/license.js +34 -34
- package/plugins/vantuz/services/scheduler.js +232 -232
- package/plugins/vantuz/tools/analytics.js +152 -152
- package/plugins/vantuz/tools/crossborder.js +187 -187
- package/plugins/vantuz/tools/nl-parser.js +211 -211
- package/plugins/vantuz/tools/product.js +110 -110
- package/plugins/vantuz/tools/quick-report.js +175 -175
- package/plugins/vantuz/tools/repricer.js +314 -314
- package/plugins/vantuz/tools/sentiment.js +115 -115
- package/plugins/vantuz/tools/vision.js +257 -257
- package/public.pem +9 -0
- package/server/app.js +260 -260
- package/server/public/index.html +514 -514
- package/start.bat +33 -33
- package/vantuz.sqlite +0 -0
- package/workspace/AGENTS.md +73 -0
- package/workspace/BRAND.md +29 -0
- package/workspace/SOUL.md +72 -0
- package/workspace/team/DECISIONS.md +3 -0
- package/workspace/team/GOALS.md +3 -0
- package/workspace/team/PROJECT_STATUS.md +3 -0
- package/workspace/team/agents/dev/SOUL.md +12 -0
- package/workspace/team/agents/josh/SOUL.md +12 -0
- package/workspace/team/agents/marketing/SOUL.md +12 -0
- package/workspace/team/agents/milo/SOUL.md +12 -0
- package/vantuz-3.3.4.tgz +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 🔵 N11 SOAP API Entegrasyonu
|
|
3
|
-
* api.n11.com/ws/*.wsdl
|
|
4
|
-
*/
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 🔵 N11 SOAP API Entegrasyonu
|
|
3
|
+
* api.n11.com/ws/*.wsdl
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import { parseStringPromise, Builder } from 'xml2js';
|
|
8
8
|
import { requestWithRetry } from './_request.js';
|
|
9
|
-
|
|
10
|
-
const WSDL_URLS = {
|
|
11
|
-
product: 'https://api.n11.com/ws/ProductService.wsdl',
|
|
12
|
-
order: 'https://api.n11.com/ws/OrderService.wsdl',
|
|
13
|
-
shipment: 'https://api.n11.com/ws/ShipmentService.wsdl',
|
|
14
|
-
category: 'https://api.n11.com/ws/CategoryService.wsdl',
|
|
15
|
-
city: 'https://api.n11.com/ws/CityService.wsdl'
|
|
16
|
-
};
|
|
17
|
-
|
|
9
|
+
|
|
10
|
+
const WSDL_URLS = {
|
|
11
|
+
product: 'https://api.n11.com/ws/ProductService.wsdl',
|
|
12
|
+
order: 'https://api.n11.com/ws/OrderService.wsdl',
|
|
13
|
+
shipment: 'https://api.n11.com/ws/ShipmentService.wsdl',
|
|
14
|
+
category: 'https://api.n11.com/ws/CategoryService.wsdl',
|
|
15
|
+
city: 'https://api.n11.com/ws/CityService.wsdl'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
18
|
const SOAP_ENDPOINTS = {
|
|
19
19
|
product: 'https://api.n11.com/ws/ProductService',
|
|
20
20
|
order: 'https://api.n11.com/ws/OrderService',
|
|
@@ -25,34 +25,34 @@ const SOAP_ENDPOINTS = {
|
|
|
25
25
|
const REST_BASE = 'https://api.n11.com/rest';
|
|
26
26
|
|
|
27
27
|
export class N11API {
|
|
28
|
-
constructor(config) {
|
|
29
|
-
this.apiKey = config.apiKey;
|
|
30
|
-
this.apiSecret = config.apiSecret;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_buildSoapEnvelope(service, method, body) {
|
|
34
|
-
const auth = `
|
|
35
|
-
<auth>
|
|
36
|
-
<appKey>${this.apiKey}</appKey>
|
|
37
|
-
<appSecret>${this.apiSecret}</appSecret>
|
|
38
|
-
</auth>
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
42
|
-
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
|
43
|
-
xmlns:ns1="http://www.n11.com/ws/schemas">
|
|
44
|
-
<SOAP-ENV:Body>
|
|
45
|
-
<ns1:${method}Request>
|
|
46
|
-
${auth}
|
|
47
|
-
${body}
|
|
48
|
-
</ns1:${method}Request>
|
|
49
|
-
</SOAP-ENV:Body>
|
|
50
|
-
</SOAP-ENV:Envelope>`;
|
|
51
|
-
}
|
|
52
|
-
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.apiKey = config.apiKey;
|
|
30
|
+
this.apiSecret = config.apiSecret;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_buildSoapEnvelope(service, method, body) {
|
|
34
|
+
const auth = `
|
|
35
|
+
<auth>
|
|
36
|
+
<appKey>${this.apiKey}</appKey>
|
|
37
|
+
<appSecret>${this.apiSecret}</appSecret>
|
|
38
|
+
</auth>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
42
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
|
43
|
+
xmlns:ns1="http://www.n11.com/ws/schemas">
|
|
44
|
+
<SOAP-ENV:Body>
|
|
45
|
+
<ns1:${method}Request>
|
|
46
|
+
${auth}
|
|
47
|
+
${body}
|
|
48
|
+
</ns1:${method}Request>
|
|
49
|
+
</SOAP-ENV:Body>
|
|
50
|
+
</SOAP-ENV:Envelope>`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
53
|
async _soapRequest(service, method, body = '') {
|
|
54
|
-
try {
|
|
55
|
-
const envelope = this._buildSoapEnvelope(service, method, body);
|
|
54
|
+
try {
|
|
55
|
+
const envelope = this._buildSoapEnvelope(service, method, body);
|
|
56
56
|
const response = await requestWithRetry(axios, {
|
|
57
57
|
method: 'POST',
|
|
58
58
|
url: SOAP_ENDPOINTS[service],
|
|
@@ -66,19 +66,19 @@ export class N11API {
|
|
|
66
66
|
baseDelayMs: 500,
|
|
67
67
|
maxDelayMs: 4000
|
|
68
68
|
});
|
|
69
|
-
|
|
70
|
-
const result = await parseStringPromise(response.data, { explicitArray: false });
|
|
71
|
-
const bodyKey = Object.keys(result['SOAP-ENV:Envelope']['SOAP-ENV:Body'])[0];
|
|
72
|
-
return {
|
|
73
|
-
success: true,
|
|
74
|
-
data: result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][bodyKey]
|
|
75
|
-
};
|
|
76
|
-
} catch (error) {
|
|
77
|
-
return {
|
|
78
|
-
success: false,
|
|
79
|
-
error: error.response?.data || error.message
|
|
80
|
-
};
|
|
81
|
-
}
|
|
69
|
+
|
|
70
|
+
const result = await parseStringPromise(response.data, { explicitArray: false });
|
|
71
|
+
const bodyKey = Object.keys(result['SOAP-ENV:Envelope']['SOAP-ENV:Body'])[0];
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
data: result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][bodyKey]
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
success: false,
|
|
79
|
+
error: error.response?.data || error.message
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async _restRequest(method, path, params = {}) {
|
|
@@ -104,97 +104,97 @@ export class N11API {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
109
|
-
// ÜRÜN İŞLEMLERİ
|
|
110
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
111
|
-
|
|
112
|
-
async getProducts(params = {}) {
|
|
113
|
-
const { page = 0, size = 100 } = params;
|
|
114
|
-
return await this._soapRequest('product', 'GetProductList', `
|
|
115
|
-
<pagingData>
|
|
116
|
-
<currentPage>${page}</currentPage>
|
|
117
|
-
<pageSize>${size}</pageSize>
|
|
118
|
-
</pagingData>
|
|
119
|
-
`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async getProductByCode(productSellerCode) {
|
|
123
|
-
return await this._soapRequest('product', 'GetProductBySellerCode', `
|
|
124
|
-
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
125
|
-
`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async createProduct(product) {
|
|
129
|
-
const {
|
|
130
|
-
productSellerCode, title, subtitle, description,
|
|
131
|
-
domesticPrice, currencyType = 1, categoryId,
|
|
132
|
-
preparingDay = 3, shipmentTemplate, images, attributes
|
|
133
|
-
} = product;
|
|
134
|
-
|
|
135
|
-
const imageXml = images.map((url, i) =>
|
|
136
|
-
`<image><url>${url}</url><order>${i + 1}</order></image>`
|
|
137
|
-
).join('');
|
|
138
|
-
|
|
139
|
-
const attrXml = attributes?.map(a =>
|
|
140
|
-
`<productAttribute>
|
|
141
|
-
<name>${a.name}</name>
|
|
142
|
-
<value>${a.value}</value>
|
|
143
|
-
</productAttribute>`
|
|
144
|
-
).join('') || '';
|
|
145
|
-
|
|
146
|
-
return await this._soapRequest('product', 'SaveProduct', `
|
|
147
|
-
<product>
|
|
148
|
-
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
149
|
-
<title>${title}</title>
|
|
150
|
-
<subtitle>${subtitle || ''}</subtitle>
|
|
151
|
-
<description><![CDATA[${description}]]></description>
|
|
152
|
-
<category><id>${categoryId}</id></category>
|
|
153
|
-
<price>${domesticPrice}</price>
|
|
154
|
-
<currencyType>${currencyType}</currencyType>
|
|
155
|
-
<preparingDay>${preparingDay}</preparingDay>
|
|
156
|
-
<shipmentTemplate>${shipmentTemplate}</shipmentTemplate>
|
|
157
|
-
<images>${imageXml}</images>
|
|
158
|
-
<attributes>${attrXml}</attributes>
|
|
159
|
-
<stockItems>
|
|
160
|
-
<stockItem>
|
|
161
|
-
<quantity>0</quantity>
|
|
162
|
-
<sellerStockCode>${productSellerCode}</sellerStockCode>
|
|
163
|
-
</stockItem>
|
|
164
|
-
</stockItems>
|
|
165
|
-
</product>
|
|
166
|
-
`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async updatePrice(productSellerCode, price) {
|
|
170
|
-
return await this._soapRequest('product', 'UpdateProductPriceBySellerCode', `
|
|
171
|
-
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
172
|
-
<price>${price}</price>
|
|
173
|
-
<currencyType>1</currencyType>
|
|
174
|
-
`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
async updateStock(productSellerCode, quantity) {
|
|
178
|
-
return await this._soapRequest('product', 'UpdateStockByStockSellerCode', `
|
|
179
|
-
<stockItems>
|
|
180
|
-
<stockItem>
|
|
181
|
-
<sellerStockCode>${productSellerCode}</sellerStockCode>
|
|
182
|
-
<quantity>${quantity}</quantity>
|
|
183
|
-
</stockItem>
|
|
184
|
-
</stockItems>
|
|
185
|
-
`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async deleteProduct(productSellerCode) {
|
|
189
|
-
return await this._soapRequest('product', 'DeleteProductBySellerCode', `
|
|
190
|
-
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
191
|
-
`);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
195
|
-
// SİPARİŞ İŞLEMLERİ
|
|
196
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
197
|
-
|
|
107
|
+
|
|
108
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
109
|
+
// ÜRÜN İŞLEMLERİ
|
|
110
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
111
|
+
|
|
112
|
+
async getProducts(params = {}) {
|
|
113
|
+
const { page = 0, size = 100 } = params;
|
|
114
|
+
return await this._soapRequest('product', 'GetProductList', `
|
|
115
|
+
<pagingData>
|
|
116
|
+
<currentPage>${page}</currentPage>
|
|
117
|
+
<pageSize>${size}</pageSize>
|
|
118
|
+
</pagingData>
|
|
119
|
+
`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async getProductByCode(productSellerCode) {
|
|
123
|
+
return await this._soapRequest('product', 'GetProductBySellerCode', `
|
|
124
|
+
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
125
|
+
`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async createProduct(product) {
|
|
129
|
+
const {
|
|
130
|
+
productSellerCode, title, subtitle, description,
|
|
131
|
+
domesticPrice, currencyType = 1, categoryId,
|
|
132
|
+
preparingDay = 3, shipmentTemplate, images, attributes
|
|
133
|
+
} = product;
|
|
134
|
+
|
|
135
|
+
const imageXml = images.map((url, i) =>
|
|
136
|
+
`<image><url>${url}</url><order>${i + 1}</order></image>`
|
|
137
|
+
).join('');
|
|
138
|
+
|
|
139
|
+
const attrXml = attributes?.map(a =>
|
|
140
|
+
`<productAttribute>
|
|
141
|
+
<name>${a.name}</name>
|
|
142
|
+
<value>${a.value}</value>
|
|
143
|
+
</productAttribute>`
|
|
144
|
+
).join('') || '';
|
|
145
|
+
|
|
146
|
+
return await this._soapRequest('product', 'SaveProduct', `
|
|
147
|
+
<product>
|
|
148
|
+
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
149
|
+
<title>${title}</title>
|
|
150
|
+
<subtitle>${subtitle || ''}</subtitle>
|
|
151
|
+
<description><![CDATA[${description}]]></description>
|
|
152
|
+
<category><id>${categoryId}</id></category>
|
|
153
|
+
<price>${domesticPrice}</price>
|
|
154
|
+
<currencyType>${currencyType}</currencyType>
|
|
155
|
+
<preparingDay>${preparingDay}</preparingDay>
|
|
156
|
+
<shipmentTemplate>${shipmentTemplate}</shipmentTemplate>
|
|
157
|
+
<images>${imageXml}</images>
|
|
158
|
+
<attributes>${attrXml}</attributes>
|
|
159
|
+
<stockItems>
|
|
160
|
+
<stockItem>
|
|
161
|
+
<quantity>0</quantity>
|
|
162
|
+
<sellerStockCode>${productSellerCode}</sellerStockCode>
|
|
163
|
+
</stockItem>
|
|
164
|
+
</stockItems>
|
|
165
|
+
</product>
|
|
166
|
+
`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async updatePrice(productSellerCode, price) {
|
|
170
|
+
return await this._soapRequest('product', 'UpdateProductPriceBySellerCode', `
|
|
171
|
+
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
172
|
+
<price>${price}</price>
|
|
173
|
+
<currencyType>1</currencyType>
|
|
174
|
+
`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async updateStock(productSellerCode, quantity) {
|
|
178
|
+
return await this._soapRequest('product', 'UpdateStockByStockSellerCode', `
|
|
179
|
+
<stockItems>
|
|
180
|
+
<stockItem>
|
|
181
|
+
<sellerStockCode>${productSellerCode}</sellerStockCode>
|
|
182
|
+
<quantity>${quantity}</quantity>
|
|
183
|
+
</stockItem>
|
|
184
|
+
</stockItems>
|
|
185
|
+
`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async deleteProduct(productSellerCode) {
|
|
189
|
+
return await this._soapRequest('product', 'DeleteProductBySellerCode', `
|
|
190
|
+
<productSellerCode>${productSellerCode}</productSellerCode>
|
|
191
|
+
`);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
195
|
+
// SİPARİŞ İŞLEMLERİ
|
|
196
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
197
|
+
|
|
198
198
|
async getOrders(params = {}) {
|
|
199
199
|
const {
|
|
200
200
|
status,
|
|
@@ -234,87 +234,87 @@ export class N11API {
|
|
|
234
234
|
|
|
235
235
|
return await this._restRequest('GET', '/delivery/v1/shipmentPackages', requestParams);
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
async getOrderDetail(orderId) {
|
|
239
|
-
return await this._soapRequest('order', 'OrderDetail', `
|
|
240
|
-
<orderRequest>
|
|
241
|
-
<id>${orderId}</id>
|
|
242
|
-
</orderRequest>
|
|
243
|
-
`);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
async shipOrder(orderItemList, shipmentCompanyCode, trackingNumber) {
|
|
247
|
-
// orderItemList: [{ id, quantity }]
|
|
248
|
-
const itemsXml = orderItemList.map(item =>
|
|
249
|
-
`<orderItem>
|
|
250
|
-
<id>${item.id}</id>
|
|
251
|
-
<quantity>${item.quantity}</quantity>
|
|
252
|
-
</orderItem>`
|
|
253
|
-
).join('');
|
|
254
|
-
|
|
255
|
-
return await this._soapRequest('order', 'MakeOrderItemShipment', `
|
|
256
|
-
<orderItemList>${itemsXml}</orderItemList>
|
|
257
|
-
<shipmentInfo>
|
|
258
|
-
<shipmentCompany><id>${shipmentCompanyCode}</id></shipmentCompany>
|
|
259
|
-
<trackingNumber>${trackingNumber}</trackingNumber>
|
|
260
|
-
</shipmentInfo>
|
|
261
|
-
`);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
265
|
-
// KATEGORİ
|
|
266
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
267
|
-
|
|
268
|
-
async getTopCategories() {
|
|
269
|
-
return await this._soapRequest('category', 'GetTopLevelCategories', '');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async getSubCategories(categoryId) {
|
|
273
|
-
return await this._soapRequest('category', 'GetSubCategories', `
|
|
274
|
-
<categoryId>${categoryId}</categoryId>
|
|
275
|
-
<pagingData>
|
|
276
|
-
<currentPage>0</currentPage>
|
|
277
|
-
<pageSize>100</pageSize>
|
|
278
|
-
</pagingData>
|
|
279
|
-
`);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
async getCategoryAttributes(categoryId) {
|
|
283
|
-
return await this._soapRequest('category', 'GetCategoryAttributes', `
|
|
284
|
-
<categoryId>${categoryId}</categoryId>
|
|
285
|
-
<pagingData>
|
|
286
|
-
<currentPage>0</currentPage>
|
|
287
|
-
<pageSize>100</pageSize>
|
|
288
|
-
</pagingData>
|
|
289
|
-
`);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
293
|
-
// HELPER
|
|
294
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
295
|
-
|
|
296
|
-
async testConnection() {
|
|
297
|
-
const result = await this.getProducts({ page: 0, size: 1 });
|
|
298
|
-
return result.success;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
isConnected() {
|
|
302
|
-
return !!(this.apiKey && this.apiSecret);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
let instance = null;
|
|
307
|
-
|
|
308
|
-
export const n11Api = {
|
|
309
|
-
init(config) {
|
|
310
|
-
instance = new N11API(config);
|
|
311
|
-
return instance;
|
|
312
|
-
},
|
|
313
|
-
getInstance() { return instance; },
|
|
314
|
-
isConnected() { return instance?.isConnected() || false; },
|
|
315
|
-
|
|
316
|
-
async getProducts(params) { return instance?.getProducts(params); },
|
|
317
|
-
async updatePrice(code, price) { return instance?.updatePrice(code, price); },
|
|
318
|
-
async updateStock(code, qty) { return instance?.updateStock(code, qty); },
|
|
319
|
-
async getOrders(params) { return instance?.getOrders(params); }
|
|
320
|
-
};
|
|
237
|
+
|
|
238
|
+
async getOrderDetail(orderId) {
|
|
239
|
+
return await this._soapRequest('order', 'OrderDetail', `
|
|
240
|
+
<orderRequest>
|
|
241
|
+
<id>${orderId}</id>
|
|
242
|
+
</orderRequest>
|
|
243
|
+
`);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async shipOrder(orderItemList, shipmentCompanyCode, trackingNumber) {
|
|
247
|
+
// orderItemList: [{ id, quantity }]
|
|
248
|
+
const itemsXml = orderItemList.map(item =>
|
|
249
|
+
`<orderItem>
|
|
250
|
+
<id>${item.id}</id>
|
|
251
|
+
<quantity>${item.quantity}</quantity>
|
|
252
|
+
</orderItem>`
|
|
253
|
+
).join('');
|
|
254
|
+
|
|
255
|
+
return await this._soapRequest('order', 'MakeOrderItemShipment', `
|
|
256
|
+
<orderItemList>${itemsXml}</orderItemList>
|
|
257
|
+
<shipmentInfo>
|
|
258
|
+
<shipmentCompany><id>${shipmentCompanyCode}</id></shipmentCompany>
|
|
259
|
+
<trackingNumber>${trackingNumber}</trackingNumber>
|
|
260
|
+
</shipmentInfo>
|
|
261
|
+
`);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
265
|
+
// KATEGORİ
|
|
266
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
267
|
+
|
|
268
|
+
async getTopCategories() {
|
|
269
|
+
return await this._soapRequest('category', 'GetTopLevelCategories', '');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async getSubCategories(categoryId) {
|
|
273
|
+
return await this._soapRequest('category', 'GetSubCategories', `
|
|
274
|
+
<categoryId>${categoryId}</categoryId>
|
|
275
|
+
<pagingData>
|
|
276
|
+
<currentPage>0</currentPage>
|
|
277
|
+
<pageSize>100</pageSize>
|
|
278
|
+
</pagingData>
|
|
279
|
+
`);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
async getCategoryAttributes(categoryId) {
|
|
283
|
+
return await this._soapRequest('category', 'GetCategoryAttributes', `
|
|
284
|
+
<categoryId>${categoryId}</categoryId>
|
|
285
|
+
<pagingData>
|
|
286
|
+
<currentPage>0</currentPage>
|
|
287
|
+
<pageSize>100</pageSize>
|
|
288
|
+
</pagingData>
|
|
289
|
+
`);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
293
|
+
// HELPER
|
|
294
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
295
|
+
|
|
296
|
+
async testConnection() {
|
|
297
|
+
const result = await this.getProducts({ page: 0, size: 1 });
|
|
298
|
+
return result.success;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
isConnected() {
|
|
302
|
+
return !!(this.apiKey && this.apiSecret);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
let instance = null;
|
|
307
|
+
|
|
308
|
+
export const n11Api = {
|
|
309
|
+
init(config) {
|
|
310
|
+
instance = new N11API(config);
|
|
311
|
+
return instance;
|
|
312
|
+
},
|
|
313
|
+
getInstance() { return instance; },
|
|
314
|
+
isConnected() { return instance?.isConnected() || false; },
|
|
315
|
+
|
|
316
|
+
async getProducts(params) { return instance?.getProducts(params); },
|
|
317
|
+
async updatePrice(code, price) { return instance?.updatePrice(code, price); },
|
|
318
|
+
async updateStock(code, qty) { return instance?.updateStock(code, qty); },
|
|
319
|
+
async getOrders(params) { return instance?.getOrders(params); }
|
|
320
|
+
};
|