feat(dashboard, js-sdk, types): receive return e2e (#8305)

**What**
- receive return flow
- order summary section adjustments
- fix received item in summary
- activity event

---

CLOSES TRI-79 CC-256
This commit is contained in:
Frane Polić
2024-08-01 20:29:11 +02:00
committed by GitHub
parent 7ae1d80380
commit 2280d31396
21 changed files with 1536 additions and 167 deletions

View File

@@ -162,6 +162,23 @@ export class Return {
)
}
async updateRequest(
id: string,
body: HttpTypes.AdminUpdateReturnRequest,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async confirmRequest(
id: string,
body: HttpTypes.AdminConfirmReturnRequest,
@@ -179,14 +196,14 @@ export class Return {
)
}
async updateRequest(
async initiateReceive(
id: string,
body: HttpTypes.AdminUpdateReturnRequest,
body: HttpTypes.AdminInitiateReceiveReturn,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}`,
`/admin/returns/${id}/receive`,
{
method: "POST",
headers,
@@ -195,4 +212,138 @@ export class Return {
}
)
}
async receiveItems(
id: string,
body: HttpTypes.AdminReceiveItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/receive-items`,
{
method: "POST",
headers,
body,
query,
}
)
}
async updateReceiveItem(
id: string,
actionId: string,
body: HttpTypes.AdminUpdateReceiveItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/receive-items/${actionId}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async removeReceiveItem(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/receive-items/${actionId}`,
{
method: "DELETE",
headers,
query,
}
)
}
async dismissItems(
id: string,
body: HttpTypes.AdminDismissItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/dismiss-items`,
{
method: "POST",
headers,
body,
query,
}
)
}
async updateDismissItem(
id: string,
actionId: string,
body: HttpTypes.AdminUpdateDismissItems,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/dismiss-items/${actionId}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async removeDismissItem(
id: string,
actionId: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/dismiss-items/${actionId}`,
{
method: "DELETE",
headers,
query,
}
)
}
async confirmReceive(
id: string,
body: HttpTypes.AdminConfirmReceiveReturn,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/receive/confirm`,
{
method: "POST",
headers,
body,
query,
}
)
}
async cancelReceive(
id: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminReturnResponse>(
`/admin/returns/${id}/receive`,
{
method: "DELETE",
headers,
query,
}
)
}
}