This commit is contained in:
seb
2026-09-26 07:34:37 +02:00
parent 607e6cc0ac
commit e491ecfa47
24 changed files with 2162 additions and 1716 deletions

View File

@@ -52,11 +52,12 @@ export default function update(provider) {
const hasNumber = Object.prototype.hasOwnProperty.call(patch, 'number');
const hasDate = Object.prototype.hasOwnProperty.call(patch, 'date');
const hasCreatedAt = Object.prototype.hasOwnProperty.call(patch, 'createdAt');
const hasEntityId = Object.prototype.hasOwnProperty.call(patch, 'entityId');
const hasExternalNumber = Object.prototype.hasOwnProperty.call(patch, 'externalNumber');
const hasLines = Object.prototype.hasOwnProperty.call(patch, 'lines');
if (!hasNumber && !hasDate && !hasEntityId && !hasExternalNumber && !hasLines) {
if (!hasNumber && !hasDate && !hasCreatedAt && !hasEntityId && !hasExternalNumber && !hasLines) {
throw new Error('Invalid quote');
}
@@ -97,6 +98,14 @@ export default function update(provider) {
}
}
let createdAt = summary.createdAt ? parseDate(summary.createdAt) : null;
if (hasCreatedAt) {
createdAt = parseDate(patch.createdAt);
if (!createdAt) {
throw new Error('Invalid quote');
}
}
let entityId = summary.entityId;
if (hasEntityId) {
entityId = await assertCustomerEntity(
@@ -121,6 +130,7 @@ export default function update(provider) {
entityId,
externalNumber,
date,
createdAt,
});
if (hasLines) {