pangea-server 3.3.131 → 3.3.133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,11 +100,15 @@ class Arca {
100
100
  };
101
101
  }
102
102
  async createInvoiceC(options) {
103
- const { pointOfSale, receiver, concept, items, amount, service, pdf } = options;
103
+ const { pointOfSale, receiver, concept, items, amount, service } = options;
104
104
  const voucherType = '11_invoice_c';
105
105
  const isConceptProducts = concept === '1_products';
106
106
  if (!isConceptProducts && !service)
107
107
  throw new Error('Service dates are required');
108
+ const isFinalConsumer = receiver.documentType === '99_final_consumer';
109
+ const receiverDocumentNumber = isFinalConsumer ? 0 : receiver.documentNumber || 0;
110
+ const receiverVatCondition = receiver.vatCondition || '5_final_consumer';
111
+ const receiverName = receiver.name || 'CONSUMIDOR FINAL';
108
112
  const lastVoucherNumber = await this.getLastVoucher(pointOfSale, voucherType);
109
113
  const voucherNumber = lastVoucherNumber + 1;
110
114
  const timezone = -3;
@@ -118,8 +122,8 @@ class Arca {
118
122
  CbteHasta: voucherNumber,
119
123
  CbteFch: voucherDate,
120
124
  DocTipo: documentTypeIds[receiver.documentType],
121
- DocNro: receiver.documentType === '99_final_consumer' ? 0 : receiver.documentNumber || 0,
122
- CondicionIVAReceptorId: vatConditionReceiverIds[receiver.vatCondition || '5_final_consumer'],
125
+ DocNro: receiverDocumentNumber,
126
+ CondicionIVAReceptorId: vatConditionReceiverIds[receiverVatCondition],
123
127
  Concepto: conceptIds[concept],
124
128
  ImpTotal: amount,
125
129
  ImpTotConc: 0,
@@ -147,11 +151,11 @@ class Arca {
147
151
  .toISOString()
148
152
  .replace(/[-:T.]/g, '')
149
153
  .slice(0, 14);
150
- const clientName = receiver.name?.replace(/\s+/g, '_').toLowerCase() || 'consumidor_final';
154
+ const clientName = receiverName.replace(/\s+/g, '_').toLowerCase();
151
155
  const fileName = `${timestamp}_${clientName}.pdf`;
152
156
  const pdfData = {
153
157
  file_name: fileName,
154
- send_to: pdf?.sendTo,
158
+ send_to: receiver.email,
155
159
  template: {
156
160
  name: 'invoice-c',
157
161
  params: {
@@ -166,11 +170,11 @@ class Arca {
166
170
  issuer_iva_condition: this.__issuer.ivaCondition,
167
171
  issuer_gross_income: this.__issuer.grossIncome,
168
172
  issuer_activity_start_date: this.__issuer.activityStartDate,
169
- receiver_name: receiver.name || 'CONSUMIDOR FINAL',
173
+ receiver_name: receiverName,
170
174
  receiver_address: receiver.address || '-',
171
175
  receiver_document_type: documentTypeIds[receiver.documentType],
172
- receiver_document_number: receiver.documentType === '99_final_consumer' ? 0 : receiver.documentNumber || 0,
173
- receiver_iva_condition: vatConditionReceiverDescriptions[receiver.vatCondition || '5_final_consumer'],
176
+ receiver_document_number: receiverDocumentNumber,
177
+ receiver_iva_condition: vatConditionReceiverDescriptions[receiverVatCondition],
174
178
  sale_condition: 'Contado',
175
179
  currency_id: 'ARS',
176
180
  currency_rate: 1,
@@ -179,8 +183,8 @@ class Arca {
179
183
  code: item.code,
180
184
  description: item.description,
181
185
  quantity: item.quantity,
182
- unit_price: item.unitPrice,
183
- subtotal: item.quantity * item.unitPrice,
186
+ unit_price: item.price,
187
+ subtotal: item.quantity * item.price,
184
188
  })),
185
189
  vat_amount: 0,
186
190
  tributes_amount: 0,
@@ -191,7 +195,6 @@ class Arca {
191
195
  net_amount_taxed: amount,
192
196
  net_amount_untaxed: 0,
193
197
  exempt_amount: 0,
194
- invoice_footer_note: pdf?.footerNote,
195
198
  },
196
199
  },
197
200
  };
@@ -53,13 +53,14 @@ export type ArcaCreateInvoiceCOptions = {
53
53
  vatCondition?: ArcaVatConditionReceiver;
54
54
  name?: string;
55
55
  address?: string;
56
+ email?: string;
56
57
  };
57
58
  concept: ArcaConcept;
58
59
  items: {
59
60
  code: string;
60
61
  description: string;
61
62
  quantity: number;
62
- unitPrice: number;
63
+ price: number;
63
64
  }[];
64
65
  amount: number;
65
66
  service?: {
@@ -67,10 +68,6 @@ export type ArcaCreateInvoiceCOptions = {
67
68
  to: string;
68
69
  paymentDueDate: string;
69
70
  };
70
- pdf?: {
71
- sendTo?: string;
72
- footerNote?: string;
73
- };
74
71
  };
75
72
  export type ArcaCreateVoucherRes = {
76
73
  voucherNumber: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.131",
4
+ "version": "3.3.133",
5
5
  "files": [
6
6
  "dist"
7
7
  ],