From fd508961a2224a0e4b61de8ec12735cee508928d Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Tue, 23 Aug 2022 14:56:57 +0700 Subject: [PATCH] feat: add marketplace support BREAKING CHANGE: Add Belgium --- src/amazon-marketplace.ts | 1 + src/marketplaces/be.ts | 25 ++++++++++++++++++++ src/marketplaces/index.ts | 6 +++++ test/__snapshots__/marketplaces.test.ts.snap | 23 ++++++++++++++++++ test/index.test.ts | 2 +- test/marketplaces.test.ts | 2 +- 6 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 src/marketplaces/be.ts diff --git a/src/amazon-marketplace.ts b/src/amazon-marketplace.ts index b03f226d..ab15ee36 100644 --- a/src/amazon-marketplace.ts +++ b/src/amazon-marketplace.ts @@ -7,6 +7,7 @@ import { AmazonSellingPartnerApiRegion } from './amazon-selling-partner-api-regi export enum AmazonMarketplaceCountryCode { AE = 'AE', AU = 'AU', + BE = 'BE', BR = 'BR', CA = 'CA', CN = 'CN', diff --git a/src/marketplaces/be.ts b/src/marketplaces/be.ts new file mode 100644 index 00000000..201447f6 --- /dev/null +++ b/src/marketplaces/be.ts @@ -0,0 +1,25 @@ +import { + AmazonMarketplace, + AmazonMarketplaceAdvertisingCurrency, + AmazonMarketplaceCountryCode, +} from '../amazon-marketplace' +import { sellingPartnerRegions } from '../selling-partner-api-regions' + +export const BE = new AmazonMarketplace({ + countryCode: AmazonMarketplaceCountryCode.BE, + currency: AmazonMarketplaceAdvertisingCurrency.EUR, + id: 'AMEN7PMS3EDWL', + name: 'Belgium', + /** + * This marketplace will lunch in the coming months. + * + * @see: https://www.aboutamazon.eu/news/job-creation-and-investment/amazon-announces-plans-to-launch-amazon-com-be-in-the-coming-months + */ + uri: 'https://www.amazon.com.be', + sellerCentralUri: 'https://sellercentral.amazon.com.be', + vendorCentralUri: 'https://vendorcentral.amazon.com.be', + webServiceUri: 'https://mws-eu.amazonservices.com', + sellingPartner: { + region: sellingPartnerRegions.EU, + }, +}) diff --git a/src/marketplaces/index.ts b/src/marketplaces/index.ts index a9e6ae08..1e999ca5 100644 --- a/src/marketplaces/index.ts +++ b/src/marketplaces/index.ts @@ -1,5 +1,6 @@ import { AE } from './ae' import { AU } from './au' +import { BE } from './be' import { BR } from './br' import { CA } from './ca' import { CN } from './cn' @@ -31,6 +32,11 @@ export const amazonMarketplaces = { */ AU, + /** + * Belgium + */ + BE, + /** * Brazil */ diff --git a/test/__snapshots__/marketplaces.test.ts.snap b/test/__snapshots__/marketplaces.test.ts.snap index e13e60ed..4da9dac6 100644 --- a/test/__snapshots__/marketplaces.test.ts.snap +++ b/test/__snapshots__/marketplaces.test.ts.snap @@ -88,6 +88,29 @@ AmazonMarketplace { } `; +exports[`marketplace BE should match snapshot 1`] = ` +AmazonMarketplace { + "countryCode": "BE", + "currency": "EUR", + "id": "AMEN7PMS3EDWL", + "name": "Belgium", + "sellerCentralUri": "https://sellercentral.amazon.com.be", + "sellingPartner": Object { + "region": AmazonSellingPartnerApiRegion { + "awsRegion": "eu-west-1", + "code": "EU", + "endpoint": "https://sellingpartnerapi-eu.amazon.com", + "name": "Europe", + }, + "sellerCentralAuthUri": "https://sellercentral.amazon.com.be/apps/authorize/consent", + "vendorCentralAuthUri": "https://vendorcentral.amazon.com.be/apps/authorize/consent", + }, + "uri": "https://www.amazon.com.be", + "vendorCentralUri": "https://vendorcentral.amazon.com.be", + "webServiceUri": "https://mws-eu.amazonservices.com", +} +`; + exports[`marketplace BR should match snapshot 1`] = ` AmazonMarketplace { "advertising": Object { diff --git a/test/index.test.ts b/test/index.test.ts index e84464f5..ad5f8397 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -26,6 +26,6 @@ describe('index', () => { expect.assertions(2) expect(Array.isArray(amazonMarketplacesList)).toBeDefined() - expect(amazonMarketplacesList).toHaveLength(21) + expect(amazonMarketplacesList).toHaveLength(22) }) }) diff --git a/test/marketplaces.test.ts b/test/marketplaces.test.ts index 7d3e0f56..a5b62aea 100644 --- a/test/marketplaces.test.ts +++ b/test/marketplaces.test.ts @@ -12,7 +12,7 @@ describe('marketplace', () => { it('has a known number of marketplaces', () => { expect.assertions(1) - expect(countryCodes).toHaveLength(21) + expect(countryCodes).toHaveLength(22) }) describe.each(countryCodes)('%s', (countryCode) => {