@amazon-sp-api-release/dev-mcp 0.0.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.
Files changed (47) hide show
  1. package/README.md +82 -0
  2. package/dist/auth/sp-api-auth.d.ts +17 -0
  3. package/dist/auth/sp-api-auth.d.ts.map +1 -0
  4. package/dist/auth/sp-api-auth.js +55 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +96 -0
  8. package/dist/tools/api-tools/orders-api-tools.d.ts +103 -0
  9. package/dist/tools/api-tools/orders-api-tools.d.ts.map +1 -0
  10. package/dist/tools/api-tools/orders-api-tools.js +459 -0
  11. package/dist/tools/migration-assistant-tools/migration-tools.d.ts +21 -0
  12. package/dist/tools/migration-assistant-tools/migration-tools.d.ts.map +1 -0
  13. package/dist/tools/migration-assistant-tools/migration-tools.js +82 -0
  14. package/dist/tools/migration-assistant-tools/orders-api-migration/code-analyzer.d.ts +19 -0
  15. package/dist/tools/migration-assistant-tools/orders-api-migration/code-analyzer.d.ts.map +1 -0
  16. package/dist/tools/migration-assistant-tools/orders-api-migration/code-analyzer.js +52 -0
  17. package/dist/tools/migration-assistant-tools/orders-api-migration/code-generator.d.ts +3 -0
  18. package/dist/tools/migration-assistant-tools/orders-api-migration/code-generator.d.ts.map +1 -0
  19. package/dist/tools/migration-assistant-tools/orders-api-migration/code-generator.js +45 -0
  20. package/dist/tools/migration-assistant-tools/orders-api-migration/guidance-formatter.d.ts +3 -0
  21. package/dist/tools/migration-assistant-tools/orders-api-migration/guidance-formatter.d.ts.map +1 -0
  22. package/dist/tools/migration-assistant-tools/orders-api-migration/guidance-formatter.js +134 -0
  23. package/dist/tools/migration-assistant-tools/orders-api-migration/migration-data.d.ts +13 -0
  24. package/dist/tools/migration-assistant-tools/orders-api-migration/migration-data.d.ts.map +1 -0
  25. package/dist/tools/migration-assistant-tools/orders-api-migration/migration-data.js +181 -0
  26. package/dist/tools/migration-assistant-tools/orders-api-migration/report-formatter.d.ts +5 -0
  27. package/dist/tools/migration-assistant-tools/orders-api-migration/report-formatter.d.ts.map +1 -0
  28. package/dist/tools/migration-assistant-tools/orders-api-migration/report-formatter.js +64 -0
  29. package/dist/zod-schemas/migration-schemas.d.ts +24 -0
  30. package/dist/zod-schemas/migration-schemas.d.ts.map +1 -0
  31. package/dist/zod-schemas/migration-schemas.js +24 -0
  32. package/dist/zod-schemas/orders-schemas.d.ts +291 -0
  33. package/dist/zod-schemas/orders-schemas.d.ts.map +1 -0
  34. package/dist/zod-schemas/orders-schemas.js +178 -0
  35. package/package.json +66 -0
  36. package/src/auth/sp-api-auth.ts +88 -0
  37. package/src/index.ts +168 -0
  38. package/src/tools/api-tools/orders-api-tools.ts +684 -0
  39. package/src/tools/migration-assistant-tools/migration-tools.ts +143 -0
  40. package/src/tools/migration-assistant-tools/orders-api-migration/code-analyzer.ts +72 -0
  41. package/src/tools/migration-assistant-tools/orders-api-migration/code-generator.ts +64 -0
  42. package/src/tools/migration-assistant-tools/orders-api-migration/guidance-formatter.ts +154 -0
  43. package/src/tools/migration-assistant-tools/orders-api-migration/migration-data.ts +221 -0
  44. package/src/tools/migration-assistant-tools/orders-api-migration/report-formatter.ts +85 -0
  45. package/src/utils/logger.ts +75 -0
  46. package/src/zod-schemas/migration-schemas.ts +28 -0
  47. package/src/zod-schemas/orders-schemas.ts +196 -0
@@ -0,0 +1,143 @@
1
+ import { getOrdersApiMigrationData } from "./orders-api-migration/migration-data.js";
2
+ import { analyzeOrdersApiCode } from "./orders-api-migration/code-analyzer.js";
3
+ import { generateRefactoredOrdersApiCode } from "./orders-api-migration/code-generator.js";
4
+ import {
5
+ formatAnalysisReport,
6
+ formatMigrationReport,
7
+ } from "./orders-api-migration/report-formatter.js";
8
+ import { formatGeneralGuidance } from "./orders-api-migration/guidance-formatter.js";
9
+
10
+ export interface MigrationAssistantArgs {
11
+ source_code?: string;
12
+ source_version: string;
13
+ target_version: string;
14
+ language?: string;
15
+ analysis_only?: boolean;
16
+ }
17
+
18
+ export interface ToolResponse {
19
+ content: Array<{
20
+ type: "text";
21
+ text: string;
22
+ meta?: Record<string, unknown>;
23
+ }>;
24
+ isError?: boolean;
25
+ [key: string]: unknown;
26
+ }
27
+
28
+ export class SPAPIMigrationAssistantTool {
29
+ async migrationAssistant(
30
+ args: MigrationAssistantArgs,
31
+ ): Promise<ToolResponse> {
32
+ const {
33
+ source_code,
34
+ source_version,
35
+ target_version,
36
+ analysis_only = false,
37
+ } = args;
38
+
39
+ // Validate supported migrations
40
+ const supportedMigrations: Record<
41
+ string,
42
+ { source: string; target: string }
43
+ > = {
44
+ "orders-v0->orders-2026-01-01": {
45
+ source: "orders-v0",
46
+ target: "orders-2026-01-01",
47
+ },
48
+ };
49
+
50
+ const isSupported = Object.values(supportedMigrations).some(
51
+ (m) => m.source === source_version && m.target === target_version,
52
+ );
53
+
54
+ if (!isSupported) {
55
+ return {
56
+ content: [
57
+ {
58
+ type: "text",
59
+ text: `❌ Unsupported migration path: ${source_version} → ${target_version}\n\nSupported migrations:\n${Object.values(
60
+ supportedMigrations,
61
+ )
62
+ .map((m) => `- ${m.source} → ${m.target}`)
63
+ .join("\n")}`,
64
+ },
65
+ ],
66
+ isError: true,
67
+ };
68
+ }
69
+
70
+ // Route to appropriate migration handler
71
+ if (
72
+ source_version === "orders-v0" &&
73
+ target_version === "orders-2026-01-01"
74
+ ) {
75
+ return this.handleOrdersApiMigration(
76
+ source_code,
77
+ target_version,
78
+ analysis_only,
79
+ );
80
+ }
81
+
82
+ return {
83
+ content: [
84
+ {
85
+ type: "text",
86
+ text: `Migration handler not implemented for ${source_version} → ${target_version}`,
87
+ },
88
+ ],
89
+ isError: true,
90
+ };
91
+ }
92
+
93
+ private async handleOrdersApiMigration(
94
+ sourceCode: string | undefined,
95
+ targetVersion: string,
96
+ analysisOnly: boolean,
97
+ ): Promise<ToolResponse> {
98
+ // Get migration data
99
+ const migrationData = getOrdersApiMigrationData();
100
+
101
+ // If no source code provided, return general guidance
102
+ if (!sourceCode) {
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: formatGeneralGuidance(migrationData),
108
+ },
109
+ ],
110
+ };
111
+ }
112
+
113
+ // Analyze the source code
114
+ const analysis = analyzeOrdersApiCode(sourceCode, migrationData);
115
+
116
+ if (analysisOnly) {
117
+ return {
118
+ content: [
119
+ {
120
+ type: "text",
121
+ text: formatAnalysisReport(analysis, migrationData),
122
+ },
123
+ ],
124
+ };
125
+ }
126
+
127
+ // Generate refactored code
128
+ const refactoredCode = generateRefactoredOrdersApiCode(
129
+ sourceCode,
130
+ analysis,
131
+ targetVersion,
132
+ );
133
+
134
+ return {
135
+ content: [
136
+ {
137
+ type: "text",
138
+ text: formatMigrationReport(analysis, refactoredCode, migrationData),
139
+ },
140
+ ],
141
+ };
142
+ }
143
+ }
@@ -0,0 +1,72 @@
1
+ import { MigrationData } from "./migration-data.js";
2
+
3
+ export interface CodeAnalysis {
4
+ deprecatedEndpoints: Array<{ endpoint: string; replacement: string }>;
5
+ breakingChanges: Array<{ change: string; explanation: string }>;
6
+ usedAttributes: Array<{ v0: string; v1: string; notes: string }>;
7
+ apiCalls: string[];
8
+ }
9
+
10
+ export function analyzeOrdersApiCode(
11
+ sourceCode: string,
12
+ migrationData: MigrationData,
13
+ ): CodeAnalysis {
14
+ const deprecatedEndpoints: Array<{
15
+ endpoint: string;
16
+ replacement: string;
17
+ }> = [];
18
+ const breakingChanges: Array<{ change: string; explanation: string }> = [];
19
+ const usedAttributes: Array<{ v0: string; v1: string; notes: string }> = [];
20
+ const apiCalls: string[] = [];
21
+
22
+ // Detect API method calls
23
+ const apiMethodPatterns = Object.keys(migrationData.apiMapping);
24
+ apiMethodPatterns.forEach((method) => {
25
+ const regex = new RegExp(`\\b${method}\\b`, "g");
26
+ if (regex.test(sourceCode)) {
27
+ apiCalls.push(method);
28
+ const mapping = migrationData.apiMapping[method];
29
+
30
+ if (mapping.status.includes("❌")) {
31
+ deprecatedEndpoints.push({
32
+ endpoint: method,
33
+ replacement: mapping.v1,
34
+ });
35
+ breakingChanges.push({
36
+ change: `${method} has no V1 counterpart`,
37
+ explanation: mapping.notes,
38
+ });
39
+ }
40
+ }
41
+ });
42
+
43
+ // Detect deprecated attributes
44
+ migrationData.deprecated.forEach((attr) => {
45
+ const regex = new RegExp(`\\b${attr.replace(/\./g, "\\.")}\\b`, "g");
46
+ if (regex.test(sourceCode)) {
47
+ breakingChanges.push({
48
+ change: `Deprecated attribute: ${attr}`,
49
+ explanation: "This attribute is removed in V1 and has no replacement",
50
+ });
51
+ }
52
+ });
53
+
54
+ // Detect attribute mappings
55
+ Object.entries(migrationData.mappingExamples).forEach(([v0, v1]) => {
56
+ const regex = new RegExp(`\\b${v0.replace(/\./g, "\\.")}\\b`, "g");
57
+ if (regex.test(sourceCode)) {
58
+ usedAttributes.push({
59
+ v0,
60
+ v1,
61
+ notes: `Mapped from ${v0} to ${v1}`,
62
+ });
63
+ }
64
+ });
65
+
66
+ return {
67
+ deprecatedEndpoints,
68
+ breakingChanges,
69
+ usedAttributes,
70
+ apiCalls,
71
+ };
72
+ }
@@ -0,0 +1,64 @@
1
+ import { CodeAnalysis } from "./code-analyzer.js";
2
+
3
+ export function generateRefactoredOrdersApiCode(
4
+ sourceCode: string,
5
+ analysis: CodeAnalysis,
6
+ targetVersion: string,
7
+ ): string {
8
+ let refactoredCode = sourceCode;
9
+
10
+ // Replace attribute mappings
11
+ analysis.usedAttributes.forEach((attr) => {
12
+ const v0Pattern = new RegExp(`\\b${attr.v0.replace(/\./g, "\\.")}\\b`, "g");
13
+ refactoredCode = refactoredCode.replace(v0Pattern, attr.v1);
14
+ });
15
+
16
+ // Replace API method calls
17
+ const apiReplacements: Record<string, string> = {
18
+ getOrders: "searchOrders",
19
+ getOrder: "getOrder",
20
+ getOrderBuyerInfo: "getOrder", // with includedData
21
+ getOrderAddress: "getOrder", // with includedData
22
+ getOrderItems: "getOrder", // items included by default
23
+ getOrderItemsBuyerInfo: "getOrder", // with includedData
24
+ cancelOrder: "cancelOrder",
25
+ };
26
+
27
+ Object.entries(apiReplacements).forEach(([v0Method, v1Method]) => {
28
+ const regex = new RegExp(`\\b${v0Method}\\b`, "g");
29
+ refactoredCode = refactoredCode.replace(regex, v1Method);
30
+ });
31
+
32
+ // Add comments for V0-only APIs
33
+ analysis.deprecatedEndpoints.forEach((endpoint) => {
34
+ if (endpoint.replacement.includes("No V1 counterpart")) {
35
+ const regex = new RegExp(`(\\b${endpoint.endpoint}\\b)`, "g");
36
+ refactoredCode = refactoredCode.replace(
37
+ regex,
38
+ `$1 /* ⚠️ Continue using V0 API - No V1 equivalent */`,
39
+ );
40
+ }
41
+ });
42
+
43
+ // Update endpoint URLs
44
+ refactoredCode = refactoredCode.replace(
45
+ /\/orders\/v0\//g,
46
+ "/orders/2026-01-01/",
47
+ );
48
+
49
+ // Add migration header comment
50
+ const header = `/**
51
+ * 🔄 Migrated from ${analysis.apiCalls.length > 0 ? "Orders API V0" : "V0"} to ${targetVersion}
52
+ *
53
+ * Migration Summary:
54
+ * - ${analysis.usedAttributes.length} attributes updated
55
+ * - ${analysis.apiCalls.length} API methods analyzed
56
+ * - ${analysis.breakingChanges.length} breaking changes identified
57
+ *
58
+ * ⚠️ Note: Some V0 APIs have no V1 counterpart and must continue using V0
59
+ */
60
+
61
+ `;
62
+
63
+ return header + refactoredCode;
64
+ }
@@ -0,0 +1,154 @@
1
+ import { MigrationData } from "./migration-data.js";
2
+
3
+ export function formatGeneralGuidance(migrationData: MigrationData): string {
4
+ let guidance = `# 🔄 Orders API Migration Guide: V0 → V1 (2026-01-01)\n\n`;
5
+
6
+ guidance += `## 📋 Overview\n\n`;
7
+ guidance += `This guide helps you migrate from Orders API V0 to V1 (2026-01-01).\n\n`;
8
+
9
+ guidance += `**Key Changes:**\n`;
10
+ guidance += `- New nested data structure (buyer, recipient, fulfillment, etc.)\n`;
11
+ guidance += `- Enhanced data sets with \`includedData\` parameter\n`;
12
+ guidance += `- New programs array replaces boolean flags\n`;
13
+ guidance += `- Better financial breakdown with proceeds and expense tracking\n`;
14
+ guidance += `- Some V0 APIs have no V1 counterpart (continue using V0)\n\n`;
15
+
16
+ // API Availability
17
+ guidance += `## 🔌 API Method Mapping\n\n`;
18
+ guidance += `### ✅ Available in V1:\n\n`;
19
+ Object.entries(migrationData.apiMapping).forEach(([v0Method, mapping]) => {
20
+ if (mapping.status.includes("✅")) {
21
+ guidance += `- **${v0Method}** → ${mapping.v1}\n`;
22
+ guidance += ` ${mapping.notes}\n\n`;
23
+ }
24
+ });
25
+
26
+ guidance += `### ❌ NOT Available in V1 (Continue using V0):\n\n`;
27
+ Object.entries(migrationData.apiMapping).forEach(([v0Method, mapping]) => {
28
+ if (mapping.status.includes("❌")) {
29
+ guidance += `- **${v0Method}**\n`;
30
+ guidance += ` ${mapping.notes}\n\n`;
31
+ }
32
+ });
33
+
34
+ // Attribute Mappings
35
+ guidance += `## 🗺️ Key Attribute Mappings\n\n`;
36
+ guidance += `Common V0 attributes and their V1 equivalents:\n\n`;
37
+
38
+ const highlightedMappings = [
39
+ "AmazonOrderId",
40
+ "OrderStatus",
41
+ "IsPrime",
42
+ "IsBusinessOrder",
43
+ "OrderTotal",
44
+ "ShippingAddress",
45
+ "BuyerInfo.BuyerEmail",
46
+ "QuantityShipped",
47
+ ];
48
+
49
+ highlightedMappings.forEach((v0Attr) => {
50
+ const v1Attr = migrationData.mappingExamples[v0Attr];
51
+ if (v1Attr) {
52
+ guidance += `- \`${v0Attr}\` → \`${v1Attr}\`\n`;
53
+ }
54
+ });
55
+
56
+ guidance += `\n[View complete mapping list for all ${Object.keys(migrationData.mappingExamples).length} attributes]\n\n`;
57
+
58
+ // Breaking Changes
59
+ guidance += `## ⚠️ Breaking Changes\n\n`;
60
+ guidance += `### Deprecated Attributes (${migrationData.deprecated.length})\n\n`;
61
+ guidance += `These attributes are removed in V1 with no replacement:\n\n`;
62
+ migrationData.deprecated.slice(0, 5).forEach((attr) => {
63
+ guidance += `- ${attr}\n`;
64
+ });
65
+ if (migrationData.deprecated.length > 5) {
66
+ guidance += `- ... and ${migrationData.deprecated.length - 5} more\n`;
67
+ }
68
+ guidance += `\n`;
69
+
70
+ guidance += `### Not Supported Attributes (${migrationData.notSupported.length})\n\n`;
71
+ guidance += `These attributes are not available in current V1 release:\n\n`;
72
+ migrationData.notSupported.slice(0, 5).forEach((attr) => {
73
+ guidance += `- ${attr}\n`;
74
+ });
75
+ if (migrationData.notSupported.length > 5) {
76
+ guidance += `- ... and ${migrationData.notSupported.length - 5} more\n`;
77
+ }
78
+ guidance += `\n`;
79
+
80
+ // New Features
81
+ guidance += `## 🆕 New Features in V1\n\n`;
82
+ migrationData.newFeatures.forEach((feature) => {
83
+ guidance += `- ${feature}\n`;
84
+ });
85
+ guidance += `\n`;
86
+
87
+ // Code Examples
88
+ guidance += `## 💻 Code Examples\n\n`;
89
+ guidance += `### Checking Prime Orders\n\n`;
90
+ guidance += `**V0:**\n`;
91
+ guidance += `\`\`\`javascript\n`;
92
+ guidance += `if (order.IsPrime) {\n`;
93
+ guidance += ` // handle prime order\n`;
94
+ guidance += `}\n`;
95
+ guidance += `\`\`\`\n\n`;
96
+ guidance += `**V1:**\n`;
97
+ guidance += `\`\`\`javascript\n`;
98
+ guidance += `if (order.programs?.includes('PRIME')) {\n`;
99
+ guidance += ` // handle prime order\n`;
100
+ guidance += `}\n`;
101
+ guidance += `\`\`\`\n\n`;
102
+
103
+ guidance += `### Getting Order Status\n\n`;
104
+ guidance += `**V0:**\n`;
105
+ guidance += `\`\`\`javascript\n`;
106
+ guidance += `const status = order.OrderStatus;\n`;
107
+ guidance += `\`\`\`\n\n`;
108
+ guidance += `**V1:**\n`;
109
+ guidance += `\`\`\`javascript\n`;
110
+ guidance += `const status = order.fulfillment.fulfillmentStatus;\n`;
111
+ guidance += `\`\`\`\n\n`;
112
+
113
+ guidance += `### Search Orders (V1)\n\n`;
114
+ guidance += `\`\`\`javascript\n`;
115
+ guidance += `const response = await fetch(\n`;
116
+ guidance += ` 'https://sellingpartnerapi-na.amazon.com/orders/2026-01-01/orders?' +\n`;
117
+ guidance += ` new URLSearchParams({\n`;
118
+ guidance += ` createdAfter: '2025-12-01T00:00:00Z',\n`;
119
+ guidance += ` marketplaceIds: 'ATVPDKIKX0DER',\n`;
120
+ guidance += ` includedData: 'BUYER,RECIPIENT,FULFILLMENT'\n`;
121
+ guidance += ` }),\n`;
122
+ guidance += ` {\n`;
123
+ guidance += ` headers: {\n`;
124
+ guidance += ` 'x-amz-access-token': accessToken\n`;
125
+ guidance += ` }\n`;
126
+ guidance += ` }\n`;
127
+ guidance += `);\n`;
128
+ guidance += `\`\`\`\n\n`;
129
+
130
+ // Migration Checklist
131
+ guidance += `## ✅ Migration Checklist\n\n`;
132
+ guidance += `- [ ] Review API method availability (some require V0)\n`;
133
+ guidance += `- [ ] Update attribute references to new nested structure\n`;
134
+ guidance += `- [ ] Replace boolean flags with programs array checks\n`;
135
+ guidance += `- [ ] Add \`includedData\` parameter for additional data\n`;
136
+ guidance += `- [ ] Update endpoint URLs from \`/orders/v0/\` to \`/orders/2026-01-01/\`\n`;
137
+ guidance += `- [ ] Update error handling for new response formats\n`;
138
+ guidance += `- [ ] Test with sandbox environment\n`;
139
+ guidance += `- [ ] Update TypeScript types/interfaces\n`;
140
+ guidance += `- [ ] Plan V0 fallback for unsupported operations\n\n`;
141
+
142
+ // Resources
143
+ guidance += `## 📚 Resources\n\n`;
144
+ guidance += `- [SP-API Orders V1 Documentation](https://developer-docs.amazon.com/sp-api/docs/orders-api-v1-reference)\n`;
145
+ guidance += `- [Migration Guide](https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-to-v1-migration-guide)\n`;
146
+ guidance += `- [SP-API Developer Guide](https://developer-docs.amazon.com/sp-api/)\n\n`;
147
+
148
+ guidance += `## 🔍 Need More Help?\n\n`;
149
+ guidance += `- **Code Analysis:** Provide your source code for detailed analysis and automated refactoring\n`;
150
+ guidance += `- **Specific Attributes:** Ask about specific V0 attributes for detailed mapping\n`;
151
+ guidance += `- **API Methods:** Ask about specific V0 API methods for migration guidance\n`;
152
+
153
+ return guidance;
154
+ }
@@ -0,0 +1,221 @@
1
+ export interface MigrationData {
2
+ deprecated: string[];
3
+ notSupported: string[];
4
+ mappingExamples: Record<string, string>;
5
+ newFeatures: string[];
6
+ apiMapping: Record<string, { v1: string; status: string; notes: string }>;
7
+ }
8
+
9
+ export function getOrdersApiMigrationData(): MigrationData {
10
+ return {
11
+ deprecated: [
12
+ "OrderChannel",
13
+ "ShipServiceLevel",
14
+ "CbaDisplayableShippingLabel",
15
+ "IsGlobalExpressEnabled",
16
+ "PromiseResponseDueDate",
17
+ "IsEstimatedShipDateSet",
18
+ "IsSoldByAB",
19
+ "BuyerInfo.BuyerCounty",
20
+ ],
21
+ notSupported: [
22
+ "NumberOfItemsShipped",
23
+ "NumberOfItemsUnshipped",
24
+ "PaymentExecutionDetail",
25
+ "PaymentMethod",
26
+ "PaymentMethodDetails",
27
+ "IsIBA",
28
+ "HasRegulatedItems",
29
+ "DefaultShipFromLocationAddress",
30
+ "ElectronicInvoiceStatus",
31
+ "BuyerInvoicePreference",
32
+ "BuyerTaxInformation",
33
+ "FulfillmentInstruction",
34
+ "MarketplaceTaxInfo",
35
+ "SellerDisplayName",
36
+ "AutomatedShippingSettings",
37
+ "BuyerInfo.BuyerTaxInfo",
38
+ "ProductInfo",
39
+ "ProductInfo.NumberOfItems",
40
+ "TaxCollection",
41
+ "TaxCollection.Model",
42
+ "TaxCollection.ResponsibleParty",
43
+ "DeemedResellerCategory",
44
+ "StoreChainStoreId",
45
+ "SerialNumberRequired",
46
+ "AssociatedItems",
47
+ "AssociatedItem.OrderId",
48
+ "AssociatedItem.OrderItemId",
49
+ "AssociatedItem.AssociationType",
50
+ "PointsGrantedDetail.PointsNumber",
51
+ "PointsGrantedDetail.PointsMonetaryValue",
52
+ "ConditionId",
53
+ "ConditionSubtypeId",
54
+ ],
55
+ mappingExamples: {
56
+ AmazonOrderId: "Order.orderId",
57
+ SellerOrderId: "Order.orderAliases (with aliasType == SELLER_ORDER_ID)",
58
+ MarketplaceId: "Order.salesChannel.marketplaceId",
59
+ PurchaseDate: "Order.createdTime",
60
+ LastUpdateDate: "Order.lastUpdatedTime",
61
+ OrderType: "Order.programs (check for PREORDER)",
62
+ OrderStatus: "Order.fulfillment.fulfillmentStatus",
63
+ FulfillmentChannel: "Order.fulfillment.fulfilledBy",
64
+ SalesChannel: "Order.salesChannel.marketplaceName",
65
+ ShipmentServiceLevelCategory: "Order.fulfillment.fulfillmentServiceLevel",
66
+ OrderTotal: "Order.proceeds.grandTotal",
67
+ EasyShipShipmentStatus: "Order.packages.packageStatus.detailedStatus",
68
+ EarliestShipDate: "Order.fulfillment.shipByWindow.earliestDateTime",
69
+ LatestShipDate: "Order.fulfillment.shipByWindow.latestDateTime",
70
+ EarliestDeliveryDate:
71
+ "Order.fulfillment.deliverByWindow.earliestDateTime",
72
+ LatestDeliveryDate: "Order.fulfillment.deliverByWindow.latestDateTime",
73
+ IsBusinessOrder: "Order.programs (check for AMAZON_BUSINESS)",
74
+ IsPrime: "Order.programs (check for PRIME)",
75
+ IsPremiumOrder: "Order.programs (check for PRIMIUM)",
76
+ ReplacedOrderId:
77
+ "Order.associatedOrders (with associationType == REPLACEMENT_ORIGINAL_ID or EXCHANGE_ORIGINAL_ID)",
78
+ IsISPU: "Order.programs (check for IN_STORE_PICK_UP)",
79
+ IsAccessPointOrder:
80
+ "Order.recipient.deliveryAddress.addressType (check for PICKUP_POINT)",
81
+ ShippingAddress: "Order.recipient.deliveryAddress",
82
+ "BuyerInfo.BuyerEmail": "Order.buyer.buyerEmail",
83
+ "BuyerInfo.BuyerName": "Order.buyer.buyerName",
84
+ "BuyerInfo.PurchaseOrderNumber": "Order.buyer.buyerPurchaseOrderNumber",
85
+ BuyerCompanyName: "Order.buyer.buyerCompanyName",
86
+ DeliveryPreferences: "Order.recipient.deliveryPreference",
87
+ ASIN: "Order.orderItems.product.asin",
88
+ SellerSKU: "Order.orderItems.product.sellerSku",
89
+ OrderItemId: "Order.orderItems.orderItemId",
90
+ Title: "Order.orderItems.product.title",
91
+ QuantityOrdered: "Order.orderItems.quantityOrdered",
92
+ QuantityShipped: "Order.orderItems.fulfillment.quantityFulfilled",
93
+ PointsGranted: "Order.orderItems.expense.pointsCost.pointsGranted",
94
+ ItemPrice:
95
+ "Order.orderItems.proceeds.breakdowns.subtotal (with type == ITEM)",
96
+ ShippingPrice:
97
+ "Order.orderItems.proceeds.breakdowns.subtotal (with type == SHIPPING)",
98
+ ItemTax:
99
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == TAX && subtype == ITEM)",
100
+ ShippingTax:
101
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == TAX && subtype == SHIPPING)",
102
+ ShippingDiscount:
103
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == DISCOUNT && subtype == SHIPPING)",
104
+ PromotionDiscount:
105
+ "Order.orderItems.proceeds.breakdowns.subtotal (with type == DISCOUNT)",
106
+ PromotionDiscountTax:
107
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == TAX && subtype == DISCOUNT)",
108
+ CODFee:
109
+ "Order.orderItems.proceeds.breakdowns.subtotal (with type == COD_FEE)",
110
+ CODFeeDiscount:
111
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == DISCOUNT && subtype == COD_FEE)",
112
+ "ItemBuyerInfo.GiftWrapPrice":
113
+ "Order.orderItems.proceeds.breakdowns.subtotal (with type == GIFT_WRAP)",
114
+ "ItemBuyerInfo.GiftWrapTax":
115
+ "Order.orderItems.proceeds.breakdowns.detailedBreakdowns.value (type == TAX && subtype == GIFT_WRAP)",
116
+ PromotionIds: "Order.orderItems.promotion.breakdowns.promotionId",
117
+ IsGift: "Order.orderItems.fulfillment.packing.giftOption",
118
+ ConditionNote: "Order.orderItems.product.condition",
119
+ ScheduledDeliveryStartDate:
120
+ "Order.orderItems.fulfillment.shipping.scheduledDeliveryWindow",
121
+ ScheduledDeliveryEndDate:
122
+ "Order.orderItems.fulfillment.shipping.scheduledDeliveryWindow",
123
+ PriceDesignation: "Order.orderItems.product.price.priceDesignation",
124
+ IossNumber:
125
+ "Order.orderItems.fulfillment.shipping.internationalShipping.iossNumber",
126
+ IsTransparency: "Order.orderItems.programs (check for TRANSPARENCY)",
127
+ "ItemBuyerInfo.BuyerCustomizedInfo":
128
+ "Order.orderItems.product.customization",
129
+ "ItemBuyerInfo.BuyerCustomizedInfo.CustomizedURL":
130
+ "Order.orderItems.product.customization.customizedUrl",
131
+ "ItemBuyerInfo.GiftMessageText":
132
+ "Order.orderItems.fulfillment.packing.giftOption.giftMessage",
133
+ "ItemBuyerInfo.GiftWrapLevel":
134
+ "Order.orderItems.fulfillment.packing.giftOption.giftWrapLevel",
135
+ "BuyerRequestedCancel.IsBuyerRequestedCancel":
136
+ "Order.orderItems.cancellation.requester (check for BUYER)",
137
+ "BuyerRequestedCancel.BuyerCancelReason":
138
+ "Order.orderItems.cancellation.cancelReason",
139
+ SerialNumbers: "Order.orderItems.product.serialNumbers",
140
+ SubstitutionPreferences:
141
+ "Order.orderItems.fulfillment.picking.substitutionPreference",
142
+ Measurement: "Order.orderItems.measurement",
143
+ ShippingConstraints:
144
+ "Order.orderItems.fulfillment.shipping.shippingConstraints",
145
+ AmazonPrograms:
146
+ "Order.orderItems.programs or Order.programs (check for SUBSCRIBE_AND_SAVE, FBM_SHIP_PULS)",
147
+ },
148
+ newFeatures: [
149
+ "Order.programs with AMAZON_BAZAAR",
150
+ "Order.programs with AMAZON_HAUL",
151
+ "Order.programs with AMAZON_EASY_SHIP (non-Brazil) or DELIVERY_BY_AMAZON (Brazil only)",
152
+ "Order.orderItems.product.price.unitPrice",
153
+ "Order.orderItems.proceeds.proceedsTotal",
154
+ "Order.orderItems.fulfillment.shipping.shippingConstraints.cashOnDelivery",
155
+ "Order.packages for FBM orders (carrier, shippingService, trackingNumber, package status)",
156
+ ],
157
+ apiMapping: {
158
+ getOrders: {
159
+ v1: "search_orders (with filters)",
160
+ status: "✅ Available",
161
+ notes: "Use with filters like createdAfter, marketplaceIds, etc.",
162
+ },
163
+ getOrder: {
164
+ v1: "get_order (with includedData parameter)",
165
+ status: "✅ Available",
166
+ notes:
167
+ "Order items included by default, use includedData for additional data",
168
+ },
169
+ getOrderBuyerInfo: {
170
+ v1: "get_order (with includedData=['BUYER'])",
171
+ status: "✅ Available",
172
+ notes: "Include BUYER in includedData parameter",
173
+ },
174
+ getOrderAddress: {
175
+ v1: "get_order (with includedData=['RECIPIENT'])",
176
+ status: "✅ Available",
177
+ notes: "Include RECIPIENT in includedData parameter",
178
+ },
179
+ getOrderItems: {
180
+ v1: "get_order (order items included by default)",
181
+ status: "✅ Available",
182
+ notes: "Order items are always included, no need for separate call",
183
+ },
184
+ getOrderItemsBuyerInfo: {
185
+ v1: "get_order (with includedData=['BUYER'])",
186
+ status: "✅ Available",
187
+ notes: "Item buyer info included when BUYER is in includedData",
188
+ },
189
+ getOrderRegulatedInfo: {
190
+ v1: "No V1 counterpart",
191
+ status: "❌ Not Available",
192
+ notes:
193
+ "Continue using V0 API: GET /orders/v0/orders/{orderId}/regulatedInfo",
194
+ },
195
+ updateShipmentStatus: {
196
+ v1: "No V1 counterpart",
197
+ status: "❌ Not Available",
198
+ notes:
199
+ "Continue using V0 API: POST /orders/v0/orders/{orderId}/shipment",
200
+ },
201
+ updateVerificationStatus: {
202
+ v1: "No V1 counterpart",
203
+ status: "❌ Not Available",
204
+ notes:
205
+ "Continue using V0 API: PATCH /orders/v0/orders/{orderId}/verificationStatus",
206
+ },
207
+ confirmShipment: {
208
+ v1: "No V1 counterpart",
209
+ status: "❌ Not Available",
210
+ notes:
211
+ "Continue using V0 API: POST /orders/v0/orders/{orderId}/shipConfirmation",
212
+ },
213
+ cancelOrder: {
214
+ v1: "cancel_order",
215
+ status: "✅ Available",
216
+ notes:
217
+ "Available in V1 as PUT /orders/v1/orders/{orderId}/cancellation",
218
+ },
219
+ },
220
+ };
221
+ }