pangea-server 3.3.12 → 3.3.13

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.
@@ -21,9 +21,13 @@ type CreateVoucherOptions = {
21
21
  serviceTo?: number | null;
22
22
  paymentDueDate?: number | null;
23
23
  };
24
+ type CreateVoucherRes = {
25
+ cae: string;
26
+ caeExpirationDate: string;
27
+ };
24
28
  export declare class Arca {
25
29
  private __afip;
26
30
  constructor(config: ArcaConfig);
27
- createVoucher(createVoucherOptions: CreateVoucherOptions): Promise<any>;
31
+ createVoucher(createVoucherOptions: CreateVoucherOptions): Promise<CreateVoucherRes>;
28
32
  }
29
33
  export {};
@@ -52,8 +52,9 @@ class Arca {
52
52
  const finalVatAmount = isInvoiceC ? 0 : vatAmount;
53
53
  const finalTaxableAmount = isInvoiceC ? 0 : taxableAmount;
54
54
  const finalIvaArray = isInvoiceC || finalVatAmount === 0 ? [] : [{ Id: 5, BaseImp: finalTaxableAmount, Importe: finalVatAmount }];
55
- if (concept !== 'products' && (serviceFrom === null || serviceTo === null || paymentDueDate === null))
55
+ if (concept !== 'products' && (serviceFrom === null || serviceTo === null || paymentDueDate === null)) {
56
56
  throw new Error('Service dates are required');
57
+ }
57
58
  const lastVoucher = await this.__afip.ElectronicBilling.getLastVoucher(pointOfSale, afipVoucherType);
58
59
  let voucherDate = Number(new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().split('T')[0].replace(/-/g, ''));
59
60
  if (lastVoucher !== 0) {
@@ -87,7 +88,8 @@ class Arca {
87
88
  CondicionIVAReceptorId: vatConditionReceiverMap[vatConditionReceiver],
88
89
  Iva: finalIvaArray,
89
90
  };
90
- return this.__afip.ElectronicBilling.createVoucher(data);
91
+ const res = await this.__afip.ElectronicBilling.createVoucher(data);
92
+ return { cae: res.CAE, caeExpirationDate: res.CAEFchVto };
91
93
  }
92
94
  }
93
95
  exports.Arca = Arca;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.12",
4
+ "version": "3.3.13",
5
5
  "files": [
6
6
  "dist"
7
7
  ],