{"record":{"id":"c473897255d6814b","repo":"nopSolutions/nopCommerce","slug":"enter-ready-for-pickup-date","errorCode":null,"errorMessage":"Enter ready for pickup date","messagePattern":"Enter ready for pickup date","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs","lineNumber":2284,"sourceCode":"\n    [HttpPost, ActionName(\"ShipmentDetails\")]\n    [FormValueRequired(\"savereadyforpickupdate\")]\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> EditReadyForPickupDate(ShipmentModel model)\n    {\n        //try to get a shipment with the specified id\n        var shipment = await _shipmentService.GetShipmentByIdAsync(model.Id);\n        if (shipment == null)\n            return RedirectToAction(\"List\");\n\n        //a vendor should have access only to his products\n        if (await _workContext.GetCurrentVendorAsync() != null && !await HasAccessToShipmentAsync(shipment))\n            return RedirectToAction(\"List\");\n\n        try\n        {\n            if (!model.ReadyForPickupDateUtc.HasValue)\n                throw new Exception(\"Enter ready for pickup date\");\n\n            shipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;\n            await _shipmentService.UpdateShipmentAsync(shipment);\n            return RedirectToAction(\"ShipmentDetails\", new { id = shipment.Id });\n        }\n        catch (Exception exc)\n        {\n            await _notificationService.ErrorNotificationAsync(exc);\n            return RedirectToAction(\"ShipmentDetails\", new { id = shipment.Id });\n        }\n    }\n\n    [HttpPost, ActionName(\"ShipmentDetails\")]\n    [FormValueRequired(\"setasdelivered\")]\n    [CheckPermission(StandardPermission.Orders.SHIPMENTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> SetAsDelivered(int id)\n    {\n        //try to get a shipment with the specified id","sourceCodeStart":2266,"sourceCodeEnd":2302,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/OrderController.cs#L2266-L2302","documentation":"Thrown in the OrderController shipment 'ready for pickup' action when model.ReadyForPickupDateUtc is null. Mirrors the shipped/delivery date handlers: the action requires an explicit pickup-ready timestamp before persisting. Base Exception, caught, shown via ErrorNotificationAsync, redirect back to shipment details.","triggerScenarios":"POST to set a shipment 'ready for pickup' with ReadyForPickupDateUtc absent or null in the request.","commonSituations":"The ready-for-pickup date field left blank; form customization dropped the field; an integration call omitting the date; a date-picker locale/format issue yielding empty on post.","solutions":["Provide a ready-for-pickup date before submitting.","Confirm ReadyForPickupDateUtc is present and parseable in the POST body.","Add client-side required validation on the pickup date input.","Optionally default to DateTime.UtcNow when the field is empty instead of throwing."],"exampleFix":"// before\nif (!model.ReadyForPickupDateUtc.HasValue)\n    throw new Exception(\"Enter ready for pickup date\");\nshipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;\n\n// after — default to now when omitted\nshipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc ?? DateTime.UtcNow;\nawait _shipmentService.UpdateShipmentAsync(shipment);","handlingStrategy":"validation","validationCode":"// Before marking ready-for-pickup: ensure a date, defaulting to now\nif (!model.ReadyForPickupDateUtc.HasValue)\n    model.ReadyForPickupDateUtc = DateTime.UtcNow;\nshipment.ReadyForPickupDateUtc = model.ReadyForPickupDateUtc;","typeGuard":"bool HasPickupDate(ShipmentModel m) => m.ReadyForPickupDateUtc.HasValue;","tryCatchPattern":"// The action's try/catch shows the exception via ErrorNotificationAsync; require the date client-side.","preventionTips":["Make the ready-for-pickup date picker required.","Default to DateTime.UtcNow when the field is intentionally left empty.","Verify the posted date format matches the server culture."],"tags":["nopcommerce","admin","order","shipment","validation","date","pickup"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}