merge main (edge function fix)
This commit is contained in:
commit
a505ce6ca7
|
|
@ -88,7 +88,7 @@ export const getClientInvitationStateFromOrderGroupStatus = (
|
||||||
deliveryStatus: string | null | undefined,
|
deliveryStatus: string | null | undefined,
|
||||||
invitationState: string | null | undefined,
|
invitationState: string | null | undefined,
|
||||||
): DeliveryInvitationPublicState => {
|
): DeliveryInvitationPublicState => {
|
||||||
if (deliveryStatus === "agreed") {
|
if (deliveryStatus === "agreed" || deliveryStatus === "driver_assigned") {
|
||||||
return "agreed";
|
return "agreed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,6 +96,10 @@ export const getClientInvitationStateFromOrderGroupStatus = (
|
||||||
return "delivered";
|
return "delivered";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deliveryStatus === "paid_storage") {
|
||||||
|
return "paid_storage";
|
||||||
|
}
|
||||||
|
|
||||||
if (["awaiting_choice", "opened", "reminder_sent"].includes(String(invitationState || ""))) {
|
if (["awaiting_choice", "opened", "reminder_sent"].includes(String(invitationState || ""))) {
|
||||||
return invitationState as DeliveryInvitationPublicState;
|
return invitationState as DeliveryInvitationPublicState;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@ import {
|
||||||
|
|
||||||
const MAX_BODY_BYTES = 8 * 1024;
|
const MAX_BODY_BYTES = 8 * 1024;
|
||||||
|
|
||||||
|
// Order groups a client may still self-book (choose delivery date+time) on.
|
||||||
|
// manual_confirmation_required (ручная обработка) stays bookable until the
|
||||||
|
// order leaves these states (date assigned / paid storage / finished).
|
||||||
|
const CLIENT_BOOKABLE_STATUSES = new Set([
|
||||||
|
"pending_confirmation",
|
||||||
|
"manual_confirmation_required",
|
||||||
|
]);
|
||||||
|
|
||||||
type ConfirmBody = {
|
type ConfirmBody = {
|
||||||
token?: string;
|
token?: string;
|
||||||
deliveryDate?: string;
|
deliveryDate?: string;
|
||||||
|
|
@ -191,7 +199,9 @@ Deno.serve(async (request) => {
|
||||||
? "agreed"
|
? "agreed"
|
||||||
: "requires_address";
|
: "requires_address";
|
||||||
|
|
||||||
if (!isActiveInvitationState(invitation.state) || currentGroup.delivery_status !== "pending_confirmation") {
|
const bookingBlocked = !CLIENT_BOOKABLE_STATUSES.has(currentGroup.delivery_status || "");
|
||||||
|
|
||||||
|
if (!isActiveInvitationState(invitation.state) || bookingBlocked) {
|
||||||
return jsonResponse(
|
return jsonResponse(
|
||||||
{
|
{
|
||||||
ok: false,
|
ok: false,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue