@posx/core 5.5.35 → 5.5.36
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 +74 -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.
|
|
@@ -3281,6 +3314,46 @@ declare module '@posx/core/types/payment.type' {
|
|
|
3281
3314
|
source_payment: IPayment;
|
|
3282
3315
|
target_payment_method: IPaymentMethod;
|
|
3283
3316
|
};
|
|
3317
|
+
/**
|
|
3318
|
+
* Payment sync status enum
|
|
3319
|
+
*/
|
|
3320
|
+
export enum PaymentStatus {
|
|
3321
|
+
STARTED = "payment_started",
|
|
3322
|
+
PROCESSING = "payment_processing",
|
|
3323
|
+
COMPLETED = "payment_completed",
|
|
3324
|
+
FAILED = "payment_failed"
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* Payment sync data interface
|
|
3328
|
+
*/
|
|
3329
|
+
export interface IPaymentSyncData {
|
|
3330
|
+
/** Payment unique identifier */
|
|
3331
|
+
payment_uid: string;
|
|
3332
|
+
/** Associated invoice ID */
|
|
3333
|
+
invoice_uid: string;
|
|
3334
|
+
/** Table ID */
|
|
3335
|
+
table_uid?: string;
|
|
3336
|
+
/** Payment status */
|
|
3337
|
+
status: PaymentStatus;
|
|
3338
|
+
/** Payment method */
|
|
3339
|
+
payment_method: IPaymentMethod;
|
|
3340
|
+
/** Payment amount */
|
|
3341
|
+
amount: number;
|
|
3342
|
+
/** Actual tender amount */
|
|
3343
|
+
tender_amount?: number;
|
|
3344
|
+
/** Change amount */
|
|
3345
|
+
change_amount?: number;
|
|
3346
|
+
/** Payment result */
|
|
3347
|
+
result?: 'success' | 'failed';
|
|
3348
|
+
/** Error message */
|
|
3349
|
+
error_message?: string;
|
|
3350
|
+
/** Timestamp */
|
|
3351
|
+
timestamp: Date;
|
|
3352
|
+
/** Employee UID */
|
|
3353
|
+
employee_uid?: string;
|
|
3354
|
+
/** Terminal ID */
|
|
3355
|
+
terminal_id?: string;
|
|
3356
|
+
}
|
|
3284
3357
|
|
|
3285
3358
|
}
|
|
3286
3359
|
declare module '@posx/core/types/printer.type' {
|