ebay-mcp 1.13.2 → 1.14.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/README.de.md +3 -3
- package/README.es.md +3 -3
- package/README.fr.md +3 -3
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +163 -41
- package/README.pt-BR.md +3 -3
- package/README.ru.md +3 -3
- package/README.zh-CN.md +3 -3
- package/build/api/account-management/account.js +633 -297
- package/build/api/analytics-and-report/analytics.js +111 -65
- package/build/api/client.js +199 -140
- package/build/api/clientRequestError.js +23 -0
- package/build/api/clientTrading.js +213 -0
- package/build/api/clientTradingError.js +4 -0
- package/build/api/communication/feedback.js +147 -59
- package/build/api/communication/message.js +134 -81
- package/build/api/communication/negotiation.js +65 -53
- package/build/api/communication/notification.js +458 -164
- package/build/api/developer/developer.js +99 -45
- package/build/api/index.js +23 -8
- package/build/api/listing-management/inventory.js +884 -338
- package/build/api/listing-metadata/metadata.js +416 -170
- package/build/api/listing-metadata/taxonomy.js +187 -42
- package/build/api/marketing-and-promotions/marketing.js +1392 -598
- package/build/api/marketing-and-promotions/recommendation.js +49 -24
- package/build/api/order-management/dispute.js +226 -45
- package/build/api/order-management/fulfillment.js +144 -71
- package/build/api/order-management/orderIssueHelpers.js +61 -0
- package/build/api/other/compliance.js +50 -38
- package/build/api/other/edelivery.js +603 -159
- package/build/api/other/finding.js +280 -0
- package/build/api/other/identity.js +30 -15
- package/build/api/other/translation.js +29 -14
- package/build/api/other/vero.js +113 -27
- package/build/api/rateLimitTracker.js +55 -0
- package/build/api/shared/request.js +189 -98
- package/build/api/trading/trading.js +154 -87
- package/build/auth/credentialSession.js +250 -0
- package/build/auth/oauth.js +298 -171
- package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
- package/build/auth/oauthMiddleware.js +104 -0
- package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
- package/build/auth/tokenVerifier.js +243 -0
- package/build/auth/tokenVerifierError.js +21 -0
- package/build/config/environment.js +148 -113
- package/build/config/{tool-families.js → toolFamilies.js} +30 -14
- package/build/index.js +25 -19
- package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
- package/build/mcp/readOnlyFilter.js +67 -0
- package/build/mcp/runtime.js +31 -13
- package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
- package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
- package/build/schemas/account-management/account.js +144 -6
- package/build/schemas/analytics/analytics.js +33 -19
- package/build/schemas/communication/messages.js +12 -42
- package/build/schemas/developer/developer.js +135 -0
- package/build/schemas/fulfillment/orders.js +183 -21
- package/build/schemas/index.js +27 -19
- package/build/schemas/inventory-management/inventory.js +17 -9
- package/build/schemas/marketing/marketing.js +480 -25
- package/build/schemas/metadata/metadata.js +11 -6
- package/build/schemas/other/finding.js +27 -0
- package/build/schemas/other/otherApis.js +424 -0
- package/build/schemas/taxonomy/taxonomy.js +11 -5
- package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
- package/build/scripts/{build-ui.js → buildUi.js} +6 -1
- package/build/scripts/{dev-sync.js → devSync.js} +169 -110
- package/build/scripts/diagnostics.js +52 -44
- package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
- package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
- package/build/scripts/setup.js +241 -178
- package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
- package/build/scripts/skills.js +35 -27
- package/build/scripts/updateApiStatusDoc.js +71 -0
- package/build/serverHttp.js +90 -0
- package/build/skills/content.js +124 -118
- package/build/skills/index.js +22 -10
- package/build/skills/install.js +21 -10
- package/build/skills/markers.js +50 -15
- package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
- package/build/skills/render.js +41 -14
- package/build/skills/targets.js +49 -17
- package/build/tools/categories/account.js +166 -264
- package/build/tools/categories/analytics.js +11 -22
- package/build/tools/categories/browse.js +17 -0
- package/build/tools/categories/communication.js +124 -399
- package/build/tools/categories/connector.js +23 -20
- package/build/tools/categories/developer.js +46 -159
- package/build/tools/categories/fulfillment.js +84 -215
- package/build/tools/categories/index.js +6 -14
- package/build/tools/categories/inventory.js +238 -293
- package/build/tools/categories/marketing.js +677 -39
- package/build/tools/categories/metadata.js +190 -117
- package/build/tools/categories/other.js +81 -208
- package/build/tools/categories/taxonomy.js +29 -20
- package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
- package/build/tools/categories/trading.js +16 -47
- package/build/tools/contracts.js +34 -24
- package/build/tools/{define-tool.js → defineTool.js} +44 -29
- package/build/tools/registry.js +87 -29
- package/build/tools/schemas.js +3 -57
- package/build/tools/ui/archetypes.js +1 -0
- package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
- package/build/tools/ui/maps.js +294 -80
- package/build/types/index.js +1 -1
- package/build/ui/card.html +14 -14
- package/build/ui/chart.html +14 -14
- package/build/ui/stat.html +87 -0
- package/build/ui/table.html +14 -14
- package/build/utils/apiStatusFeed.js +95 -0
- package/build/utils/cliOutput.js +15 -0
- package/build/utils/cliUi.js +108 -0
- package/build/utils/communication/feedback.js +57 -77
- package/build/utils/communication/message.js +69 -98
- package/build/utils/communication/negotiation.js +30 -57
- package/build/utils/communication/notification.js +112 -252
- package/build/utils/{date-converter.js → dateConverter.js} +62 -30
- package/build/utils/effectSchema.js +203 -0
- package/build/utils/effectSchemaAdapter.js +121 -0
- package/build/utils/effectSchemaChainMethods.js +146 -0
- package/build/utils/effectSchemaRefinements.js +104 -0
- package/build/utils/effectSchemaStringMethods.js +63 -0
- package/build/utils/effectSchemaTypes.js +47 -0
- package/build/utils/{env-parser.js → envParser.js} +10 -2
- package/build/utils/errors.js +7 -3
- package/build/utils/http.js +148 -89
- package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
- package/build/utils/logger.js +127 -51
- package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
- package/build/utils/other/compliance.js +18 -38
- package/build/utils/other/identity.js +2 -2
- package/build/utils/other/translation.js +4 -4
- package/build/utils/other/vero.js +36 -20
- package/build/utils/schemaHelpers.js +22 -0
- package/build/utils/scopeHelper.js +270 -0
- package/build/utils/securityChecker.js +316 -0
- package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
- package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
- package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
- package/build/utils/trading/trading.js +35 -0
- package/build/utils/typeGuards.js +12 -0
- package/build/utils/version.js +65 -29
- package/package.json +10 -8
- package/build/api/client-trading.js +0 -124
- package/build/api/communication/shared.js +0 -59
- package/build/api/shared/query-params.js +0 -16
- package/build/auth/credential-session.js +0 -166
- package/build/auth/oauth-middleware.js +0 -100
- package/build/auth/token-verifier.js +0 -186
- package/build/schemas/other/other-apis.js +0 -390
- package/build/scripts/update-api-status-doc.js +0 -44
- package/build/server-http.js +0 -85
- package/build/tools/definitions/marketing.js +0 -1381
- package/build/tools/tool-handlers/marketing.js +0 -312
- package/build/utils/account-management/account.js +0 -818
- package/build/utils/api-status-feed.js +0 -84
- package/build/utils/cli-ui.js +0 -47
- package/build/utils/order-management/dispute.js +0 -369
- package/build/utils/order-management/fulfillment.js +0 -205
- package/build/utils/other/edelivery.js +0 -235
- package/build/utils/schema-helpers.js +0 -13
- package/build/utils/scope-helper.js +0 -207
- package/build/utils/security-checker.js +0 -248
- package/build/utils/type-guards.js +0 -6
- /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
- /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
- /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
- /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Based on: docs/sell-apps/marketing-and-promotions/sell_recommendation_v1_oas3.json
|
|
5
|
-
*/
|
|
1
|
+
import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
/** Recommendation API - Promoted Listings recommendation discovery. */
|
|
6
4
|
export class RecommendationApi {
|
|
7
5
|
client;
|
|
8
6
|
basePath = '/sell/recommendation/v1';
|
|
@@ -10,24 +8,51 @@ export class RecommendationApi {
|
|
|
10
8
|
this.client = client;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Finds listing recommendations for active listings in one marketplace.
|
|
12
|
+
*
|
|
13
|
+
* @param input - Request body, recommendation filter, pagination, and marketplace header.
|
|
14
|
+
* @returns An Effect that succeeds with eBay's PagedListingRecommendationCollection.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const recommendations = await Effect.runPromise(
|
|
19
|
+
* recommendationApi.findListingRecommendations({
|
|
20
|
+
* marketplaceId: 'EBAY_US',
|
|
21
|
+
* requestBody: { listingIds: ['110000000000'] },
|
|
22
|
+
* limit: 10,
|
|
23
|
+
* }),
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see https://developer.ebay.com/api-docs/sell/recommendation/resources/find/methods/findListingRecommendations
|
|
15
28
|
*/
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
params
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
findListingRecommendations = (input) => {
|
|
30
|
+
const client = this.client;
|
|
31
|
+
const path = `${this.basePath}/find`;
|
|
32
|
+
return Effect.gen(function* () {
|
|
33
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
34
|
+
const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
|
|
35
|
+
const filter = yield* optionalStringEffect(validatedInput.filter, 'filter');
|
|
36
|
+
const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
|
|
37
|
+
const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
|
|
38
|
+
let requestBody = {};
|
|
39
|
+
if (validatedInput.requestBody !== undefined) {
|
|
40
|
+
requestBody = yield* requireObjectEffect(validatedInput.requestBody, 'requestBody');
|
|
41
|
+
}
|
|
42
|
+
const params = buildEndpointParams({
|
|
43
|
+
filter: { wireName: 'filter', value: filter },
|
|
44
|
+
limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
|
|
45
|
+
offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
|
|
46
|
+
});
|
|
47
|
+
const config = {
|
|
48
|
+
headers: {
|
|
49
|
+
'X-EBAY-C-MARKETPLACE-ID': marketplaceId,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
if (params !== undefined) {
|
|
53
|
+
config.params = params;
|
|
54
|
+
}
|
|
55
|
+
return yield* requestPostEffect(client, path, requestBody, config);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
33
58
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { buildEndpointParams, EndpointInputError, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { isRecord } from '../../utils/typeGuards.js';
|
|
3
|
+
import { Effect } from 'effect';
|
|
4
|
+
const requireUploadEvidenceFileBodyEffect = (value) => {
|
|
5
|
+
if (value instanceof ArrayBuffer || value instanceof Uint8Array || isRecord(value)) {
|
|
6
|
+
return Effect.succeed(value);
|
|
7
|
+
}
|
|
8
|
+
return Effect.fail(new EndpointInputError({
|
|
9
|
+
parameter: 'body',
|
|
10
|
+
message: 'body is required and must be binary data or a multipart-compatible object',
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
/** eBay Fulfillment payment dispute endpoints. */
|
|
6
14
|
export class DisputeApi {
|
|
7
15
|
client;
|
|
8
16
|
basePath = '/sell/fulfillment/v1';
|
|
@@ -10,61 +18,234 @@ export class DisputeApi {
|
|
|
10
18
|
this.client = client;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
|
-
*
|
|
21
|
+
* Retrieves one payment dispute.
|
|
22
|
+
*
|
|
23
|
+
* @param input - Payment dispute identifier to retrieve.
|
|
24
|
+
* @returns An Effect that succeeds with eBay's generated PaymentDispute response.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const dispute = await Effect.runPromise(
|
|
29
|
+
* disputeApi.getPaymentDispute({ paymentDisputeId: '5001234567' }),
|
|
30
|
+
* );
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/getPaymentDispute
|
|
14
34
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
getPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
36
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
37
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}`;
|
|
38
|
+
return yield* requestGetEffect(this.client, path);
|
|
39
|
+
});
|
|
18
40
|
/**
|
|
19
|
-
*
|
|
41
|
+
* Downloads one evidence file attached to a payment dispute.
|
|
42
|
+
*
|
|
43
|
+
* @param input - Payment dispute, evidence set, and evidence file identifiers.
|
|
44
|
+
* @returns An Effect that succeeds with the downloaded binary evidence content.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const content = await Effect.runPromise(
|
|
49
|
+
* disputeApi.fetchEvidenceContent({
|
|
50
|
+
* paymentDisputeId: '5001234567',
|
|
51
|
+
* evidenceId: 'EVIDENCE-1',
|
|
52
|
+
* fileId: 'FILE-1',
|
|
53
|
+
* }),
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/fetchEvidenceContent
|
|
20
58
|
*/
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
59
|
+
fetchEvidenceContent = (input) => Effect.gen(this, function* () {
|
|
60
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
61
|
+
const evidenceId = yield* requireStringEffect(input.evidenceId, 'evidenceId');
|
|
62
|
+
const fileId = yield* requireStringEffect(input.fileId, 'fileId');
|
|
63
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/fetch_evidence_content`;
|
|
64
|
+
const params = buildEndpointParams({
|
|
65
|
+
evidenceId: { wireName: 'evidence_id', value: evidenceId },
|
|
66
|
+
fileId: { wireName: 'file_id', value: fileId },
|
|
67
|
+
});
|
|
68
|
+
return yield* requestGetEffect(this.client, path, params, {
|
|
69
|
+
headers: { Accept: 'application/octet-stream' },
|
|
70
|
+
responseType: 'arraybuffer',
|
|
71
|
+
});
|
|
72
|
+
});
|
|
28
73
|
/**
|
|
29
|
-
*
|
|
74
|
+
* Retrieves the activity history for one payment dispute.
|
|
75
|
+
*
|
|
76
|
+
* @param input - Payment dispute identifier whose activity history is requested.
|
|
77
|
+
* @returns An Effect that succeeds with eBay's generated PaymentDisputeActivityHistory.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const activity = await Effect.runPromise(
|
|
82
|
+
* disputeApi.getActivities({ paymentDisputeId: '5001234567' }),
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/getActivities
|
|
30
87
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
88
|
+
getActivities = (input) => Effect.gen(this, function* () {
|
|
89
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
90
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/activity`;
|
|
91
|
+
return yield* requestGetEffect(this.client, path);
|
|
92
|
+
});
|
|
34
93
|
/**
|
|
35
|
-
*
|
|
94
|
+
* Searches payment disputes using the filters supported by eBay.
|
|
95
|
+
*
|
|
96
|
+
* @param input - Optional dispute summary filters and pagination controls.
|
|
97
|
+
* @returns An Effect that succeeds with eBay's generated DisputeSummaryResponse.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const disputes = await Effect.runPromise(
|
|
102
|
+
* disputeApi.getPaymentDisputeSummaries({ orderId: 'ORDER-1', limit: 25 }),
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/getPaymentDisputeSummaries
|
|
36
107
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
108
|
+
getPaymentDisputeSummaries = (input = {}) => Effect.gen(this, function* () {
|
|
109
|
+
const orderId = yield* optionalStringEffect(input.orderId, 'orderId');
|
|
110
|
+
const buyerUsername = yield* optionalStringEffect(input.buyerUsername, 'buyerUsername');
|
|
111
|
+
const openDateFrom = yield* optionalStringEffect(input.openDateFrom, 'openDateFrom');
|
|
112
|
+
const openDateTo = yield* optionalStringEffect(input.openDateTo, 'openDateTo');
|
|
113
|
+
const paymentDisputeStatus = yield* optionalStringEffect(input.paymentDisputeStatus, 'paymentDisputeStatus');
|
|
114
|
+
const limit = yield* optionalPositiveNumberEffect(input.limit, 'limit');
|
|
115
|
+
const offset = yield* optionalNonNegativeNumberEffect(input.offset, 'offset');
|
|
116
|
+
const path = `${this.basePath}/payment_dispute_summary`;
|
|
117
|
+
const params = buildEndpointParams({
|
|
118
|
+
orderId: { wireName: 'order_id', value: orderId },
|
|
119
|
+
buyerUsername: { wireName: 'buyer_username', value: buyerUsername },
|
|
120
|
+
openDateFrom: { wireName: 'open_date_from', value: openDateFrom },
|
|
121
|
+
openDateTo: { wireName: 'open_date_to', value: openDateTo },
|
|
122
|
+
paymentDisputeStatus: {
|
|
123
|
+
wireName: 'payment_dispute_status',
|
|
124
|
+
value: paymentDisputeStatus,
|
|
125
|
+
},
|
|
126
|
+
limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
|
|
127
|
+
offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
|
|
128
|
+
});
|
|
129
|
+
return yield* requestGetEffect(this.client, path, params);
|
|
130
|
+
});
|
|
40
131
|
/**
|
|
41
|
-
*
|
|
132
|
+
* Accepts one payment dispute.
|
|
133
|
+
*
|
|
134
|
+
* @param input - Payment dispute identifier and optional generated accept payload.
|
|
135
|
+
* @returns An Effect that succeeds when eBay accepts the dispute action.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* await Effect.runPromise(
|
|
140
|
+
* disputeApi.acceptPaymentDispute({
|
|
141
|
+
* paymentDisputeId: '5001234567',
|
|
142
|
+
* body: { revision: 3 },
|
|
143
|
+
* }),
|
|
144
|
+
* );
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/acceptPaymentDispute
|
|
42
148
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
149
|
+
acceptPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
150
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
151
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/accept`;
|
|
152
|
+
return yield* requestPostEffect(this.client, path, input.body);
|
|
153
|
+
});
|
|
46
154
|
/**
|
|
47
|
-
*
|
|
155
|
+
* Contests one payment dispute.
|
|
156
|
+
*
|
|
157
|
+
* @param input - Payment dispute identifier and optional generated contest payload.
|
|
158
|
+
* @returns An Effect that succeeds when eBay accepts the contest action.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* await Effect.runPromise(
|
|
163
|
+
* disputeApi.contestPaymentDispute({
|
|
164
|
+
* paymentDisputeId: '5001234567',
|
|
165
|
+
* body: { note: 'Proof of delivery is attached.', revision: 3 },
|
|
166
|
+
* }),
|
|
167
|
+
* );
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/contestPaymentDispute
|
|
48
171
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
172
|
+
contestPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
173
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
174
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/contest`;
|
|
175
|
+
return yield* requestPostEffect(this.client, path, input.body);
|
|
176
|
+
});
|
|
52
177
|
/**
|
|
53
|
-
*
|
|
178
|
+
* Uploads one evidence file for a payment dispute.
|
|
179
|
+
*
|
|
180
|
+
* @param input - Payment dispute identifier and multipart-compatible evidence file body.
|
|
181
|
+
* @returns An Effect that succeeds with eBay's generated FileEvidence response.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* const file = await Effect.runPromise(
|
|
186
|
+
* disputeApi.uploadEvidenceFile({
|
|
187
|
+
* paymentDisputeId: '5001234567',
|
|
188
|
+
* body: new ArrayBuffer(8),
|
|
189
|
+
* }),
|
|
190
|
+
* );
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/uploadEvidenceFile
|
|
54
194
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
195
|
+
uploadEvidenceFile = (input) => Effect.gen(this, function* () {
|
|
196
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
197
|
+
const body = yield* requireUploadEvidenceFileBodyEffect(input.body);
|
|
198
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/upload_evidence_file`;
|
|
199
|
+
return yield* requestPostEffect(this.client, path, body, {
|
|
200
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
201
|
+
});
|
|
202
|
+
});
|
|
58
203
|
/**
|
|
59
|
-
*
|
|
204
|
+
* Adds evidence to one payment dispute.
|
|
205
|
+
*
|
|
206
|
+
* @param input - Payment dispute identifier and generated add-evidence payload.
|
|
207
|
+
* @returns An Effect that succeeds with eBay's generated AddEvidencePaymentDisputeResponse.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* const evidence = await Effect.runPromise(
|
|
212
|
+
* disputeApi.addEvidence({
|
|
213
|
+
* paymentDisputeId: '5001234567',
|
|
214
|
+
* body: { evidenceType: 'PROOF_OF_DELIVERY', files: [{ fileId: 'FILE-1' }] },
|
|
215
|
+
* }),
|
|
216
|
+
* );
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/addEvidence
|
|
60
220
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
221
|
+
addEvidence = (input) => Effect.gen(this, function* () {
|
|
222
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
223
|
+
const body = yield* requireObjectEffect(input.body, 'body');
|
|
224
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/add_evidence`;
|
|
225
|
+
return yield* requestPostEffect(this.client, path, body);
|
|
226
|
+
});
|
|
64
227
|
/**
|
|
65
|
-
*
|
|
228
|
+
* Updates evidence on one payment dispute.
|
|
229
|
+
*
|
|
230
|
+
* @param input - Payment dispute identifier and generated update-evidence payload.
|
|
231
|
+
* @returns An Effect that succeeds when eBay accepts the evidence update.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* await Effect.runPromise(
|
|
236
|
+
* disputeApi.updateEvidence({
|
|
237
|
+
* paymentDisputeId: '5001234567',
|
|
238
|
+
* body: { evidenceId: 'EVIDENCE-1', files: [{ fileId: 'FILE-2' }] },
|
|
239
|
+
* }),
|
|
240
|
+
* );
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/payment_dispute/methods/updateEvidence
|
|
66
244
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
245
|
+
updateEvidence = (input) => Effect.gen(this, function* () {
|
|
246
|
+
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
247
|
+
const body = yield* requireObjectEffect(input.body, 'body');
|
|
248
|
+
const path = `${this.basePath}/payment_dispute/${paymentDisputeId}/update_evidence`;
|
|
249
|
+
return yield* requestPostEffect(this.client, path, body);
|
|
250
|
+
});
|
|
70
251
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Based on: docs/sell-apps/order-management/sell_fulfillment_v1_oas3.json
|
|
5
|
-
*/
|
|
1
|
+
import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
/** eBay Fulfillment order, shipping fulfillment, and refund endpoints. */
|
|
6
4
|
export class FulfillmentApi {
|
|
7
5
|
client;
|
|
8
6
|
basePath = '/sell/fulfillment/v1';
|
|
@@ -10,81 +8,156 @@ export class FulfillmentApi {
|
|
|
10
8
|
this.client = client;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
11
|
+
* Retrieves seller orders.
|
|
12
|
+
*
|
|
13
|
+
* @param input - Optional order filters, field groups, and pagination controls.
|
|
14
|
+
* @returns An Effect that succeeds with eBay's generated OrderSearchPagedCollection.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const orders = await Effect.runPromise(
|
|
19
|
+
* fulfillmentApi.getOrders({
|
|
20
|
+
* filter: 'orderfulfillmentstatus:{NOT_STARTED|IN_PROGRESS}',
|
|
21
|
+
* limit: 50,
|
|
22
|
+
* }),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/methods/getOrders
|
|
14
27
|
*/
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
getOrders = (input = {}) => Effect.gen(this, function* () {
|
|
29
|
+
const fieldGroups = yield* optionalStringEffect(input.fieldGroups, 'fieldGroups');
|
|
30
|
+
const filter = yield* optionalStringEffect(input.filter, 'filter');
|
|
31
|
+
const limit = yield* optionalPositiveNumberEffect(input.limit, 'limit');
|
|
32
|
+
const offset = yield* optionalNonNegativeNumberEffect(input.offset, 'offset');
|
|
33
|
+
const orderIds = yield* optionalStringEffect(input.orderIds, 'orderIds');
|
|
34
|
+
const path = `${this.basePath}/order`;
|
|
35
|
+
const params = buildEndpointParams({
|
|
36
|
+
fieldGroups: { wireName: 'fieldGroups', value: fieldGroups },
|
|
37
|
+
filter: { wireName: 'filter', value: filter },
|
|
38
|
+
limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
|
|
39
|
+
offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
|
|
40
|
+
orderIds: { wireName: 'orderIds', value: orderIds },
|
|
41
|
+
});
|
|
42
|
+
return yield* requestGetEffect(this.client, path, params);
|
|
43
|
+
});
|
|
25
44
|
/**
|
|
26
|
-
*
|
|
45
|
+
* Retrieves one order.
|
|
46
|
+
*
|
|
47
|
+
* @param input - Order identifier and optional field group.
|
|
48
|
+
* @returns An Effect that succeeds with eBay's generated Order response.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const order = await Effect.runPromise(
|
|
53
|
+
* fulfillmentApi.getOrder({ orderId: '01-12345-67890' }),
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/methods/getOrder
|
|
27
58
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
59
|
+
getOrder = (input) => Effect.gen(this, function* () {
|
|
60
|
+
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
61
|
+
const fieldGroups = yield* optionalStringEffect(input.fieldGroups, 'fieldGroups');
|
|
62
|
+
const path = `${this.basePath}/order/${orderId}`;
|
|
63
|
+
const params = buildEndpointParams({
|
|
64
|
+
fieldGroups: { wireName: 'fieldGroups', value: fieldGroups },
|
|
65
|
+
});
|
|
66
|
+
return yield* requestGetEffect(this.client, path, params);
|
|
67
|
+
});
|
|
31
68
|
/**
|
|
32
|
-
*
|
|
69
|
+
* Creates a shipping fulfillment for one order.
|
|
70
|
+
*
|
|
71
|
+
* @param input - Order identifier and generated shipping fulfillment payload.
|
|
72
|
+
* @returns An Effect that succeeds with eBay's generated create response object.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* await Effect.runPromise(
|
|
77
|
+
* fulfillmentApi.createShippingFulfillment({
|
|
78
|
+
* orderId: '01-12345-67890',
|
|
79
|
+
* body: { lineItems: [{ lineItemId: 'LINE-1', quantity: 1 }] },
|
|
80
|
+
* }),
|
|
81
|
+
* );
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/shipping_fulfillment/methods/createShippingFulfillment
|
|
33
85
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
86
|
+
createShippingFulfillment = (input) => Effect.gen(this, function* () {
|
|
87
|
+
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
88
|
+
const body = yield* requireObjectEffect(input.body, 'body');
|
|
89
|
+
const path = `${this.basePath}/order/${orderId}/shipping_fulfillment`;
|
|
90
|
+
return yield* requestPostEffect(this.client, path, body);
|
|
91
|
+
});
|
|
37
92
|
/**
|
|
38
|
-
*
|
|
93
|
+
* Retrieves all shipping fulfillments for one order.
|
|
94
|
+
*
|
|
95
|
+
* @param input - Order identifier whose shipping fulfillments are requested.
|
|
96
|
+
* @returns An Effect that succeeds with eBay's generated ShippingFulfillmentPagedCollection.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const fulfillments = await Effect.runPromise(
|
|
101
|
+
* fulfillmentApi.getShippingFulfillments({ orderId: '01-12345-67890' }),
|
|
102
|
+
* );
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/shipping_fulfillment/methods/getShippingFulfillments
|
|
39
106
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
107
|
+
getShippingFulfillments = (input) => Effect.gen(this, function* () {
|
|
108
|
+
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
109
|
+
const path = `${this.basePath}/order/${orderId}/shipping_fulfillment`;
|
|
110
|
+
return yield* requestGetEffect(this.client, path);
|
|
111
|
+
});
|
|
43
112
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
113
|
+
* Retrieves one shipping fulfillment for one order.
|
|
114
|
+
*
|
|
115
|
+
* @param input - Order identifier and shipping fulfillment identifier.
|
|
116
|
+
* @returns An Effect that succeeds with eBay's generated ShippingFulfillment response.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const fulfillment = await Effect.runPromise(
|
|
121
|
+
* fulfillmentApi.getShippingFulfillment({
|
|
122
|
+
* orderId: '01-12345-67890',
|
|
123
|
+
* fulfillmentId: '9405509699937003457459',
|
|
124
|
+
* }),
|
|
125
|
+
* );
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/shipping_fulfillment/methods/getShippingFulfillment
|
|
47
129
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
async issueRefund(orderId, refund) {
|
|
55
|
-
return await withApiError('Failed to issue refund', () => this.client.post(`${this.basePath}/order/${orderId}/issue_refund`, refund));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get payment dispute summaries
|
|
59
|
-
* Note: This method delegates to the DisputeApi
|
|
60
|
-
*/
|
|
61
|
-
async getPaymentDisputeSummaries(params) {
|
|
62
|
-
return await withApiError('Failed to get payment dispute summaries', () => this.client.get(`${this.basePath}/payment_dispute_summary`, params));
|
|
63
|
-
}
|
|
130
|
+
getShippingFulfillment = (input) => Effect.gen(this, function* () {
|
|
131
|
+
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
132
|
+
const fulfillmentId = yield* requireStringEffect(input.fulfillmentId, 'fulfillmentId');
|
|
133
|
+
const path = `${this.basePath}/order/${orderId}/shipping_fulfillment/${fulfillmentId}`;
|
|
134
|
+
return yield* requestGetEffect(this.client, path);
|
|
135
|
+
});
|
|
64
136
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
137
|
+
* Issues a full or partial refund for one order.
|
|
138
|
+
*
|
|
139
|
+
* @param input - Order identifier and generated refund request payload.
|
|
140
|
+
* @returns An Effect that succeeds with eBay's generated Refund response.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const refund = await Effect.runPromise(
|
|
145
|
+
* fulfillmentApi.issueRefund({
|
|
146
|
+
* orderId: '01-12345-67890',
|
|
147
|
+
* body: {
|
|
148
|
+
* reasonForRefund: 'BUYER_CANCEL',
|
|
149
|
+
* orderLevelRefundAmount: { value: '10.00', currency: 'USD' },
|
|
150
|
+
* },
|
|
151
|
+
* }),
|
|
152
|
+
* );
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @see https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/methods/issueRefund
|
|
67
156
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*/
|
|
75
|
-
async getPaymentDispute(paymentDisputeId) {
|
|
76
|
-
return await withApiError('Failed to get payment dispute', () => this.client.get(`${this.basePath}/payment_dispute/${paymentDisputeId}`));
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get shipping quote
|
|
80
|
-
*/
|
|
81
|
-
async getShippingQuote(request) {
|
|
82
|
-
return await withApiError('Failed to get shipping quote', () => this.client.post(`${this.basePath}/shipping_quote`, request));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Get cancellation details for an order
|
|
86
|
-
*/
|
|
87
|
-
async getCancellation(orderId, cancellationId) {
|
|
88
|
-
return await withApiError('Failed to get cancellation', () => this.client.get(`${this.basePath}/order/${orderId}/cancellation/${cancellationId}`));
|
|
89
|
-
}
|
|
157
|
+
issueRefund = (input) => Effect.gen(this, function* () {
|
|
158
|
+
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
159
|
+
const body = yield* requireObjectEffect(input.body, 'body');
|
|
160
|
+
const path = `${this.basePath}/order/${orderId}/issue_refund`;
|
|
161
|
+
return yield* requestPostEffect(this.client, path, body);
|
|
162
|
+
});
|
|
90
163
|
}
|