---
title: Mandate
slug: oip-next/jnfrmd0-z89copopvo63n
icon: {"lucideIcon":"📘"}
createdAt: 2024-04-08T10:17:29.000Z
---

# Mandate

## Description

L'entité Mandate regroupe les informations relatives au mandat de prélèvement.

## Relations

### Ascendantes

| Entité        | Propriété |
| ------------- | --------- |
| BankAccount   | mandates  |
| PaymentMethod | mandates  |

### Descendantes

| Entité  | Propriété |
| ------- | --------- |
| History | history   |

## Propriétés

| Nom               | Type      | Description                                                                       | Validateur               | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| ----------------- | --------- | --------------------------------------------------------------------------------- | ------------------------ | --------------- | ----------- | ------------------------- |
| ICS               | `String`  | L'Identifiant Créancier SEPA (ICS)                                                | Exactement 13 caractères |                 |             |                           |
| RUM               | `String`  | La Référence Unique de Mandat                                                     | Au moins 30 caractères   |                 |             |                           |
| isActive          | `Boolean` | Indique si le mandat est actif                                                    |                          |                 |             |                           |
| signDate          | `Date`    | Date de signature du mandat                                                       |                          |                 |             |                           |
| validityEndDate   | `Date`    | Date de fin de prélèvement                                                        |                          |                 |             |                           |
| validityStartDate | `Date`    | Date de début de prélèvement                                                      |                          |                 |             |                           |
| id                | `String`  | Identifiant de l'entité `Mandate`                                                 |                          | X               |             |                           |
| code              | `String`  | Codification fonctionnelle de l'entité `Mandate`                                  |                          |                 |             |                           |
| externalId        | `String`  | Identifiant de l'entité `Mandate` dans le système client                          |                          |                 |             |                           |
| externalCode      | `String`  | Codification fonctionnelle de l'entité `Mandate` dans le système client           |                          |                 |             |                           |
| mandateId         | `String`  | Identifiant public de l'entité `Mandate` dans l'OIP                               |                          |                 |             |                           |
| label             | `String`  | Information relative au nom de l'entité `Mandate` dans son contexte d'utilisation |                          |                 |             |                           |
| createdAt         | `Date`    | Date de création de l'entité `Mandate`                                            |                          | X               |             |                           |
| updatedAt         | `Date`    | Date de modification de l'entité `Mandate`                                        |                          | X               |             |                           |

## Enumérations

Aucune enumération.

## Enumérations génériques

Aucune enumération générique.

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getBankAccountId } from '@fasstech/oip-core/entities/BankAccount';
import { getCompanyId } from '@fasstech/oip-core/entities/Company';
import { getMandateCode, getMandateExternalCode, getMandateExternalId, getMandateICS, getMandateId, getMandateIsActive, getMandateLabel, getMandateMandateId, getMandateRUM, getMandateSignDate, getMandateValidityEndDate, getMandateValidityStartDate, setMandateCode, setMandateExternalCode, setMandateExternalId, setMandateICS, setMandateIsActive, setMandateLabel, setMandateMandateId, setMandateRUM, setMandateSignDate, setMandateValidityEndDate, setMandateValidityStartDate } from '@fasstech/oip-core/entities/Mandate';
import { getProjectId } from '@fasstech/oip-core/entities/Project';

(async () => {
  let project = await Entities('Project').create();
  let company = await Entities('Company').create();
  let bankAccount = await Entities('BankAccount').create();
  const mandate = await Entities('Mandate').create();
  
  setMandateICS('IIIIIIIIIIIII', mandate);
  setMandateRUM('RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR', mandate);
  setMandateIsActive(false, mandate);
  setMandateSignDate(new Date('2017-01-01'), mandate);
  setMandateValidityEndDate(new Date('2017-01-01'), mandate);
  setMandateValidityStartDate(new Date('2017-01-01'), mandate);
  setMandateCode('code', mandate);
  setMandateExternalId('externalId', mandate);
  setMandateExternalCode('externalCode', mandate);
  setMandateMandateId('mandateId', mandate);
  setMandateLabel('label', mandate);
  
  bankAccount = await Entities('Mandate').save(bankAccount, mandate);
  company = await Entities('BankAccount').save(company, bankAccount);
  project = await Entities('Company').save(project, company);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const companyToTest = await Entities('Company').get(projectToTest, { filter: ({ id }) => id === getCompanyId(company) });
  const bankAccountToTest = await Entities('BankAccount').get(companyToTest, { filter: ({ id }) => id === getBankAccountId(bankAccount) });
  const mandateToTest = await Entities('Mandate').get(bankAccountToTest, { filter: ({ id }) => id === getMandateId(mandate) });
  
  getMandateICS(mandateToTest); // 'IIIIIIIIIIIII'
  getMandateRUM(mandateToTest); // 'RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR'
  getMandateIsActive(mandateToTest); // false
  getMandateSignDate(mandateToTest); // new Date('2017-01-01')
  getMandateValidityEndDate(mandateToTest); // new Date('2017-01-01')
  getMandateValidityStartDate(mandateToTest); // new Date('2017-01-01')
  getMandateCode(mandateToTest); // 'code'
  getMandateExternalId(mandateToTest); // 'externalId'
  getMandateExternalCode(mandateToTest); // 'externalCode'
  getMandateMandateId(mandateToTest); // 'mandateId'
  getMandateLabel(mandateToTest); // 'label'
})();
```
