Skip to content

Écriture et Mouvements

Introduction

Sur MyUnisoft les mouvements sont groupés dans une abstraction que nous appelons "Écriture comptable".

NOTE

Un mouvement est aussi communément appelé une "ligne d'écriture".

json
{
  "producerId": "13524346",
  "attachments": {
    "document.pdf": {
      "type": "URL",
      "value": "https://app.myunisoft.fr/api/ged/ged/document/1-xTt2Qx4LPABeb1Z/download"
    }
  },
  "date": "2023-02-01",
  "dueDate": null,
  "journal": {
    "producerId": "137145",
    "customerReferenceCode": "AC",
    "name": "ACHATS",
    "type": "Achat"
  },
  "currency": {
    "code": "EUR"
  },
  "movements": [
    {
      "producerId": "43221797",
      "description": "TEST",
      "value": {
        "credit": 1200,
        "debit": 0,
        "amount": 1200
      },
      "dueDate": null,
      "lettering": {
        "state": "none",
        "value": null
      },
      "freeNumber": null,
      "invoiceNumber": null,
      "attachments": {},
      "account": {
        "producerId": "1482937",
        "number": "6010000000",
        "name": "ACHATS MATIERES PREM"
      },
      "payment": null,
      "analytics": [
        {
          "producerId": "703",
          "code": "AXE1",
          "name": "LIBELLE AXE1",
          "sections": [
            {
              "producerId": "1694",
              "amount": 1200,
              "rate": 100,
              "code": "ATTENTE",
              "name": "Waiting section"
            }
          ]
        }
      ]
    },
    {
      "producerId": "43221798",
      "description": "TEST",
      "value": {
        "credit": 0,
        "debit": 1200,
        "amount": -1200
      },
      "dueDate": null,
      "lettering": {
        "state": "none",
        "value": null
      },
      "freeNumber": null,
      "invoiceNumber": null,
      "attachments": {},
      "account": {
        "producerId": "2567407",
        "number": "4551200000",
        "name": "COMPTE COURANT RACLE"
      },
      "payment": null,
      "analytics": []
    }
  ],
  "additionalProducerProperties": {
      "createdAt": 1709852400,
      "accountedAt": "2023-01-20",
      "source": {
          "name": "API",
          "thirdParty": {
              "name": "Evoliz",
              "code": "EVOL"
          }
      },
      "partnerMetadata": null,
      "comment": null
  }
}

(retour en haut de page)

Interfaces

Liste des interfaces communes:


Ci-dessous les définitions avec TypeScript et JSON Schema.

Lettrage

Le lettrage permet de rapprocher une facture avec son paiement, il peut être partiel quand le paiement est fait en plusieurs fois. Une fois que la facture est payée en intégralité le lettrage sera complet.

TypeScript
ts
type Lettering = {
  state: "complete";
  value: string;
} | {
  state: "partial";
  value: `*${string}`;
} | {
  state: "none";
  value: null;
};
JSON Schema
json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "additionalProperties": false,
  "required": [],
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "state": {
          "const": "complete"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "state",
        "value"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "state": {
          "const": "partial"
        },
        "value": {
          "type": "string",
          "pattern": "^\\*.*$"
        }
      },
      "required": [
        "state",
        "value"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "state": {
          "const": "none"
        },
        "value": {
          "type": "null"
        }
      },
      "required": [
        "state",
        "value"
      ],
      "additionalProperties": false
    }
  ]
}

(retour en haut de page)

Imputation analytique

TypeScript
ts
export interface MovementAnalytics {
  producerId: string;
  code: string;
  name: string;
  sections: {
    producerId: string;
    amount: number;
    rate: number;
    code: string;
    name: string;
  }[];
}

(retour en haut de page)

Mouvement (ou ligne d'écriture)

TypeScript
ts
interface Movement {
  producerId: string;
  description: string;
  attachments: Record<string, Attachment>;
  value: {
    credit: number;
    debit: number;
    amount: number;
  }
  dueDate: string | null;
  lettering: Lettering;
  freeNumber: string | null;
  invoiceNumber: string | null;
  account: SimplifiedAccount | null;
  payment: {
    producerId: string;
    name: string | null;
    code: string | null;
  } | null;
  analytics: MovementAnalytics[];
}

(retour en haut de page)

Ecriture

TypeScript
ts
interface EntryAdditionalProducerProps {
  createdAt: number;
  accountedAt: string;
  source: {
    name: string,
    thirdParty: {
      name: string;
      code: string;
    } | null;
  };
  partnerMetadata: {
    partnerId: string;
    json: string | null;
  } | null;
  publishingDestination?: string;
  comment: string | null;
}

interface Entry {
  producerId: string;
  attachments: Record<string, Attachment>;
  currency: Currency;
  date: string;
  dueDate: string | null;
  journal: {
    producerId: string;
    customerReferenceCode: string;
    name: string;
    type: string;
  };
  movements: Movement[];
  additionalProducerProperties: EntryAdditionalProducerProps;
}
JSON Schema
json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "items": {
    "additionalProperties": false,
    "type": "object",
    "properties": {
      "producerId": {
        "type": "string"
      },
      "attachments": {
        "type": "object",
        "additionalProperties": {
          "additionalProperties": false,
          "type": "object",
          "required": [],
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "const": "URL"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "value"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "const": "File"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "value"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "const": "Base64"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "value"
              ],
              "additionalProperties": false
            }
          ]
        },
        "required": []
      },
      "currency": {
        "additionalProperties": false,
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "nullable": true
          }
        },
        "required": [
          "code"
        ]
      },
      "date": {
        "type": "string"
      },
      "dueDate": {
        "type": "string",
        "nullable": true
      },
      "journal": {
        "type": "object",
        "properties": {
          "producerId": {
            "type": "string"
          },
          "customerReferenceCode": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "producerId",
          "customerReferenceCode",
          "name",
          "type"
        ]
      },
      "movements": {
        "type": "array",
        "items": {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "producerId": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "attachments": {
              "type": "object",
              "additionalProperties": {
                "additionalProperties": false,
                "type": "object",
                "required": [],
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "URL"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "File"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "value"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "Base64"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "required": []
            },
            "value": {
              "type": "object",
              "properties": {
                "credit": {
                  "type": "number"
                },
                "debit": {
                  "type": "number"
                },
                "amount": {
                  "type": "number"
                }
              },
              "required": [
                "amount",
                "credit",
                "debit"
              ]
            },
            "dueDate": {
              "type": "string",
              "nullable": true
            },
            "lettering": {
              "type": "object",
              "additionalProperties": false,
              "required": [],
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "state": {
                      "const": "complete"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "state",
                    "value"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "state": {
                      "const": "partial"
                    },
                    "value": {
                      "type": "string",
                      "pattern": "^\\*.*$"
                    }
                  },
                  "required": [
                    "state",
                    "value"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "state": {
                      "const": "none"
                    },
                    "value": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "state",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "freeNumber": {
              "type": "string",
              "nullable": true
            },
            "invoiceNumber": {
              "type": "string",
              "nullable": true
            },
            "account": {
              "type": "object",
              "properties": {
                "producerId": {
                  "type": "string",
                  "nullable": true
                },
                "number": {
                  "type": "string",
                  "nullable": true
                },
                "name": {
                  "type": "string",
                  "nullable": true
                }
              },
              "nullable": true
            },
            "payment": {
              "additionalProperties": false,
              "type": "object",
              "properties": {
                "producerId": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "nullable": true,
                  "description": "Short and unique code identifier",
                  "enum": [
                    "CB",
                    "VIRT",
                    "ESP",
                    "CHQ",
                    "PRLV",
                    "LCR",
                    null
                  ]
                },
                "name": {
                  "type": "string",
                  "nullable": true,
                  "description": "Complete name (or description)",
                  "enum": [
                    "Carte Bleue",
                    "Virement",
                    "Espèce",
                    "Chèque",
                    "Pr├®l├¿vement",
                    "Lettre de change",
                    null
                  ]
                }
              },
              "nullable": true,
              "required": [
                "producerId"
              ]
            },
            "analytics": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "producerId": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "sections": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "producerId": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "rate": {
                          "type": "number"
                        },
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "producerId",
                        "amount",
                        "rate",
                        "code",
                        "name"
                      ]
                    }
                  }
                },
                "required": [
                  "producerId",
                  "code",
                  "name",
                  "sections"
                ]
              }
            },
            "additionalProducerProperties": {
              "type": "object",
              "properties": {
                "comment": {
                  "type": "string"
                }
              },
              "required": [
                "comment"
              ],
              "nullable": true
            }
          },
          "required": [
            "producerId",
            "description",
            "value",
            "lettering",
            "analytics"
          ]
        }
      },
      "additionalProducerProperties": {
        "type": "object",
        "properties": {
          "partnerId": {
            "type": "string"
          },
          "partnerMetadata": {
            "type": "object",
            "properties": {
              "partnerId": {
                "type": "string"
              }
            },
            "required": [
              "partnerId"
            ]
          },
          "publishingDestination": {
            "type": "string"
          },
          "comment": {
            "type": "string"
          }
        },
        "nullable": true,
        "required": [
          "partnerId",
          "partnerMetadata",
          "publishingDestination",
          "comment"
        ]
      }
    },
    "required": [
      "producerId",
      "attachments",
      "currency",
      "date",
      "movements"
    ]
  }
}

Dates

Une écriture possède plusieurs propriétés de date distinctes. Voici la définition de chacune d'elles :

  • date : représente la date officielle de l'écriture ou du document comptable.
  • dueDate : correspond à la date d'échéance du paiement ou du règlement associé à l'écriture (si applicable). Utilisée principalement pour les écritures de créances ou de dettes, elle indique le délai de paiement.
  • additionalProducerProperties.createdAt : indique l'horodatage (timestamp) du moment où l'écriture a été créée et enregistrée dans la base de données MyUnisoft.
  • additionalProducerProperties.accountedAt : varie en fonction du contexte :
    • Si l'écriture est générée via l'application, cette date correspond à la validation de la saisie par l'utilisateur.
    • Si l'écriture est issue d'un import (lors d'une migration ou d'un chargement de données, comme via un fichier TRA), cette date reprend celle de l'écriture d'origine, reflétant la date effective de la transaction dans le journal comptable.

Source d'une écriture

Les sources à ce jour possible pour une écriture sont les suivantes;

codelabel
ESaisie
MManuel
OOCR
EXTExtourne
LLettrage
IBIntegration bancaire
POD Paie
ANA nouveau
OD_TVAOD TVA
OD_CALC_ISOD Calcul IS
OD_ECARTOD Ecart
REM_BQRemise en banque
RB_MANUELFichier CFONB manuel
WORKSHEETWorksheet (feuille de travail)
QUADRAImport QUADRA
CEGIDImport CEGID
ACDImport ACD
FECImport FEC
EXCELImport Excel
RB_JDCJeDeclare
RB_QTQonto
RB_SBSoBank
RB_FTPFTP
RTVRRetriever
QUICKQuickbooks
ABOAbonnement
PRLV_SEPAPrélèvement SEPA
VIRT_SEPAVirement SEPA
APIAPI

La source API fournira en supplément un code permettant l'identification du partenaire.

(retour en haut de page)