fix: Support array of payment status filters when listing orders (#1013)
This commit is contained in:
@@ -1234,15 +1234,18 @@ describe("/admin/orders", () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("lists all orders with a fulfillment status = fulfilled", async () => {
|
it("lists all orders with a fulfillment status = fulfilled and payment status = captured", async () => {
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
|
|
||||||
const response = await api
|
const response = await api
|
||||||
.get("/admin/orders?fulfillment_status[]=fulfilled", {
|
.get(
|
||||||
headers: {
|
"/admin/orders?fulfillment_status[]=fulfilled&payment_status[]=captured",
|
||||||
authorization: "Bearer test_token",
|
{
|
||||||
},
|
headers: {
|
||||||
})
|
authorization: "Bearer test_token",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
.catch((err) => console.log(err))
|
.catch((err) => console.log(err))
|
||||||
|
|
||||||
expect(response.status).toEqual(200)
|
expect(response.status).toEqual(200)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Type } from "class-transformer"
|
import { Type } from "class-transformer"
|
||||||
import {
|
import {
|
||||||
IsString,
|
|
||||||
IsOptional,
|
|
||||||
IsArray,
|
IsArray,
|
||||||
IsEnum,
|
IsEnum,
|
||||||
ValidateNested,
|
|
||||||
IsNotEmpty,
|
|
||||||
IsInt,
|
IsInt,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
ValidateNested,
|
||||||
} from "class-validator"
|
} from "class-validator"
|
||||||
import { DateComparisonOperator } from "./common"
|
import { DateComparisonOperator } from "./common"
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ export class AdminListOrdersSelector {
|
|||||||
fulfillment_status?: string[]
|
fulfillment_status?: string[]
|
||||||
|
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@IsEnum(PaymentStatus)
|
@IsEnum(PaymentStatus, { each: true })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
payment_status?: string[]
|
payment_status?: string[]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user