Add WooCommerce integration: sync orders to invoices/people with webhook, cron, and settings UI.

This commit is contained in:
2026-09-26 17:59:16 +03:30
parent 1b160c8cd3
commit 26085b54a9
15 changed files with 1571 additions and 2 deletions
+61 -1
View File
@@ -121,7 +121,8 @@ export type OrgModuleKey =
| "saved_views"
| "public_api"
| "sms_campaigns"
| "teams";
| "teams"
| "woocommerce";
export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"customers",
@@ -153,6 +154,7 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"public_api",
"sms_campaigns",
"teams",
"woocommerce",
];
export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
@@ -185,6 +187,7 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
public_api: "API و وب‌هوک",
sms_campaigns: "پیامک گروهی",
teams: "تیم‌ها و دیدپذیری",
woocommerce: "ووکامرس",
};
export const ORG_MODULE_GROUPS: Array<{
@@ -224,6 +227,7 @@ export const ORG_MODULE_GROUPS: Array<{
"loyalty",
"reports",
"saved_views",
"woocommerce",
],
},
{
@@ -3143,3 +3147,59 @@ export interface UpdateTeamRequest {
export interface SetTeamMembersRequest {
members: Array<{ userId: string; role: TeamMemberRole }>;
}
/* ——— ووکامرس ——— */
export interface WooCommerceConnectionDto {
id: string;
label: string;
storeUrl: string;
consumerKeyMasked: string;
webhookSecretSet: boolean;
enabled: boolean;
lastSyncAt: string | null;
lastHealthAt: string | null;
lastHealthOk: boolean | null;
lastError: string | null;
importedOrders: number;
createdAt: string;
updatedAt: string;
}
export interface CreateWooCommerceConnectionRequest {
label: string;
storeUrl: string;
consumerKey: string;
consumerSecret: string;
webhookSecret?: string;
enabled?: boolean;
}
export interface UpdateWooCommerceConnectionRequest {
label?: string;
storeUrl?: string;
consumerKey?: string;
consumerSecret?: string;
webhookSecret?: string | null;
enabled?: boolean;
}
export interface WooCommerceSyncResultDto {
fetched: number;
created: number;
updated: number;
skipped: number;
errors: string[];
}
export interface WooCommerceOrderLinkDto {
id: string;
wooOrderId: string;
wooOrderNumber: string | null;
invoiceId: string;
invoiceNumber: string;
status: string;
total: number;
currency: string;
syncedAt: string;
}