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

Commit

Permalink
feat: init merchant fulfillment
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 30, 2020
1 parent bf7754f commit 6cc6dc5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export enum Resource {
Sellers = 'Sellers',
Subscriptions = 'Subscriptions',
Feeds = 'Feeds',
MerchantFulfillment = 'MerchantFulfillment',
}

export interface ResourceActions {
Expand Down Expand Up @@ -151,6 +152,13 @@ export interface ResourceActions {
| 'GetFeedSubmissionCount'
| 'CancelFeedSubmissions'
| 'GetFeedSubmissionResult'
[Resource.MerchantFulfillment]:
| 'GetEligibleShippingServices'
| 'GetAdditionalSellerInputs'
| 'CreateShipment'
| 'GetShipment'
| 'CancelShipment'
| 'GetServiceStatus'
}

export interface Request {
Expand Down
11 changes: 11 additions & 0 deletions src/mws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HttpClient } from './http'
import { Feeds } from './sections/feeds'
import { Finances } from './sections/finances/finances'
import { FulfillmentInventory } from './sections/fulfillment-inventory'
import { MerchantFulfillment } from './sections/merchant-fulfillment'
import { Orders } from './sections/orders'
import { Products } from './sections/products/products'
import { Reports } from './sections/reports'
Expand All @@ -15,6 +16,8 @@ export class MWS {

private _fulfillmentInventory!: FulfillmentInventory

private _merchantFulfillment!: MerchantFulfillment

private _orders!: Orders

private _products!: Products
Expand Down Expand Up @@ -67,6 +70,14 @@ export class MWS {
return this._fulfillmentInventory
}

get merchantFulfillment() {
if (!this._merchantFulfillment) {
this._merchantFulfillment = new MerchantFulfillment(this.httpClient)
}

return this._merchantFulfillment
}

get products() {
if (!this._products) {
this._products = new Products(this.httpClient)
Expand Down
16 changes: 16 additions & 0 deletions src/sections/merchant-fulfillment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { HttpClient, Resource } from '../http'
import { getServiceStatusByResource } from './shared'

const MERCHANT_FULFILLMENT_API_VERSION = '2011-07-01'

export class MerchantFulfillment {
constructor(private httpClient: HttpClient) {}

async getServiceStatus() {
return getServiceStatusByResource(
this.httpClient,
Resource.MerchantFulfillment,
MERCHANT_FULFILLMENT_API_VERSION,
)
}
}

0 comments on commit 6cc6dc5

Please sign in to comment.