@posx/core 5.5.35 → 5.5.37
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.
- package/build/index.d.ts +77 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/package.publish.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -428,7 +428,7 @@ declare module '@posx/core/services/app.service' {
|
|
|
428
428
|
import { AppRemoteService, IAppRemoteService, IAppModelSequence } from '@posx/core/services/abstract.service';
|
|
429
429
|
import { IAppConfig, IConfig, UpdateGeneralConfigOptions, ICache } from '@posx/core/types/config.type';
|
|
430
430
|
import { IPrintJob, IPrintTemplate, IPrinter, IRenderPrintTemplateOptions, RenderPrintTemplateOptions } from '@posx/core/types/printer.type';
|
|
431
|
-
import { IPayment, IPaymentMethod } from '@posx/core/types/payment.type';
|
|
431
|
+
import { IPayment, IPaymentMethod, IPaymentSyncData } from '@posx/core/types/payment.type';
|
|
432
432
|
import { INote, INoteGroup } from '@posx/core/types/note.type';
|
|
433
433
|
import { ISection, ISectionItem } from '@posx/core/types/section.type';
|
|
434
434
|
import { Category, ICategory, ICoreItem, IItem, ISubcategory } from '@posx/core/types/product.type';
|
|
@@ -828,16 +828,49 @@ declare module '@posx/core/services/app.service' {
|
|
|
828
828
|
* @returns A promise that resolves to the updated invoice.
|
|
829
829
|
*/
|
|
830
830
|
removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
|
|
831
|
+
/**
|
|
832
|
+
* Sync payment status callback function type
|
|
833
|
+
*/
|
|
834
|
+
onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
|
|
835
|
+
/**
|
|
836
|
+
* Sync payment status to external systems
|
|
837
|
+
* @param data - Payment sync data
|
|
838
|
+
*/
|
|
839
|
+
syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
|
|
831
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* Payment Service implementation
|
|
843
|
+
*
|
|
844
|
+
* Usage example for CDS payment status sync:
|
|
845
|
+
* ```typescript
|
|
846
|
+
* // Setup payment sync callback
|
|
847
|
+
* paymentService.onPaymentSync = async (data: IPaymentSyncData) => {
|
|
848
|
+
* // Send to CDS or other external systems
|
|
849
|
+
* console.log('Payment status:', data.status, 'for payment:', data.payment_uid);
|
|
850
|
+
* };
|
|
851
|
+
*
|
|
852
|
+
* // Manual payment status sync (for external payment flows)
|
|
853
|
+
* await paymentService.syncPaymentStatus({
|
|
854
|
+
* payment_uid: 'payment_123',
|
|
855
|
+
* invoice_uid: 'invoice_456',
|
|
856
|
+
* status: PaymentStatus.STARTED,
|
|
857
|
+
* payment_method: paymentMethod,
|
|
858
|
+
* amount: 100.00,
|
|
859
|
+
* timestamp: new Date()
|
|
860
|
+
* });
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
832
863
|
export class PaymentService extends AppRemoteService<IPayment> implements IPaymentService {
|
|
833
864
|
readonly http: AxiosInstance;
|
|
834
865
|
readonly db: Dexie;
|
|
835
866
|
readonly options: IServiceOptions;
|
|
836
867
|
readonly moduleName: string;
|
|
837
868
|
readonly methodName: string;
|
|
869
|
+
onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
|
|
838
870
|
constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
|
|
839
871
|
addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
|
|
840
872
|
removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
|
|
873
|
+
syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
|
|
841
874
|
}
|
|
842
875
|
/**
|
|
843
876
|
* Represents the interface for the AppMiscService.
|
|
@@ -1123,6 +1156,9 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1123
1156
|
export interface ILineOperationService extends IInvoiceBaseService {
|
|
1124
1157
|
/**
|
|
1125
1158
|
* Adds an item to an invoice line. If the item already exists in the invoice, the quantity is increased, otherwise a new line is created.
|
|
1159
|
+
* Adding items with positive quantities
|
|
1160
|
+
* Reducing quantities of existing items with negative values
|
|
1161
|
+
* Automatic removal of lines when quantity reaches 0 or below
|
|
1126
1162
|
* @param invoice - The invoice to add the item to.
|
|
1127
1163
|
* @param customer - The customer associated with the invoice.
|
|
1128
1164
|
* @param appConfig - The app configuration.
|
|
@@ -3281,6 +3317,46 @@ declare module '@posx/core/types/payment.type' {
|
|
|
3281
3317
|
source_payment: IPayment;
|
|
3282
3318
|
target_payment_method: IPaymentMethod;
|
|
3283
3319
|
};
|
|
3320
|
+
/**
|
|
3321
|
+
* Payment sync status enum
|
|
3322
|
+
*/
|
|
3323
|
+
export enum PaymentStatus {
|
|
3324
|
+
STARTED = "payment_started",
|
|
3325
|
+
PROCESSING = "payment_processing",
|
|
3326
|
+
COMPLETED = "payment_completed",
|
|
3327
|
+
FAILED = "payment_failed"
|
|
3328
|
+
}
|
|
3329
|
+
/**
|
|
3330
|
+
* Payment sync data interface
|
|
3331
|
+
*/
|
|
3332
|
+
export interface IPaymentSyncData {
|
|
3333
|
+
/** Payment unique identifier */
|
|
3334
|
+
payment_uid: string;
|
|
3335
|
+
/** Associated invoice ID */
|
|
3336
|
+
invoice_uid: string;
|
|
3337
|
+
/** Table ID */
|
|
3338
|
+
table_uid?: string;
|
|
3339
|
+
/** Payment status */
|
|
3340
|
+
status: PaymentStatus;
|
|
3341
|
+
/** Payment method */
|
|
3342
|
+
payment_method: IPaymentMethod;
|
|
3343
|
+
/** Payment amount */
|
|
3344
|
+
amount: number;
|
|
3345
|
+
/** Actual tender amount */
|
|
3346
|
+
tender_amount?: number;
|
|
3347
|
+
/** Change amount */
|
|
3348
|
+
change_amount?: number;
|
|
3349
|
+
/** Payment result */
|
|
3350
|
+
result?: 'success' | 'failed';
|
|
3351
|
+
/** Error message */
|
|
3352
|
+
error_message?: string;
|
|
3353
|
+
/** Timestamp */
|
|
3354
|
+
timestamp: Date;
|
|
3355
|
+
/** Employee UID */
|
|
3356
|
+
employee_uid?: string;
|
|
3357
|
+
/** Terminal ID */
|
|
3358
|
+
terminal_id?: string;
|
|
3359
|
+
}
|
|
3284
3360
|
|
|
3285
3361
|
}
|
|
3286
3362
|
declare module '@posx/core/types/printer.type' {
|