feat(invoice): enhance invoice update validation and payload construction
This commit is contained in:
@@ -138,10 +138,11 @@ function buildInvoicePayload(formData: FormDataSet): CreateInvoiceData | UpdateI
|
||||
othersFormData?.is_mixed || othersFormData?.contingency_mode ||
|
||||
othersFormData?.cove || othersFormData?.operation_num ||
|
||||
othersFormData?.adendas || othersFormData?.certified_number ||
|
||||
othersFormData?.code_signature || othersFormData?.electronic_signature;
|
||||
othersFormData?.code_signature || othersFormData?.electronic_signature ||
|
||||
continuationFormData?.puerto_entrada;
|
||||
|
||||
if (hasComplianceValue) {
|
||||
payload.compliance_mx = buildComplianceMxData(InvoiceTopFieldsFormData, generalFormData, othersFormData, observationFormData);
|
||||
payload.compliance_mx = buildComplianceMxData(InvoiceTopFieldsFormData, generalFormData, othersFormData, observationFormData, continuationFormData);
|
||||
}
|
||||
|
||||
// Financials
|
||||
@@ -169,7 +170,7 @@ function buildInvoicePayload(formData: FormDataSet): CreateInvoiceData | UpdateI
|
||||
return payload;
|
||||
}
|
||||
|
||||
function buildComplianceMxData(InvoiceTopFieldsFormData: any, generalFormData: any, othersFormData: any, observationFormData: any) {
|
||||
function buildComplianceMxData(InvoiceTopFieldsFormData: any, generalFormData: any, othersFormData: any, observationFormData: any, continuationFormData: any) {
|
||||
return {
|
||||
// Pedimento fields - desde InvoiceTopFieldsFormData
|
||||
pedimento_id: InvoiceTopFieldsFormData?.pedimento_id ? Number(InvoiceTopFieldsFormData.pedimento_id) : null,
|
||||
@@ -177,6 +178,7 @@ function buildComplianceMxData(InvoiceTopFieldsFormData: any, generalFormData: a
|
||||
is_pedimento_pending: Boolean(InvoiceTopFieldsFormData?.is_pedimento_pending || false),
|
||||
// Fields from generalFormData
|
||||
aduana: generalFormData?.aduana || null,
|
||||
port_of_entry: continuationFormData?.puerto_entrada || null,
|
||||
provider_header: generalFormData?.provider_header || '',
|
||||
provider_id: generalFormData?.provider_id || null,
|
||||
sold_to_header: generalFormData?.sold_to_header || '',
|
||||
|
||||
Reference in New Issue
Block a user