Skip to content

Latest commit

 

History

History
601 lines (556 loc) · 10.8 KB

events.md

File metadata and controls

601 lines (556 loc) · 10.8 KB

Event

export interface Operation {
  create: "CREATE";
  update: "UPDATE";
  delete: "DELETE";
  void: "VOID";
}

export interface Scope {
  schemaId: number;
  firmId?: number | null;
  firmSIRET?: number | null;
  accountingFolderId?: number | null;
  accountingFolderSIRET?: number | null;
  accountingFolderRef?: string | null;
  persPhysiqueId?: number | null;
}
Scope JSON Schema
{
  "$id": "Scope",
  "description": "Object related to the scope of an event",
  "type": "object",
  "properties": {
    "schemaId": {
      "type": "number"
    },
    "firmId": {
      "type": "number",
      "nullable": true
    },
    "firmSIRET": {
        "type": "number",
        "nullable": true
      },
    "accountingFolderId": {
      "type": "number",
      "nullable": true
    },
    "accountingFolderSIRET": {
      "type": "number",
      "nullable": true
    },
    "accountingFolderRef": {
      "type": "string",
      "nullable": true
    },
    "persPhysiqueId": {
      "type": "number",
      "nullable": true
    }
  },
  "required": ["schemaId"],
  "additionalProperties": false
}

Connector

Event notifying the modification of a partner integration.

export interface Connector {
  name: "connector";
  scope: Scope;
  operation: "CREATE" | "UPDATE" | "DELETE";
  data: {
    id: string;
    code: string;
    userId?: string | null;
  };
}
JSON Schema
{
  "description": "Connector event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "connector"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "UPDATE", "DELETE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "userId": {
          "type": "string",
          "nullable": true
        }
      },
      "required": ["id", "code"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}

AccountingFolder

Event notifying the creation of a new Accounting Folder (a company).

export interface AccountingFolder {
  name: "accountingFolder";
  scope: Scope & Required<Pick<Scope, "firmId">>;
  operation: "CREATE" | "UPDATE";
  data: {
    id: string;
  };
}
JSON Schema
{
  "description": "AccountingFolder event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "accountingFolder"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "UPDATE", "DELETE"]
    },
    "scope": {
      "type": "object",
      "properties": {
        "schemaId": {
          "type": "number"
        },
        "firmId": {
          "type": "number"
        },
        "firmSIRET": {
            "type": "number",
            "nullable": true
          },
        "accountingFolderId": {
          "type": "number",
          "nullable": true
        },
        "accountingFolderSIRET": {
          "type": "number",
          "nullable": true
        },
        "accountingFolderRef": {
          "type": "string",
          "nullable": true
        },
        "persPhysiqueId": {
          "type": "number",
          "nullable": true
        }
      },
      "required": ["schemaId", "firmId"],
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "required": ["id"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}

Document

Event notifying the creation/addition of a document.

export enum DocumentKind {
  DossierAnnuel = "AF",
  DossierPermanent = "PF",
  BaseDocumentaire = "DB",
  ExternalDocument = "ED"
}

export interface Document {
  name: "document";
  scope: Scope;
  operation: "CREATE" | "DELETE";
  data: {
    id: string;
    kind: DocumentKind;
    name: string;
  };
}
JSON Schema
{
  "description": "Document event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "document"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "DELETE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "enum": ["AF", "PF", "DB", "ED"]
        },
        "name": {
          "type": "string"
        }
      },
      "required": ["id", "kind", "name"]
    }
  },
  "required": ["name", "operation", "scope", "data"]
}

Portfolio

Event notifying the creation or deletion of an Accounting Portfolio (or Accounting Wallet). Wallet allow to define access to a set of accounting folders.

export interface Portfolio {
  name: "portfolio";
  scope: Scope;
  operation: "CREATE" | "DELETE";
  data: {
    id: string;
  }
}
JSON Schema
{
  "description": "Portfolio event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "portfolio"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "DELETE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "required": ["id"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}

AccountingLineEntry

export interface AccountingLineEntry {
  name: "accountingLineEntry";
  scope: Scope;
  operation: "CREATE;
  data: {
    id: string;
  }
}
JSON Schema
{
  "description": "accountingLineEntry event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "accountingLineEntry"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "required": ["id"]
    }
  },
  "required": ["name", "operation", "scope", "data"]
}

AdminMessage

export interface AdminMessage {
  name: "adminMessage";
  scope: Scope;
  operation: "VOID;
  data: {
    event: "admin_message";
    socketMessage: {
      id: number;
      title: string;
      message: string;
    };
    receivers: string[];
  }
}
JSON Schema
{
  "description": "adminMessage event",
  "type": "object",
  "properties": {
    "event": {
      "type": "string",
      "value": "admin_message"
    },
    "socketMessage": {
      "type": "object",
      "properties": {
        "id": {
          "type": "number"
        },
        "title": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": ["id", "title", "message"]
    },
    "receivers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": ["event", "socketMessage", "receivers"]
}

ThirdParty

export interface ThirdParty {
  name: "thirdParty";
  scope: Scope;
  operation: "CREATE" | "UPDATE" | "DELETE";
  data: {
    code: string;
  }
}
JSON Schema
{
  "description": "Third-party event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "thirdParty"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "UPDATE", "DELETE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        }
      },
      "required": ["code"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}

AccountingEntryLettering

export interface AccountingEntryLettering {
  name: "accountingEntryLettering";
  scope: Scope;
  operation: "CREATE";
  data: {
    id: string;
    piece2: string;
    paymentType: string;
    piece1?: string;
  }
}
JSON Schema
{
  "description": "accountingEntryLettering event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "accountingEntryLettering"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "DELETE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[0-9]+"
        },
        "piece2": {
          "type": "string"
        },
        "paymentType": {
          "type": "string"
        },
        "piece1": {
          "type": "string"
        }
      },
      "required": ["id", "piece2", "paymentType"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}

CloudDocument

export interface CloudDocument {
  name: "cloudDocument";
  scope: Scope;
  operation: "CREATE" | "UPDATE";
  data: {
    id: string;
    status: "rejected" | "completed";
    reason?: string;
  }
}
JSON Schema
{
  "description": "CloudDocument event",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "value": "cloudDocument"
    },
    "operation": {
      "type": "string",
      "description": "Operation operated next to the event",
      "enum": ["CREATE", "UPDATE"]
    },
    "scope": {
      "$ref": "Scope"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "status": {
          "enum": ["reject", "completed"]
        },
        "reason": {
          "type": "string",
          "nullable": true
        }
      },
      "required": ["id", "status"],
      "additionalProperties": false
    }
  },
  "required": ["name", "operation", "scope", "data"],
  "additionalProperties": false
}