@dianemo/plugin-newegg 2.0.1 → 2.1.0
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/NOTICE +2 -3
- package/dist/client.d.ts +2 -3
- package/dist/client.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/requests/feeds/index.d.ts +1 -2
- package/dist/requests/feeds/index.js +0 -1
- package/dist/requests/feeds/types.d.ts +0 -1
- package/dist/requests/feeds/types.js +0 -1
- package/dist/requests/index.d.ts +0 -1
- package/dist/requests/index.js +0 -1
- package/dist/requests/inventory/index.d.ts +1 -2
- package/dist/requests/inventory/index.js +0 -1
- package/dist/requests/inventory/types.d.ts +1 -2
- package/dist/requests/inventory/types.js +0 -1
- package/dist/requests/orders/index.d.ts +1 -2
- package/dist/requests/orders/index.js +0 -1
- package/dist/requests/orders/types.d.ts +1 -2
- package/dist/requests/orders/types.js +0 -1
- package/dist/requests/pricing/index.d.ts +1 -2
- package/dist/requests/pricing/index.js +0 -1
- package/dist/requests/pricing/types.d.ts +1 -2
- package/dist/requests/pricing/types.js +0 -1
- package/dist/requests/returns/index.d.ts +1 -2
- package/dist/requests/returns/index.js +0 -1
- package/dist/requests/returns/types.d.ts +0 -1
- package/dist/requests/returns/types.js +0 -1
- package/dist/requests/types.d.ts +0 -1
- package/dist/requests/types.js +0 -1
- package/dist/requests/utils.d.ts +0 -1
- package/dist/requests/utils.js +0 -1
- package/package.json +4 -5
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/requests/feeds/index.d.ts.map +0 -1
- package/dist/requests/feeds/index.js.map +0 -1
- package/dist/requests/feeds/types.d.ts.map +0 -1
- package/dist/requests/feeds/types.js.map +0 -1
- package/dist/requests/index.d.ts.map +0 -1
- package/dist/requests/index.js.map +0 -1
- package/dist/requests/inventory/index.d.ts.map +0 -1
- package/dist/requests/inventory/index.js.map +0 -1
- package/dist/requests/inventory/types.d.ts.map +0 -1
- package/dist/requests/inventory/types.js.map +0 -1
- package/dist/requests/orders/index.d.ts.map +0 -1
- package/dist/requests/orders/index.js.map +0 -1
- package/dist/requests/orders/types.d.ts.map +0 -1
- package/dist/requests/orders/types.js.map +0 -1
- package/dist/requests/pricing/index.d.ts.map +0 -1
- package/dist/requests/pricing/index.js.map +0 -1
- package/dist/requests/pricing/types.d.ts.map +0 -1
- package/dist/requests/pricing/types.js.map +0 -1
- package/dist/requests/returns/index.d.ts.map +0 -1
- package/dist/requests/returns/index.js.map +0 -1
- package/dist/requests/returns/types.d.ts.map +0 -1
- package/dist/requests/returns/types.js.map +0 -1
- package/dist/requests/types.d.ts.map +0 -1
- package/dist/requests/types.js.map +0 -1
- package/dist/requests/utils.d.ts.map +0 -1
- package/dist/requests/utils.js.map +0 -1
- package/src/client.ts +0 -126
- package/src/index.ts +0 -34
- package/src/requests/feeds/index.ts +0 -70
- package/src/requests/feeds/types.ts +0 -56
- package/src/requests/index.ts +0 -5
- package/src/requests/inventory/index.ts +0 -94
- package/src/requests/inventory/types.ts +0 -83
- package/src/requests/orders/index.ts +0 -94
- package/src/requests/orders/types.ts +0 -284
- package/src/requests/pricing/index.ts +0 -70
- package/src/requests/pricing/types.ts +0 -95
- package/src/requests/returns/index.ts +0 -30
- package/src/requests/returns/types.ts +0 -113
- package/src/requests/types.ts +0 -36
- package/src/requests/utils.ts +0 -26
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { neweggSubClient, neweggSucceeded } from "../utils.js";
|
|
2
|
-
import { tryHandleRequest } from "@dianemo/plugin-kit";
|
|
3
|
-
import { RequestError } from "@dianemo/core";
|
|
4
|
-
import {
|
|
5
|
-
NeweggFeedResponse,
|
|
6
|
-
NeweggGetFeedStatusData,
|
|
7
|
-
NeweggSubmitFeedResponse,
|
|
8
|
-
} from "./types.js";
|
|
9
|
-
|
|
10
|
-
export const getFeedStatus = async (
|
|
11
|
-
clientName: string,
|
|
12
|
-
feedId: string
|
|
13
|
-
): Promise<NeweggFeedResponse> => {
|
|
14
|
-
const data: NeweggGetFeedStatusData = {
|
|
15
|
-
OperationType: "GetFeedStatusRequest",
|
|
16
|
-
RequestBody: {
|
|
17
|
-
GetRequestStatus: { RequestIDList: [{ RequestID: feedId }] },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const res = await tryHandleRequest<NeweggSubmitFeedResponse>(
|
|
21
|
-
{
|
|
22
|
-
clientName: neweggSubClient(clientName, "getFeedStatus"),
|
|
23
|
-
requestName: "newegg.feeds.getStatus",
|
|
24
|
-
url: `/datafeedmgmt/feeds/status`,
|
|
25
|
-
method: "PUT",
|
|
26
|
-
data,
|
|
27
|
-
},
|
|
28
|
-
"NWG_0007",
|
|
29
|
-
"Failed to get Newegg feed status"
|
|
30
|
-
);
|
|
31
|
-
const resData = res.data;
|
|
32
|
-
const feedData = resData.ResponseBody.ResponseList[0];
|
|
33
|
-
if (!feedData || !neweggSucceeded(resData)) {
|
|
34
|
-
throw new RequestError("NWG_0008", "Newegg feed status request failed", {
|
|
35
|
-
metadata: {
|
|
36
|
-
context: `${feedData?.RequestStatus ?? "No request status"} | MEMO: ${resData.Memo || "N/A"}`,
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return feedData;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const submitFeed = async (
|
|
44
|
-
clientName: string,
|
|
45
|
-
requestType: string,
|
|
46
|
-
data: object
|
|
47
|
-
): Promise<NeweggFeedResponse> => {
|
|
48
|
-
const res = await tryHandleRequest<NeweggSubmitFeedResponse>(
|
|
49
|
-
{
|
|
50
|
-
clientName: neweggSubClient(clientName, "submitFeed"),
|
|
51
|
-
requestName: "newegg.feeds.submit",
|
|
52
|
-
url: `/datafeedmgmt/feeds/submitfeed`,
|
|
53
|
-
method: "POST",
|
|
54
|
-
params: { requesttype: requestType },
|
|
55
|
-
data,
|
|
56
|
-
},
|
|
57
|
-
"NWG_0005",
|
|
58
|
-
"Failed to submit Newegg feed"
|
|
59
|
-
);
|
|
60
|
-
const resData = res.data;
|
|
61
|
-
const feedData = resData.ResponseBody.ResponseList[0];
|
|
62
|
-
if (!feedData || !neweggSucceeded(resData)) {
|
|
63
|
-
throw new RequestError("NWG_0006", "Newegg feed submission failed", {
|
|
64
|
-
metadata: {
|
|
65
|
-
context: `${feedData?.RequestStatus ?? "No request status"} | MEMO: ${resData.Memo || "N/A"}`,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return feedData;
|
|
70
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export type NeweggFeedType =
|
|
2
|
-
| "ITEM_DATA"
|
|
3
|
-
| "INVENTORY_AND_PRICE_DATA"
|
|
4
|
-
| "INVENTORY_DATA"
|
|
5
|
-
| "PRICE_DATA"
|
|
6
|
-
| "ITEM_COUNTRY_RESTRICTION_DATA"
|
|
7
|
-
| "ORDER_SHIP_NOTICE_DATA"
|
|
8
|
-
| "MULTICHANNEL_ORDER_DATA"
|
|
9
|
-
| "VOLUME_DISCOUNT_DATA"
|
|
10
|
-
| "ITEM_WARRANTY_DATA"
|
|
11
|
-
| "ITEM_CAPROP65_DATA"
|
|
12
|
-
| "ITEM_CHINATAXSETTING_DATA"
|
|
13
|
-
| "ITEM_SAFEGUARD_SETTING_DATA"
|
|
14
|
-
| "VEHICLE_SPECIFIC_ITEM_DATA";
|
|
15
|
-
|
|
16
|
-
export type NeweggFeedStatus =
|
|
17
|
-
"SUBMITTED" | "IN_PROGRESS" | "FINISHED" | "CANCELLED";
|
|
18
|
-
|
|
19
|
-
export interface NeweggGetFeedStatusData {
|
|
20
|
-
OperationType: "GetFeedStatusRequest";
|
|
21
|
-
RequestBody: {
|
|
22
|
-
GetRequestStatus: {
|
|
23
|
-
RequestIDList?: { RequestID: string }[];
|
|
24
|
-
RequestType?: NeweggFeedType;
|
|
25
|
-
MaxCount?: string;
|
|
26
|
-
RequestStatus?: "ALL" | NeweggFeedStatus;
|
|
27
|
-
RequestDateFrom?: string;
|
|
28
|
-
RequestDateTo?: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface NeweggSubmitFeedResponse {
|
|
34
|
-
/**
|
|
35
|
-
* A JSON boolean on this endpoint, per Newegg's published sample. Read it
|
|
36
|
-
* through `neweggSucceeded` rather than comparing directly — the same flag is
|
|
37
|
-
* a string on other Newegg endpoints.
|
|
38
|
-
*/
|
|
39
|
-
IsSuccess: boolean;
|
|
40
|
-
OperationType: string;
|
|
41
|
-
SellerID: string;
|
|
42
|
-
ResponseBody: { ResponseList: NeweggFeedResponse[] };
|
|
43
|
-
Memo?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface NeweggFeedResponse {
|
|
47
|
-
/**
|
|
48
|
-
* `RequestId` here, but `RequestIDList.RequestID` in the request body above:
|
|
49
|
-
* Newegg spells the key differently by direction. Both are as published — not
|
|
50
|
-
* a typo to fix. docs/newegg-api.md#requestid-on-the-way-in-requestid-on-the-way-out
|
|
51
|
-
*/
|
|
52
|
-
RequestId: string;
|
|
53
|
-
RequestType: NeweggFeedType;
|
|
54
|
-
RequestDate: string;
|
|
55
|
-
RequestStatus: NeweggFeedStatus;
|
|
56
|
-
}
|
package/src/requests/index.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { tryHandleRequest } from "@dianemo/plugin-kit";
|
|
2
|
-
import { NeweggItemUpdateType } from "../types.js";
|
|
3
|
-
import { submitFeed } from "../feeds/index.js";
|
|
4
|
-
import { neweggSubClient } from "../utils.js";
|
|
5
|
-
import {
|
|
6
|
-
NeweggBusinessInventoryResponse,
|
|
7
|
-
NeweggDetailedItemInventory,
|
|
8
|
-
NeweggGetInventoryData,
|
|
9
|
-
NeweggGetInventoryResponse,
|
|
10
|
-
NeweggInventoryFeedItemData,
|
|
11
|
-
NeweggItemInventory,
|
|
12
|
-
NeweggSubmitInventoryFeedData,
|
|
13
|
-
NeweggUpdateItemInventoryData,
|
|
14
|
-
NeweggUpdateItemInventoryResponse,
|
|
15
|
-
} from "./types.js";
|
|
16
|
-
|
|
17
|
-
export const getItemInventory = async (
|
|
18
|
-
clientName: string,
|
|
19
|
-
data: NeweggGetInventoryData
|
|
20
|
-
): Promise<NeweggDetailedItemInventory[]> => {
|
|
21
|
-
const res = await tryHandleRequest<NeweggGetInventoryResponse>(
|
|
22
|
-
{
|
|
23
|
-
clientName: neweggSubClient(clientName, "getItemInventory"),
|
|
24
|
-
requestName: "newegg.inventory.get",
|
|
25
|
-
url: `/contentmgmt/item/international/inventory`,
|
|
26
|
-
method: "PUT",
|
|
27
|
-
data,
|
|
28
|
-
},
|
|
29
|
-
"NWG_0009",
|
|
30
|
-
"Failed to get Newegg item inventory"
|
|
31
|
-
);
|
|
32
|
-
return res.data.InventoryAllocation;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Deliberately the same `getItemInventory` sub-client: it is the same logical
|
|
37
|
-
* operation against the same published budget, so the two share one bucket.
|
|
38
|
-
*/
|
|
39
|
-
export const getBusinessItemInventory = async (
|
|
40
|
-
clientName: string,
|
|
41
|
-
data: NeweggGetInventoryData
|
|
42
|
-
): Promise<NeweggBusinessInventoryResponse> => {
|
|
43
|
-
const res = await tryHandleRequest<NeweggBusinessInventoryResponse>(
|
|
44
|
-
{
|
|
45
|
-
clientName: neweggSubClient(clientName, "getItemInventory"),
|
|
46
|
-
requestName: "newegg.inventory.getBusiness",
|
|
47
|
-
url: `/contentmgmt/item/inventory`,
|
|
48
|
-
method: "POST",
|
|
49
|
-
params: { version: 304 },
|
|
50
|
-
data,
|
|
51
|
-
},
|
|
52
|
-
"NWG_0014",
|
|
53
|
-
"Failed to get Newegg business item inventory"
|
|
54
|
-
);
|
|
55
|
-
return res.data;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const submitInventoryFeed = async (
|
|
59
|
-
clientName: string,
|
|
60
|
-
inventory: NeweggInventoryFeedItemData[]
|
|
61
|
-
) => {
|
|
62
|
-
const data: NeweggSubmitInventoryFeedData = {
|
|
63
|
-
NeweggEnvelope: {
|
|
64
|
-
Header: { DocumentVersion: "2.0" },
|
|
65
|
-
MessageType: "Inventory",
|
|
66
|
-
Message: { Inventory: { Item: inventory } },
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
return await submitFeed(clientName, "INVENTORY_DATA", data);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const updateItemInventory = async (
|
|
73
|
-
clientName: string,
|
|
74
|
-
sku: string,
|
|
75
|
-
inventory: NeweggItemInventory[]
|
|
76
|
-
): Promise<NeweggUpdateItemInventoryResponse> => {
|
|
77
|
-
const data: NeweggUpdateItemInventoryData = {
|
|
78
|
-
Type: NeweggItemUpdateType.SellerPartNumber,
|
|
79
|
-
Value: sku,
|
|
80
|
-
InventoryList: { Inventory: inventory },
|
|
81
|
-
};
|
|
82
|
-
const res = await tryHandleRequest<NeweggUpdateItemInventoryResponse>(
|
|
83
|
-
{
|
|
84
|
-
clientName: neweggSubClient(clientName, "updateItemInventory"),
|
|
85
|
-
requestName: "newegg.inventory.update",
|
|
86
|
-
url: `/contentmgmt/item/international/inventory`,
|
|
87
|
-
method: "POST",
|
|
88
|
-
data,
|
|
89
|
-
},
|
|
90
|
-
"NWG_0010",
|
|
91
|
-
"Failed to update Newegg item inventory"
|
|
92
|
-
);
|
|
93
|
-
return res.data;
|
|
94
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NeweggFeedWrapper,
|
|
3
|
-
NeweggItemCondition,
|
|
4
|
-
NeweggItemFulfillmentOption,
|
|
5
|
-
NeweggItemUpdateType,
|
|
6
|
-
} from "../types.js";
|
|
7
|
-
|
|
8
|
-
export interface NeweggGetInventoryData {
|
|
9
|
-
Type: NeweggItemUpdateType;
|
|
10
|
-
Value: string;
|
|
11
|
-
Condition?: NeweggItemCondition;
|
|
12
|
-
WarehouseLocation?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface NeweggGetInventoryResponse {
|
|
16
|
-
SellerID: string;
|
|
17
|
-
ItemNumber: string;
|
|
18
|
-
SellerPartNumber: string;
|
|
19
|
-
InventoryAllocation: NeweggDetailedItemInventory[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The business marketplace answers a flat record rather than the international
|
|
24
|
-
* endpoint's `InventoryAllocation` array, and sends `FulfillmentOption` and
|
|
25
|
-
* `Active` as **strings** where the rest of this package models them as numeric
|
|
26
|
-
* enums. Typed as the wire sends them rather than as the enums they resemble —
|
|
27
|
-
* docs/newegg-api.md#the-business-marketplace-has-its-own-inventory-endpoint
|
|
28
|
-
*/
|
|
29
|
-
export interface NeweggBusinessInventoryResponse {
|
|
30
|
-
SellerID: string;
|
|
31
|
-
ItemNumber: string;
|
|
32
|
-
SellerPartNumber: string;
|
|
33
|
-
/** A string, not the enum. Only `"0"` has been observed. */
|
|
34
|
-
FulfillmentOption: string;
|
|
35
|
-
/** `"1"` active, `"0"` inactive — both observed. A string, not the enum. */
|
|
36
|
-
Active: string;
|
|
37
|
-
AvailableQuantity: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface NeweggDetailedItemInventory {
|
|
41
|
-
WarehouseLocation: string;
|
|
42
|
-
FulfillmentOption: NeweggItemFulfillmentOption;
|
|
43
|
-
AvailableQuantity: number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface NeweggSubmitInventoryFeedData extends NeweggFeedWrapper<NeweggInventoryFeedMessage> {}
|
|
47
|
-
|
|
48
|
-
export interface NeweggInventoryFeedMessage {
|
|
49
|
-
Inventory: {
|
|
50
|
-
Item: NeweggInventoryFeedItemData[];
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface NeweggInventoryFeedItemData {
|
|
55
|
-
SellerPartNumber: string;
|
|
56
|
-
WarehouseLocation: string;
|
|
57
|
-
Inventory: number;
|
|
58
|
-
FulfillmentOption?: "Seller";
|
|
59
|
-
NeweggItemNumber?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface NeweggUpdateItemInventoryData {
|
|
63
|
-
Type: NeweggItemUpdateType;
|
|
64
|
-
Value: string;
|
|
65
|
-
InventoryList: {
|
|
66
|
-
Inventory: NeweggItemInventory[];
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface NeweggItemInventory {
|
|
71
|
-
WarehouseLocation: string;
|
|
72
|
-
AvailableQuantity: number;
|
|
73
|
-
Condition?: NeweggItemCondition;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface NeweggUpdateItemInventoryResponse {
|
|
77
|
-
SellerID: string;
|
|
78
|
-
ItemNumber: string;
|
|
79
|
-
SellerPartNumber: string;
|
|
80
|
-
InventoryList: {
|
|
81
|
-
Inventory: NeweggItemInventory[];
|
|
82
|
-
};
|
|
83
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { tryHandleRequest } from "@dianemo/plugin-kit";
|
|
2
|
-
import { neweggSubClient } from "../utils.js";
|
|
3
|
-
import {
|
|
4
|
-
NeweggGetOrdersFilters,
|
|
5
|
-
NeweggGetOrdersData,
|
|
6
|
-
NeweggGetOrdersResponse,
|
|
7
|
-
NeweggMarkOrderDownloadedData,
|
|
8
|
-
NeweggMarkOrderDownloadedResponse,
|
|
9
|
-
NeweggShipOrderPackage,
|
|
10
|
-
NeweggShipOrderData,
|
|
11
|
-
NeweggShipOrderResponse,
|
|
12
|
-
} from "./types.js";
|
|
13
|
-
|
|
14
|
-
export const getOrders = async (
|
|
15
|
-
clientName: string,
|
|
16
|
-
filters: NeweggGetOrdersFilters
|
|
17
|
-
): Promise<NeweggGetOrdersResponse> => {
|
|
18
|
-
const data: NeweggGetOrdersData = {
|
|
19
|
-
OperationType: "GetOrderInfoRequest",
|
|
20
|
-
RequestBody: filters,
|
|
21
|
-
};
|
|
22
|
-
const res = await tryHandleRequest<NeweggGetOrdersResponse>(
|
|
23
|
-
{
|
|
24
|
-
clientName: neweggSubClient(clientName, "getOrders"),
|
|
25
|
-
requestName: "newegg.orders.list",
|
|
26
|
-
method: "PUT",
|
|
27
|
-
url: `/ordermgmt/order/orderinfo`,
|
|
28
|
-
params: { version: 315 },
|
|
29
|
-
data,
|
|
30
|
-
},
|
|
31
|
-
"NWG_0001",
|
|
32
|
-
"Failed to get Newegg orders"
|
|
33
|
-
);
|
|
34
|
-
return res.data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const markOrderDownloaded = async (
|
|
38
|
-
clientName: string,
|
|
39
|
-
orderNumbers: string[]
|
|
40
|
-
) => {
|
|
41
|
-
const data: NeweggMarkOrderDownloadedData = {
|
|
42
|
-
OperationType: "OrderConfirmationRequest",
|
|
43
|
-
RequestBody: {
|
|
44
|
-
DownloadedOrderList: {
|
|
45
|
-
OrderNumber: orderNumbers,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const res = await tryHandleRequest<NeweggMarkOrderDownloadedResponse>(
|
|
50
|
-
{
|
|
51
|
-
clientName: neweggSubClient(clientName, "markOrderDownloaded"),
|
|
52
|
-
requestName: "newegg.orders.markDownloaded",
|
|
53
|
-
method: "POST",
|
|
54
|
-
url: `/ordermgmt/orderstatus/orders/confirmation`,
|
|
55
|
-
data,
|
|
56
|
-
},
|
|
57
|
-
"NWG_0002",
|
|
58
|
-
"Failed to mark Newegg order as downloaded"
|
|
59
|
-
);
|
|
60
|
-
return res.data.NeweggAPIResponse.ResponseBody;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const shipOrder = async (
|
|
64
|
-
clientName: string,
|
|
65
|
-
orderNumber: string,
|
|
66
|
-
packages: NeweggShipOrderPackage[],
|
|
67
|
-
sellerId: string
|
|
68
|
-
): Promise<NeweggShipOrderResponse> => {
|
|
69
|
-
const data: NeweggShipOrderData = {
|
|
70
|
-
Action: "2",
|
|
71
|
-
Value: {
|
|
72
|
-
Shipment: {
|
|
73
|
-
Header: {
|
|
74
|
-
SellerID: sellerId,
|
|
75
|
-
SONumber: Number(orderNumber),
|
|
76
|
-
},
|
|
77
|
-
PackageList: { Package: packages },
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
const res = await tryHandleRequest<NeweggShipOrderResponse>(
|
|
82
|
-
{
|
|
83
|
-
clientName: neweggSubClient(clientName, "shipOrder"),
|
|
84
|
-
requestName: "newegg.orders.ship",
|
|
85
|
-
method: "PUT",
|
|
86
|
-
url: `/ordermgmt/orderstatus/orders/${orderNumber}`,
|
|
87
|
-
params: { version: 304, ordernumber: orderNumber },
|
|
88
|
-
data,
|
|
89
|
-
},
|
|
90
|
-
"NWG_0013",
|
|
91
|
-
"Failed to ship Newegg order"
|
|
92
|
-
);
|
|
93
|
-
return res.data;
|
|
94
|
-
};
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NeweggBoolean,
|
|
3
|
-
NeweggItemFulfillmentOption,
|
|
4
|
-
NeweggNumericBoolean,
|
|
5
|
-
} from "../types.js";
|
|
6
|
-
|
|
7
|
-
export enum NeweggOrderStatus {
|
|
8
|
-
UNSHIPPED = 0,
|
|
9
|
-
PARTIALLY_SHIPPED = 1,
|
|
10
|
-
SHIPPED = 2,
|
|
11
|
-
INVOICED = 3,
|
|
12
|
-
VOIDED = 4,
|
|
13
|
-
PAYMENT_PENDING = 5,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum NeweggOrderType {
|
|
17
|
-
/** The default */
|
|
18
|
-
All = 0,
|
|
19
|
-
/** Shipped by Newegg */
|
|
20
|
-
SBN = 1,
|
|
21
|
-
/** Shipped by Seller */
|
|
22
|
-
SBS = 2,
|
|
23
|
-
MULTI_CHANNEL = 3,
|
|
24
|
-
NWS_ORDER = 4,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export enum NeweggPremierOrder {
|
|
28
|
-
All = 0,
|
|
29
|
-
Premier = 1,
|
|
30
|
-
NonPremier = 2,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export enum NeweggSalesChannel {
|
|
34
|
-
NEWEGG_ORDER = 0,
|
|
35
|
-
MULTI_CHANNEL_ORDER = 1,
|
|
36
|
-
REPLACEMENT_ORDER = 2,
|
|
37
|
-
NWS_ORDER = 3,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export enum NeweggItemStatus {
|
|
41
|
-
UNSHIPPED = 0,
|
|
42
|
-
SHIPPED = 1,
|
|
43
|
-
CANCELLED = 3,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type NeweggItemStatusName = keyof typeof NeweggItemStatus;
|
|
47
|
-
|
|
48
|
-
export type NeweggOrderStatusName = keyof typeof NeweggOrderStatus;
|
|
49
|
-
|
|
50
|
-
export type NeweggVoidSoon = 24 | 48;
|
|
51
|
-
|
|
52
|
-
export type NeweggPackageType = "Shipped" | "Unshipped";
|
|
53
|
-
|
|
54
|
-
export type NeweggShipService =
|
|
55
|
-
| "Shipped By Newegg"
|
|
56
|
-
| "APO/FPO – Military ONLY"
|
|
57
|
-
| "Super Saver(7-14 business days)"
|
|
58
|
-
| "Standard Shipping (5-7 business days)"
|
|
59
|
-
| "Expedited Shipping (3-5 business days)"
|
|
60
|
-
| "Two-Day Shipping(2 business days)"
|
|
61
|
-
| "One-Day Shipping(Next day)"
|
|
62
|
-
| "International Expedited Shipping(3-5 business days)"
|
|
63
|
-
| "International Two-Day Shipping(2 business days)"
|
|
64
|
-
| "International Economy Shipping(8-15 business days)"
|
|
65
|
-
| "International Standard Shipping(5-7 business days)"
|
|
66
|
-
| "Newegg Premier 3 Days"
|
|
67
|
-
| "Newegg Premier 2 Days"
|
|
68
|
-
| "Newegg Premier Next Day";
|
|
69
|
-
|
|
70
|
-
export interface NeweggGetOrdersData {
|
|
71
|
-
OperationType: "GetOrderInfoRequest";
|
|
72
|
-
RequestBody: NeweggGetOrdersFilters;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface NeweggGetOrdersFilters {
|
|
76
|
-
PageIndex?: string;
|
|
77
|
-
PageSize?: string;
|
|
78
|
-
RequestCriteria: {
|
|
79
|
-
OrderNumberList?: {
|
|
80
|
-
OrderNumber: string[];
|
|
81
|
-
};
|
|
82
|
-
SellerOrderNumberList?: {
|
|
83
|
-
SellerOrderNumber: string[];
|
|
84
|
-
};
|
|
85
|
-
Status?: NeweggOrderStatus;
|
|
86
|
-
OrderDownloaded?: NeweggNumericBoolean;
|
|
87
|
-
Type?: NeweggOrderType;
|
|
88
|
-
VoidSoon?: NeweggVoidSoon;
|
|
89
|
-
OrderDateFrom?: string;
|
|
90
|
-
OrderDateTo?: string;
|
|
91
|
-
CountryCode?: string;
|
|
92
|
-
PremierOrder?: NeweggPremierOrder;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface NeweggGetOrdersResponse {
|
|
97
|
-
ResponseDate: string;
|
|
98
|
-
Memo?: string;
|
|
99
|
-
IsSuccess: boolean;
|
|
100
|
-
OperationType: "GetOrderInfoResponse";
|
|
101
|
-
SellerID: string;
|
|
102
|
-
ResponseBody: NeweggGetOrdersResponseBody;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface NeweggGetOrdersResponseBody {
|
|
106
|
-
PageInfo: NeweggGetOrdersPageInfo;
|
|
107
|
-
OrderInfoList: NeweggOrder[];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface NeweggGetOrdersPageInfo {
|
|
111
|
-
TotalCount: number;
|
|
112
|
-
TotalPageCount: number;
|
|
113
|
-
PageIndex: number;
|
|
114
|
-
PageSize: number;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface NeweggOrder extends NeweggShippingAddress {
|
|
118
|
-
SellerID: string;
|
|
119
|
-
OrderNumber: number;
|
|
120
|
-
SellerOrderNumber?: string;
|
|
121
|
-
InvoiceNumber: number;
|
|
122
|
-
OrderDownloaded: boolean;
|
|
123
|
-
OrderDate: string;
|
|
124
|
-
AutoVoidTime: string;
|
|
125
|
-
OrderStatus: NeweggOrderStatus;
|
|
126
|
-
OrderStatusDescription: NeweggOrderStatusName;
|
|
127
|
-
CustomerName: string;
|
|
128
|
-
CustomerPhoneNumber: string;
|
|
129
|
-
CustomerEmailAddress: string;
|
|
130
|
-
OnTimeShipDueDate: string;
|
|
131
|
-
DeliverDueDate: string;
|
|
132
|
-
ShipService: NeweggShipService;
|
|
133
|
-
SignatureRequired: boolean;
|
|
134
|
-
CurrencyCode: string;
|
|
135
|
-
OrderItemAmount: number;
|
|
136
|
-
ShippingAmount: number;
|
|
137
|
-
DiscountAmount: number;
|
|
138
|
-
RefundAmount: number;
|
|
139
|
-
OrderTotalAmount: number;
|
|
140
|
-
SalesTax: number;
|
|
141
|
-
VATTotal: number;
|
|
142
|
-
DutyTotal: number;
|
|
143
|
-
RecyclingFeeAmount: number;
|
|
144
|
-
OrderQty: number;
|
|
145
|
-
IsAutoVoid: boolean;
|
|
146
|
-
SalesChannel: NeweggSalesChannel;
|
|
147
|
-
FulfillmentOption: NeweggItemFulfillmentOption;
|
|
148
|
-
ItemInfoList: NeweggOrderItem[];
|
|
149
|
-
PackageInfoList: NeweggOrderPackageInfo[];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface NeweggShippingAddress {
|
|
153
|
-
ShipToFirstName: string;
|
|
154
|
-
ShipToLastName: string;
|
|
155
|
-
ShipToCompany: string;
|
|
156
|
-
ShipToAddress1: string;
|
|
157
|
-
ShipToAddress2: string;
|
|
158
|
-
ShipToCityName: string;
|
|
159
|
-
ShipToStateCode: string;
|
|
160
|
-
ShipToZipCode: string;
|
|
161
|
-
ShipToCountryCode: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface NeweggOrderItem {
|
|
165
|
-
SellerPartNumber: string;
|
|
166
|
-
NeweggItemNumber: string;
|
|
167
|
-
MfrPartNumber: string;
|
|
168
|
-
UPCCode: string;
|
|
169
|
-
Description: string;
|
|
170
|
-
OrderedQty: number;
|
|
171
|
-
ShippedQty: number;
|
|
172
|
-
UnitPrice: number;
|
|
173
|
-
ExtendUnitPrice: number;
|
|
174
|
-
ExtendShippingCharge: number;
|
|
175
|
-
ExtendSalesTax: number;
|
|
176
|
-
ExtendVAT?: number;
|
|
177
|
-
ExtendDuty?: number;
|
|
178
|
-
Status: NeweggItemStatus;
|
|
179
|
-
StatusDescription: NeweggItemStatusName;
|
|
180
|
-
BuyerRequestedCancel?: boolean;
|
|
181
|
-
AutoRegWarranty: boolean;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export interface NeweggOrderPackageInfo {
|
|
185
|
-
PackageType: NeweggPackageType;
|
|
186
|
-
ShipCarrier: string;
|
|
187
|
-
ShipeService: string;
|
|
188
|
-
TrackingNumber: string;
|
|
189
|
-
ShipDate: string;
|
|
190
|
-
ItemInfoList: NeweggOrderPackageItem[];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export interface NeweggOrderPackageItem {
|
|
194
|
-
SellerPartNumber: string;
|
|
195
|
-
MfrPartNumber: string;
|
|
196
|
-
ShippedQty: number;
|
|
197
|
-
Memo?: string;
|
|
198
|
-
ResponseDate?: string;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface NeweggMarkOrderDownloadedData {
|
|
202
|
-
OperationType: "OrderConfirmationRequest";
|
|
203
|
-
RequestBody: {
|
|
204
|
-
DownloadedOrderList: {
|
|
205
|
-
OrderNumber: string[];
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface NeweggMarkOrderDownloadedResponse {
|
|
211
|
-
NeweggAPIResponse: {
|
|
212
|
-
IsSuccess: NeweggBoolean;
|
|
213
|
-
OperationType: "OrderConfirmationResponse";
|
|
214
|
-
SellerID: string;
|
|
215
|
-
ResponseDate: string;
|
|
216
|
-
ResponseBody: {
|
|
217
|
-
RequestDate: string;
|
|
218
|
-
DownloadedOrderList: {
|
|
219
|
-
OrderNumber: string;
|
|
220
|
-
}[];
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export interface NeweggShipOrderData {
|
|
226
|
-
Action: "2";
|
|
227
|
-
Value: {
|
|
228
|
-
Shipment: {
|
|
229
|
-
Header: {
|
|
230
|
-
SellerID: string;
|
|
231
|
-
SONumber: number;
|
|
232
|
-
};
|
|
233
|
-
PackageList: {
|
|
234
|
-
Package: NeweggShipOrderPackage[];
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export interface NeweggShipOrderPackage {
|
|
241
|
-
TrackingNumber: string;
|
|
242
|
-
ShipCarrier: string;
|
|
243
|
-
ShipService: string;
|
|
244
|
-
ItemList: {
|
|
245
|
-
Item: NeweggShipOrderPackageItem[];
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export interface NeweggShipOrderPackageItem {
|
|
250
|
-
SellerPartNumber: string;
|
|
251
|
-
NeweggItemNumber?: string;
|
|
252
|
-
ShippedQty: string;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export interface NeweggShipOrderResponse {
|
|
256
|
-
IsSuccess: boolean;
|
|
257
|
-
PackageProcessingSummary: {
|
|
258
|
-
FailCount: number;
|
|
259
|
-
SuccessCount: number;
|
|
260
|
-
TotalPackageCount: number;
|
|
261
|
-
};
|
|
262
|
-
Result: {
|
|
263
|
-
OrderNumber: string;
|
|
264
|
-
OrderStatus: NeweggOrderStatusName;
|
|
265
|
-
SellerID: string;
|
|
266
|
-
Shipment: {
|
|
267
|
-
PackageList: [
|
|
268
|
-
{
|
|
269
|
-
ItemList: [
|
|
270
|
-
{
|
|
271
|
-
NeweggItemNumber: string;
|
|
272
|
-
SellerPartNumber: string;
|
|
273
|
-
ShippedQty: number;
|
|
274
|
-
},
|
|
275
|
-
];
|
|
276
|
-
ProcessResult: string;
|
|
277
|
-
ProcessStatus: boolean;
|
|
278
|
-
ShipDate: string;
|
|
279
|
-
TrackingNumber: string;
|
|
280
|
-
},
|
|
281
|
-
];
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
}
|