ztechno_core 0.0.129 → 0.0.130

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.
@@ -99,12 +99,6 @@ export declare class InvoiceService {
99
99
  template: Partial<Omit<ZInvoiceItemTemplate, 'id' | 'created_at' | 'updated_at'>>,
100
100
  ): Promise<ZInvoiceItemTemplate>;
101
101
  deleteItemTemplate(id: number): Promise<void>;
102
- createInvoiceWithPayment(input: CreateInvoiceInput): Promise<{
103
- invoice: ZInvoice;
104
- checkoutUrl: string;
105
- payment: import('@mollie/api-client/dist/types/data/payments/Payment').default;
106
- payUrl: string;
107
- }>;
108
102
  createInvoiceFromItems(
109
103
  input: CreateInvoiceInput,
110
104
  overrides?: CreateInvoiceOverrides,
@@ -502,6 +502,7 @@ class InvoiceService {
502
502
  async deleteItemTemplate(id) {
503
503
  await this.templateOrm.delete(id);
504
504
  }
505
+ /** @internal */
505
506
  async createInvoiceWithPayment(input) {
506
507
  const draft = await this.createInvoiceDraft(input);
507
508
  const payment = await this.createMolliePaymentForInvoice(draft.invoice);
@@ -524,7 +525,7 @@ class InvoiceService {
524
525
  const { items, amount_due } = this.calcTotals(input.items);
525
526
  const useIdMode = this.invoiceNumberMode === 'id';
526
527
  const invoice_number = useIdMode ? `PENDING-${crypto_1.default.randomUUID()}` : await this.generateInvoiceNumber();
527
- const status = overrides?.status ?? 'pending';
528
+ const status = overrides?.status ?? 'draft';
528
529
  const issuedAt = (0, orm_1.formatDatetime)(new Date());
529
530
  const paidAt = overrides?.paid_at ?? (status === 'paid' ? issuedAt : null);
530
531
  const amount_paid = overrides?.amount_paid ?? (status === 'paid' ? amount_due : 0);
@@ -18,6 +18,7 @@ export type ZCustomer = {
18
18
  updated_at?: string | Date;
19
19
  };
20
20
  export type ZInvoiceItemType = 'service' | 'subsidy';
21
+ export type ZInvoiceStatus = 'draft' | 'pending' | 'paid' | 'failed' | 'canceled' | 'expired' | 'refunded' | 'archived';
21
22
  export type ZInvoiceItem = {
22
23
  id?: number;
23
24
  invoice_id: number;
@@ -53,7 +54,6 @@ export type CreateInvoiceOverrides = {
53
54
  mollie_payment_id?: string | null;
54
55
  checkout_url?: string | null;
55
56
  };
56
- export type ZInvoiceStatus = 'draft' | 'pending' | 'paid' | 'failed' | 'canceled' | 'expired' | 'refunded' | 'archived';
57
57
  export type ZInvoice = {
58
58
  id?: number;
59
59
  invoice_number: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztechno_core",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "description": "Core files for ztechno framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",