Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add South Africa marketplace #629

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/amazon-marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum AmazonMarketplaceCountryCode {
SG = 'SG',
TR = 'TR',
US = 'US',
ZA = 'ZA',
}

/**
Expand All @@ -50,6 +51,7 @@ export enum AmazonMarketplaceAdvertisingCurrency {
SGD = 'SGD',
TRY = 'TRY',
USD = 'USD',
ZAR = 'ZAR',
}

/**
Expand Down Expand Up @@ -105,6 +107,7 @@ export enum AmazonMarketplaceAdvertisingTimeZone {

export enum AmazonMarketplaceTimeZone {
AFRICA_CAIRO = 'Africa/Cairo',
AFRICA_JOHANNESBURG = 'Africa/Johannesburg',
AMERICA_LOS_ANGELES = 'America/Los_Angeles',
AMERICA_SAO_PAULO = 'America/Sao_Paulo',
ASIA_DUBAI = 'Asia/Dubai',
Expand Down
6 changes: 6 additions & 0 deletions src/marketplaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { SE } from './se'
import { SG } from './sg'
import { TR } from './tr'
import { US } from './us'
import { ZA } from './za'

export const amazonMarketplaces = {
/**
Expand Down Expand Up @@ -131,6 +132,11 @@ export const amazonMarketplaces = {
* United States
*/
US,

/**
* South Africa
*/
ZA,
} as const

/**
Expand Down
23 changes: 23 additions & 0 deletions src/marketplaces/za.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
AmazonMarketplace,
AmazonMarketplaceAdvertisingCurrency,
AmazonMarketplaceCountryCode,
AmazonMarketplaceTimeZone,
} from '../amazon-marketplace'
import { sellingPartnerRegions } from '../selling-partner-api-regions'

export const ZA = new AmazonMarketplace({
countryCode: AmazonMarketplaceCountryCode.ZA,
timeZone: AmazonMarketplaceTimeZone.AFRICA_JOHANNESBURG,
currency: AmazonMarketplaceAdvertisingCurrency.ZAR,
id: 'AE08WJ6YKNBMC',
name: 'South Africa',
uri: 'https://www.amazon.co.za',
sellerCentralUri: 'https://sellercentral.amazon.co.za',
vendorCentralUri: 'https://vendorcentral.amazon.co.za',
webServiceUri: 'https://mws-eu.amazonservices.com',
launchDate: '2024-05-07',
sellingPartner: {
region: sellingPartnerRegions.EU,
},
})
25 changes: 25 additions & 0 deletions test/__snapshots__/marketplaces.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -974,3 +974,28 @@ AmazonMarketplace {
"webServiceUri": "https://mws.amazonservices.com",
}
`;

exports[`marketplace ZA should match snapshot 1`] = `
AmazonMarketplace {
"countryCode": "ZA",
"currency": "ZAR",
"id": "AE08WJ6YKNBMC",
"launchDate": "2024-05-07",
"name": "South Africa",
"sellerCentralUri": "https://sellercentral.amazon.co.za",
"sellingPartner": {
"region": AmazonSellingPartnerApiRegion {
"awsRegion": "eu-west-1",
"code": "EU",
"endpoint": "https://sellingpartnerapi-eu.amazon.com",
"name": "Europe",
},
"sellerCentralAuthUri": "https://sellercentral.amazon.co.za/apps/authorize/consent",
"vendorCentralAuthUri": "https://vendorcentral.amazon.co.za/apps/authorize/consent",
},
"timeZone": "Africa/Johannesburg",
"uri": "https://www.amazon.co.za",
"vendorCentralUri": "https://vendorcentral.amazon.co.za",
"webServiceUri": "https://mws-eu.amazonservices.com",
}
`;
2 changes: 1 addition & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ describe('index', () => {
expect.assertions(2)

expect(Array.isArray(amazonMarketplacesList)).toBeDefined()
expect(amazonMarketplacesList).toHaveLength(22)
expect(amazonMarketplacesList).toHaveLength(23)
})
})
2 changes: 1 addition & 1 deletion test/marketplaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('marketplace', () => {
it('has a known number of marketplaces', () => {
expect.assertions(1)

expect(countryCodes).toHaveLength(22)
expect(countryCodes).toHaveLength(23)
})

describe.each(countryCodes)('%s', (countryCode) => {
Expand Down
Loading