feat: new tax api (#979)

* feat: add tax calculation strategy (#885)

* feat: add tax calculation strategy

* fix: adds strategy loader

* fix: eslint ignore

* chore: cleanup

* fix: allow plugin overwrites

* fix: allow plugin overwrites

* fix: fake region

* Update packages/medusa/src/loaders/strategies.ts

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* feat: adds tax related db entities + tax provider (#896)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: pr comments

* fix: unit test

* feat: totals service to ts (#911)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: adds TotalsServiceProps

* feat: adds integration tests for automatic tax calculation + shipping tax rates (#945)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: jsdoc types

* Feat/manual taxes (#950)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: object -> cartOrOrder

* fix: rounding

* Feat/complete order w tax lines (#951)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* fix: adds cart order type gaurds

* Docs/tax api (#954)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* docs: documents tax related methods and types

* fix: require either item_id or shipping_method_id

* feat: product type tax rate (#969)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* docs: documents tax related methods and types

* fix: require either item_id or shipping_method_id

* feat: adds returns tests for new tax system

* feat: adds return lines + integration tests for swaps

* feat: return integration tests

* feat: adds product type tax rates

* feat: add tax management endpoints

* fix: create single migration

* fix: adds tax rates to js client

* fix: strats

* Fix/plugin tests (#998)

* plugin testing setup

* fix: test sendgrid plugin

* fix: test sendgrid plugin

* chore: clean

* chore: clean

* fix: clean up tests

* fix: remove dirty import

* fix: sendgrid + brightpearl

* fix: plugin integration tests

* fix: klarna

* fix: shipping method tax

* fix: remove taxrates

* fix: unit tests

* fix: integration

* fix: integration

* fix: plugins tests

* fix: ignore plugins

* fix: tests

* fix: taxes (#1017)

* fix: taxes

* fix: taxes

* fix: faulty ref

* fix: create tax-lines with claim items

* fix: snapshot tax-liens

* fix: allows integration test teardown to force deleting tables

* fix: tests

* fix: merge

* fix: adds tax-rates to client

* fix: adds tax-rates to medusa-react

* fix: tests

* fix: tests

* fix: add product types

* fix: adds tax provider endpoint + cascaded deletes on tax rate relations

* fix: move errors to service layer

* fix: cleanup api

* fix: unit tests

* fix: error handler in base-service

* fix: Add order region to swap on createFulfillment (#1110)

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Sebastian RindomandOliver Windall Juhl authored and GitHub committed 2022-02-24 20:14:09 +01:00
1 parent 694e2df20f
commit c56660fca9
223 files changed
+28546 -2229

No files matched your search

@@ -8,12 +8,14 @@ import AdminGiftCardsResource from "./gift-cards"
import AdminInvitesResource from "./invites"
import AdminNotesResource from "./notes"
import AdminProductsResource from "./products"
import AdminProductTypesResource from "./product-types"
import AdminUsersResource from "./users"
import AdminReturnsResource from "./returns"
import AdminOrdersResource from "./orders"
import AdminReturnReasonsResource from "./return-reasons"
import AdminVariantsResource from "./variants"
import AdminSwapsResource from "./swaps"
import AdminTaxRatesResource from "./tax-rates"
import AdminShippingProfilesResource from "./shipping-profiles"
import AdminStoresResource from "./store"
import AdminShippingOptionsResource from "./shipping-options"
@@ -33,6 +35,7 @@ class Admin extends BaseResource {
public notes = new AdminNotesResource(this.client)
public products = new AdminProductsResource(this.client)
public productTags = new AdminProductTagsResource(this.client)
public productTypes = new AdminProductTypesResource(this.client)
public users = new AdminUsersResource(this.client)
public returns = new AdminReturnsResource(this.client)
public orders = new AdminOrdersResource(this.client)
@@ -44,6 +47,7 @@ class Admin extends BaseResource {
public shippingOptions = new AdminShippingOptionsResource(this.client)
public regions = new AdminRegionsResource(this.client)
public notifications = new AdminNotificationsResource(this.client)
public taxRates = new AdminTaxRatesResource(this.client)
public uploads = new AdminUploadsResource(this.client)
}
@@ -22,7 +22,10 @@ import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
class AdminOrdersResource extends BaseResource {
create(payload: AdminPostOrdersReq, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
create(
payload: AdminPostOrdersReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders`
return this.client.request("POST", path, payload, {}, customHeaders)
}
@@ -30,17 +33,24 @@ class AdminOrdersResource extends BaseResource {
update(
id: string,
payload: AdminPostOrdersOrderReq,
customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}`
return this.client.request("POST", path, payload, {}, customHeaders)
}
retrieve(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
retrieve(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}`
return this.client.request("GET", path, {}, {}, customHeaders)
}
list(query?: AdminGetOrdersParams, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersListRes> {
list(
query?: AdminGetOrdersParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersListRes> {
let path = `/admin/orders`
if (query) {
@@ -51,12 +61,18 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("GET", path, {}, {}, customHeaders)
}
complete(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
complete(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/complete`
return this.client.request("POST", path, {}, {}, customHeaders)
}
capturePayment(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
capturePayment(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/capture`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -64,7 +80,8 @@ class AdminOrdersResource extends BaseResource {
refundPayment(
id: string,
payload: AdminPostOrdersOrderRefundsReq,
customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/refund`
return this.client.request("POST", path, payload, {}, customHeaders)
}
@@ -72,7 +89,8 @@ class AdminOrdersResource extends BaseResource {
createFulfillment(
id: string,
payload: AdminPostOrdersOrderFulfillmentsReq,
customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/fulfillment`
return this.client.request("POST", path, payload, {}, customHeaders)
}
@@ -124,7 +142,10 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
cancel(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
cancel(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/cancel`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -138,7 +159,10 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
archive(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
archive(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/archive`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -152,7 +176,11 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
cancelSwap(id: string, swapId: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
cancelSwap(
id: string,
swapId: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/swaps/${swapId}/cancel`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -195,7 +223,11 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
cancelClaim(id: string, claimId: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
cancelClaim(
id: string,
claimId: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/claims/${claimId}/cancel`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -230,7 +262,11 @@ class AdminOrdersResource extends BaseResource {
return this.client.request("POST", path, payload, {}, customHeaders)
}
deleteMetadata(id: string, key: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminOrdersRes> {
deleteMetadata(
id: string,
key: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersRes> {
const path = `/admin/orders/${id}/metadata/${key}`
return this.client.request("DELETE", path, {}, {}, customHeaders)
}
@@ -0,0 +1,24 @@
import {
AdminGetProductTypesParams,
AdminProductTypesListRes,
} from "@medusajs/medusa"
import qs from "qs"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
class AdminProductTypesResource extends BaseResource {
list(
query?: AdminGetProductTypesParams
): ResponsePromise<AdminProductTypesListRes> {
let path = `/admin/product-types`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/product-types?${queryString}`
}
return this.client.request("GET", path)
}
}
export default AdminProductTypesResource
@@ -20,12 +20,18 @@ import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
class AdminProductsResource extends BaseResource {
create(payload: AdminPostProductsReq, customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsRes> {
create(
payload: AdminPostProductsReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsRes> {
const path = `/admin/products/`
return this.client.request("POST", path, payload, {}, customHeaders)
}
retrieve(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsRes> {
retrieve(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsRes> {
const path = `/admin/products/${id}`
return this.client.request("GET", path, {}, {}, customHeaders)
}
@@ -33,17 +39,24 @@ class AdminProductsResource extends BaseResource {
update(
id: string,
payload: AdminPostProductsProductReq,
customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsRes> {
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsRes> {
const path = `/admin/products/${id}`
return this.client.request("POST", path, payload, {}, customHeaders)
}
delete(id: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsDeleteRes> {
delete(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsDeleteRes> {
const path = `/admin/products/${id}`
return this.client.request("DELETE", path, {}, {}, customHeaders)
}
list(query?: AdminGetProductsParams, customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsListRes> {
list(
query?: AdminGetProductsParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsListRes> {
let path = `/admin/products`
if (query) {
@@ -54,12 +67,16 @@ class AdminProductsResource extends BaseResource {
return this.client.request("GET", path, {}, {}, customHeaders)
}
listTypes(customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsListTypesRes> {
listTypes(
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsListTypesRes> {
const path = `/admin/products/types`
return this.client.request("GET", path, {}, {}, customHeaders)
}
listTags(customHeaders: Record<string, any> = {}): ResponsePromise<AdminProductsListTagsRes> {
listTags(
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminProductsListTagsRes> {
const path = `/admin/products/tag-usage`
return this.client.request("GET", path, {}, {}, customHeaders)
}
@@ -1,5 +1,6 @@
import {
AdminPaymentProvidersList,
AdminTaxProvidersList,
AdminPostStoreReq,
AdminStoresRes,
} from "@medusajs/medusa"
@@ -13,7 +14,10 @@ class AdminStoresResource extends BaseResource {
* @param customHeaders
* @returns the updated store.
*/
update(payload: AdminPostStoreReq, customHeaders: Record<string, any> = {}): ResponsePromise<AdminStoresRes> {
update(
payload: AdminPostStoreReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminStoresRes> {
const path = `/admin/store/`
return this.client.request("POST", path, payload, {}, customHeaders)
}
@@ -24,7 +28,10 @@ class AdminStoresResource extends BaseResource {
* @param customHeaders
* @returns updated store.
*/
addCurrency(currency_code: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminStoresRes> {
addCurrency(
currency_code: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminStoresRes> {
const path = `/admin/store/${currency_code}`
return this.client.request("POST", path, {}, {}, customHeaders)
}
@@ -35,7 +42,10 @@ class AdminStoresResource extends BaseResource {
* @param customHeaders
* @returns updated store
*/
deleteCurrency(currency_code: string, customHeaders: Record<string, any> = {}): ResponsePromise<AdminStoresRes> {
deleteCurrency(
currency_code: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminStoresRes> {
const path = `/admin/store/currencies/${currency_code}`
return this.client.request("DELETE", path, {}, {}, customHeaders)
}
@@ -44,7 +54,9 @@ class AdminStoresResource extends BaseResource {
* @description gets a medusa store
* @returns a medusa store
*/
retrieve(customHeaders: Record<string, any> = {}): ResponsePromise<AdminStoresRes> {
retrieve(
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminStoresRes> {
const path = `/admin/store/`
return this.client.request("GET", path, {}, {}, customHeaders)
}
@@ -53,10 +65,23 @@ class AdminStoresResource extends BaseResource {
* @description Lists the store's payment providers
* @returns a list of payment providers configured on the store
*/
listPaymentProviders(customHeaders: Record<string, any> = {}): ResponsePromise<AdminPaymentProvidersList> {
listPaymentProviders(
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminPaymentProvidersList> {
const path = `/admin/store/payment-providers`
return this.client.request("GET", path, {}, {}, customHeaders)
}
/**
* @description Lists the store's payment providers
* @returns a list of payment providers configured on the store
*/
listTaxProviders(
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxProvidersList> {
const path = `/admin/store/tax-providers`
return this.client.request("GET", path, {}, {}, customHeaders)
}
}
export default AdminStoresResource
@@ -0,0 +1,189 @@
import {
AdminTaxRatesRes,
AdminTaxRatesListRes,
AdminTaxRatesDeleteRes,
AdminGetTaxRatesParams,
AdminGetTaxRatesTaxRateParams,
AdminDeleteTaxRatesTaxRateProductsReq,
AdminDeleteTaxRatesTaxRateProductsParams,
AdminDeleteTaxRatesTaxRateProductTypesReq,
AdminDeleteTaxRatesTaxRateProductTypesParams,
AdminDeleteTaxRatesTaxRateShippingOptionsReq,
AdminDeleteTaxRatesTaxRateShippingOptionsParams,
AdminPostTaxRatesReq,
AdminPostTaxRatesTaxRateReq,
AdminPostTaxRatesTaxRateProductsReq,
AdminPostTaxRatesTaxRateProductTypesReq,
AdminPostTaxRatesTaxRateShippingOptionsReq,
} from "@medusajs/medusa"
import qs from "qs"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
class AdminTaxRatesResource extends BaseResource {
retrieve(
id: string,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}?${queryString}`
}
return this.client.request("GET", path, {}, {}, customHeaders)
}
list(
query?: AdminGetTaxRatesParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesListRes> {
let path = `/admin/tax-rates`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates?${queryString}`
}
return this.client.request("GET", path, {}, {}, customHeaders)
}
create(
payload: AdminPostTaxRatesReq,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates?${queryString}`
}
return this.client.request("POST", path, payload, {}, customHeaders)
}
update(
id: string,
payload: AdminPostTaxRatesTaxRateReq,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}?${queryString}`
}
return this.client.request("POST", path, payload, {}, customHeaders)
}
addProducts(
id: string,
payload: AdminPostTaxRatesTaxRateProductsReq,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/products/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/products/batch?${queryString}`
}
return this.client.request("POST", path, payload, {}, customHeaders)
}
addProductTypes(
id: string,
payload: AdminPostTaxRatesTaxRateProductTypesReq,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/product-types/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/product-types/batch?${queryString}`
}
return this.client.request("POST", path, payload, {}, customHeaders)
}
addShippingOptions(
id: string,
payload: AdminPostTaxRatesTaxRateShippingOptionsReq,
query?: AdminGetTaxRatesTaxRateParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/shipping-options/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/shipping-options/batch?${queryString}`
}
return this.client.request("POST", path, payload, {}, customHeaders)
}
removeProducts(
id: string,
payload: AdminDeleteTaxRatesTaxRateProductsReq,
query?: AdminDeleteTaxRatesTaxRateProductsParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/products/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/products/batch?${queryString}`
}
return this.client.request("DELETE", path, payload, {}, customHeaders)
}
removeProductTypes(
id: string,
payload: AdminDeleteTaxRatesTaxRateProductTypesReq,
query?: AdminDeleteTaxRatesTaxRateProductTypesParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/product-types/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/product-types/batch?${queryString}`
}
return this.client.request("DELETE", path, payload, {}, customHeaders)
}
removeShippingOptions(
id: string,
payload: AdminDeleteTaxRatesTaxRateShippingOptionsReq,
query?: AdminDeleteTaxRatesTaxRateShippingOptionsParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesRes> {
let path = `/admin/tax-rates/${id}/shipping-options/batch`
if (query) {
const queryString = qs.stringify(query)
path = `/admin/tax-rates/${id}/shipping-options/batch?${queryString}`
}
return this.client.request("DELETE", path, payload, {}, customHeaders)
}
delete(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminTaxRatesDeleteRes> {
const path = `/admin/tax-rates/${id}`
return this.client.request("DELETE", path, {}, {}, customHeaders)
}
}
export default AdminTaxRatesResource