hotfix(webshipper): only show order channel methods

This commit is contained in:
Sebastian Rindom
2020-10-05 10:23:00 +02:00
parent e2cbdeafc6
commit 1e2179f2e1
2 changed files with 13 additions and 3 deletions

View File

@@ -23,7 +23,9 @@ class WebshipperFulfillmentService extends FulfillmentService {
}
async getFulfillmentOptions() {
const rates = await this.client_.shippingRates.list()
const rates = await this.client_.shippingRates.list({
order_channel_id: this.options_.order_channel_id,
})
return rates.data.map((r) => ({
id: r.attributes.name,

View File

@@ -46,8 +46,16 @@ class Webshipper {
url: path,
}).then(({ data }) => data)
},
list: async () => {
const path = `/v2/shipping_rates`
list: async (params = {}) => {
let path = `/v2/shipping_rates`
if (Object.entries(params).length) {
const search = Object.entries(params).map(([key, value]) => {
return `filter[${key}]=${value}`
})
path += `?${search.join("&")}`
}
return this.client_({
method: "GET",
url: path,