async function prepareLegacyAppointment(order,current) { // SQL rechecks ownership. Request parameters cannot supply the pricing rules. try { return (await Psql.one('SELECT xs_prepare_legacy_appointment($1,$2,$3,$4::jsonb) AS result', [DEFAULT_COMPANY_ID,order.objectId,current.id,JSON.stringify(legacyAppointmentSeedRules())])).result; } catch(error) { return {blockedReason:String(error.message||error).replace(/^.*ERROR:\s*/,'')}; } }