miinventario-v2/apps/backend/src/modules/integrations/pos/interfaces/pos-adapter.interface.ts
rckrdmrd c24f889f70
Some checks failed
Build / Build Backend (push) Has been cancelled
Build / Build Mobile (TypeScript Check) (push) Has been cancelled
Lint / Lint Backend (push) Has been cancelled
Lint / Lint Mobile (push) Has been cancelled
Test / Backend E2E Tests (push) Has been cancelled
Test / Mobile Unit Tests (push) Has been cancelled
Build / Build Docker Image (push) Has been cancelled
[MIINVENTARIO] feat: Add exports, reports, integrations modules and CI/CD pipeline
- Add exports module with PDF/CSV/Excel generation
- Add reports module for inventory analytics
- Add POS integrations module
- Add database migrations for exports, movements and integrations
- Add GitHub Actions CI/CD workflow with Docker support
- Add mobile export and reports screens with tests
- Update epic documentation with traceability
- Add deployment and security guides

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 06:06:34 -06:00

88 lines
1.6 KiB
TypeScript

import { PosProvider } from '../../entities/pos-integration.entity';
export interface PosProduct {
externalId: string;
name: string;
sku?: string;
barcode?: string;
category?: string;
quantity: number;
price?: number;
cost?: number;
imageUrl?: string;
}
export interface PosSaleItem {
externalProductId: string;
quantity: number;
unitPrice: number;
totalPrice: number;
}
export interface PosSale {
externalId: string;
items: PosSaleItem[];
totalAmount: number;
timestamp: Date;
}
export interface PosInventoryUpdate {
externalProductId: string;
newQuantity: number;
reason?: string;
}
export interface PosAdapterConfig {
provider: PosProvider;
credentials: Record<string, unknown>;
storeId: string;
}
export interface IPosAdapter {
readonly provider: PosProvider;
/**
* Initialize the adapter with credentials
*/
initialize(config: PosAdapterConfig): Promise<void>;
/**
* Validate the credentials are correct
*/
validateCredentials(): Promise<boolean>;
/**
* Fetch all products from POS
*/
getProducts(): Promise<PosProduct[]>;
/**
* Fetch a single product by external ID
*/
getProduct(externalId: string): Promise<PosProduct | null>;
/**
* Update inventory quantity in POS
*/
updateInventory(updates: PosInventoryUpdate[]): Promise<void>;
/**
* Fetch recent sales
*/
getSales(since: Date): Promise<PosSale[]>;
/**
* Generate webhook secret for this integration
*/
generateWebhookSecret(): string;
/**
* Verify webhook signature
*/
verifyWebhookSignature(
payload: string,
signature: string,
secret: string,
): boolean;
}