Skip to content

Commit

Permalink
feat: add marketplace support (#523)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Adds Belgium
  • Loading branch information
nguyentoanit committed Aug 23, 2022
1 parent ffef5dc commit 345ce7b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/amazon-marketplace.ts
Expand Up @@ -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',
Expand Down
25 changes: 25 additions & 0 deletions 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,
},
})
6 changes: 6 additions & 0 deletions 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'
Expand Down Expand Up @@ -31,6 +32,11 @@ export const amazonMarketplaces = {
*/
AU,

/**
* Belgium
*/
BE,

/**
* Brazil
*/
Expand Down
23 changes: 23 additions & 0 deletions test/__snapshots__/marketplaces.test.ts.snap
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.ts
Expand Up @@ -26,6 +26,6 @@ describe('index', () => {
expect.assertions(2)

expect(Array.isArray(amazonMarketplacesList)).toBeDefined()
expect(amazonMarketplacesList).toHaveLength(21)
expect(amazonMarketplacesList).toHaveLength(22)
})
})
2 changes: 1 addition & 1 deletion test/marketplaces.test.ts
Expand Up @@ -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) => {
Expand Down

0 comments on commit 345ce7b

Please sign in to comment.