Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
feat: require whole marketplace object
Browse files Browse the repository at this point in the history
  • Loading branch information
gigobyte committed May 3, 2020
1 parent 617e6f5 commit 3eb28f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/http.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { AmazonMarketplaceCountryCode, amazonMarketplaces } from '@scaleleap/amazon-marketplaces'
import { AmazonMarketplace } from '@scaleleap/amazon-marketplaces'
import axios from 'axios'
import { URLSearchParams } from 'url'

import { sign } from './sign'

export interface MWSOptions {
endpoint: AmazonMarketplaceCountryCode
marketplace: AmazonMarketplace
awsAccessKeyId: string
mwsAuthToken: string
sellerId: string
secret: string
httpClient?: HttpClient
}

type HttpMethod = 'GET' | 'POST'
Expand Down Expand Up @@ -49,7 +48,7 @@ export class HttpClient {
) {}

request(method: HttpMethod, info: ResourceInfo) {
const marketplaceUri = amazonMarketplaces[this.options.endpoint].webServiceUri
const marketplaceUri = this.options.marketplace.webServiceUri

const host = marketplaceUri.replace('https://', '')
const url = `${marketplaceUri}/${info.resource}/${info.version}/`
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { MWS } from './mws'
export { Sellers } from './sections/sellers'
export { HttpClient } from './http'
export { AmazonMarketplaceCountryCode } from '@scaleleap/amazon-marketplaces'
export * from '@scaleleap/amazon-marketplaces'
4 changes: 2 additions & 2 deletions test/integration/sellers-list-market-participation.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { amazonMarketplaces } from '@scaleleap/amazon-marketplaces'

import { AmazonMarketplaceCountryCode, HttpClient, Sellers } from '../../src'
import { HttpClient, Sellers } from '../../src'
import { Config } from './config'
import { itci } from './it'

const config = new Config()

const httpClient = new HttpClient({
endpoint: AmazonMarketplaceCountryCode.CA,
marketplace: amazonMarketplaces.CA,
awsAccessKeyId: config.AWS_ACCESS_KEY_ID,
mwsAuthToken: config.MWS_AUTH_TOKEN,
secret: config.SECRET,
Expand Down

0 comments on commit 3eb28f2

Please sign in to comment.