added draft-cart no_notification element to allow passing this to orders as admin

This commit is contained in:
--list
2021-06-15 17:29:42 +02:00
parent 6a0da1a423
commit 24a8b242b2
9 changed files with 31 additions and 4 deletions
@@ -59,6 +59,9 @@ import { defaultFields, defaultRelations } from "."
* customer_id:
* description: The id of the customer to add on the draft order
* type: string
* no_notification_order:
* description: An optional flag passed to the resulting order to determine use of notifications.
* type: boolean
* shipping_methods:
* description: The shipping methods for the draft order
* type: array
@@ -119,6 +122,7 @@ export default async (req, res) => {
})
.optional(),
customer_id: Validator.string().optional(),
no_notification_order: Validator.boolean().optional(),
shipping_methods: Validator.array()
.items({
option_id: Validator.string().required(),
@@ -35,6 +35,9 @@ import { defaultCartFields, defaultCartRelations, defaultFields } from "."
* code:
* description: "The code that a Discount is identifed by."
* type: string
* no_notification_order:
* description: "An optional flag passed to the resulting order to determine use of notifications.""
* type: boolean
* customer_id:
* description: "The id of the Customer to associate the Draft Order with."
* type: string
@@ -68,6 +71,7 @@ export default async (req, res) => {
})
.optional(),
customer_id: Validator.string().optional(),
no_notification_order: Validator.boolean().optional(),
})
const { value, error } = schema.validate(req.body)
@@ -88,6 +92,8 @@ export default async (req, res) => {
)
}
await draftOrderService.update(draftOrder.id, value)
await cartService.update(draftOrder.cart_id, value)
draftOrder.cart = await cartService.retrieve(draftOrder.cart_id, {