Skip to content

Commit

Permalink
fix(pain001): 🐛 update README and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed May 19, 2024
1 parent 1b5e792 commit 0f26334
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 87 deletions.
215 changes: 130 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

The Python library focuses specifically on **Payment Initiation and Advice Messages**, commonly known as **Pain**. In a very simplified way, a **pain.001** is a message that initiates the customer payment.

As of today the library is designed to be compatible with the:
As of today, the library is designed to be compatible with the:

- **Payments Initiation V03 (pain.001.001.03)**: This version is used for initiating credit transfers within the SEPA (Single Euro Payments Area).
- **Payments Initiation V04 (pain.001.001.04)**: Introduced support for non-SEPA payments and additional functionalities.
Expand All @@ -26,12 +26,11 @@ As of today the library is designed to be compatible with the:
- **Payments Initiation V08 (pain.001.001.08)**: Included support for the TARGET Instant Settlement Service (TISS) and introduced a new pain.002 message type for debit transfers.
- **Payments Initiation V09 (pain.001.001.09)**: The latest version, which introduced support for Request for Account Information (RAI) functionality.

Payments usually start with a **pain.001 payment initiation message**. The payer sends it to the payee (or the payee’s bank) via a secure network. This
network could be **SWIFT** or **SEPA (Single Euro Payments Area) network**, or other payment networks such as **CHAPS**, **BACS**, **Faster Payments**, etc. The message contains the payer’s and payee’s bank account details, payment amount, and other information required to process the payment.
Payments usually start with a **pain.001 payment initiation message**. The payer sends it to the payee (or the payee’s bank) via a secure network. This network could be **SWIFT** or **SEPA (Single Euro Payments Area) network**, or other payment networks such as **CHAPS**, **BACS**, **Faster Payments**, etc. The message contains the payer’s and payee’s bank account details, payment amount, and other information required to process the payment.

The **Pain001** library can reduce payment processing complexity and costs by generating ISO 20022-compliant payment files. These files automatically remove the need to create and validate them manually, making the payment process more efficient and cost-effective. It will save you time and resources and minimises the risk of errors, making sure accurate and seamless payment processing.
The **Pain001** library can reduce payment processing complexity and costs by generating ISO 20022-compliant payment files. These files automatically remove the need to create and validate them manually, making the payment process more efficient and cost-effective. It will save you time and resources and minimize the risk of errors, ensuring accurate and seamless payment processing.

Use the **Pain001** library to simplify, accelerate and automate your payment processing.
Use the **Pain001** library to simplify, accelerate, and automate your payment processing.

## Table of Contents

Expand All @@ -52,6 +51,13 @@ Use the **Pain001** library to simplify, accelerate and automate your payment pr
- [Using a CSV Data File as the source](#using-a-csv-data-file-as-the-source)
- [Using a SQLite Data File as the source](#using-a-sqlite-data-file-as-the-source)
- [Using the Source code](#using-the-source-code)
- [Pain.001.001.03](#pain00100103)
- [Pain.001.001.04](#pain00100104)
- [Pain.001.001.05](#pain00100105)
- [Pain.001.001.06](#pain00100106)
- [Pain.001.001.07](#pain00100107)
- [Pain.001.001.08](#pain00100108)
- [Pain.001.001.09](#pain00100109)
- [Embedded in an Application](#embedded-in-an-application)
- [Validation](#validation)
- [Documentation](#documentation)
Expand All @@ -65,41 +71,24 @@ Use the **Pain001** library to simplify, accelerate and automate your payment pr

## Features

- **Easy to use:** Both developers and non-developers can easily use the
library, as it requires minimal coding knowledge.
- **Open-source**: The library is open-source and free to use, making it
accessible to everyone.
- **Secure**: The library is secure and does not store any sensitive data,
making sure that all information remains confidential.
- **Customizable**: The library allows developers to customise the output,
making it adaptable to specific business requirements and preferences.
- **Scalable solution**: The **Pain001** library can handle varying volumes of
payment files, making it suitable for businesses of different sizes and
transaction volumes.
- **Time-saving**: The automated file creation process reduces the time spent
on manual data entry and file generation, increasing overall productivity.
- **Seamless integration**: As a Python package, the Pain001 library is
compatible with various Python-based applications and easily integrates into
any existing projects or workflows.
- **Cross-border compatibility**: The library supports both Single Euro
Payments Area (SEPA) and non-SEPA credit transfers, making it versatile for
use in different countries and regions.
- **Improve accuracy** by providing precise data; the library reduces errors in
payment file creation and processing.
- **Enhance efficiency** by automating the creation of Payment Initiation
message files
- **Accelerate payment file creation** by automating the process and reducing
the time required to create payment files.
- **Guarantee the highest quality and compliance** by validating all payment
files to meet the ISO 20022 standards.
- **Simplify ISO 20022-compliant payment initiation message creation** by
providing a standardised payment file format.
- **Reduce costs** by removing manual data entry and file generation, reducing
payment processing time, and reducing errors.
- **Easy to use:** Both developers and non-developers can easily use the library, as it requires minimal coding knowledge.
- **Open-source**: The library is open-source and free to use, making it accessible to everyone.
- **Secure**: The library is secure and does not store any sensitive data, ensuring that all information remains confidential.
- **Customizable**: The library allows developers to customize the output, making it adaptable to specific business requirements and preferences.
- **Scalable solution**: The **Pain001** library can handle varying volumes of payment files, making it suitable for businesses of different sizes and transaction volumes.
- **Time-saving**: The automated file creation process reduces the time spent on manual data entry and file generation, increasing overall productivity.
- **Seamless integration**: As a Python package, the Pain001 library is compatible with various Python-based applications and easily integrates into any existing projects or workflows.
- **Cross-border compatibility**: The library supports both Single Euro Payments Area (SEPA) and non-SEPA credit transfers, making it versatile for use in different countries and regions.
- **Improve accuracy** by providing precise data; the library reduces errors in payment file creation and processing.
- **Enhance efficiency** by automating the creation of Payment Initiation message files
- **Accelerate payment file creation** by automating the process and reducing the time required to create payment files.
- **Guarantee the highest quality and compliance** by validating all payment files to meet the ISO 20022 standards.
- **Simplify ISO 20022-compliant payment initiation message creation** by providing a standardized payment file format.
- **Reduce costs** by removing manual data entry and file generation, reducing payment processing time, and reducing errors.

## Requirements

**Pain001** works with macOS, Linux and Windows and requires Python 3.9.0 and above.
**Pain001** works with macOS, Linux, and Windows and requires Python 3.9.0 and above.

## Installation

Expand Down Expand Up @@ -138,7 +127,7 @@ Open your terminal and run the following command to add the latest version:
python -m pip install pain001
```

Add the -U switch to update to the current version, if `pain001` is already installed.
Add the -U switch to update to the current version, if `pain001` is already installed.

```sh
python -m pip install -U pain001
Expand Down Expand Up @@ -180,6 +169,7 @@ When running **Pain001**, you will need to specify four arguments:

- An `xml_template_file_path`: This is the path to the XML template file you
are using that contains variables that will be replaced by the values in your

Data file.

- An `xsd_schema_file_path`: This is the path to the XSD schema file you are
Expand Down Expand Up @@ -215,23 +205,95 @@ python3 -m pain001 \

### Using the Source code

You can clone the source code and run the example code in your
terminal/command-line. To check out the source code, clone the repository from
GitHub:
You can clone the source code and run the example code in your terminal/command-line. To check out the source code, clone the repository from GitHub:

```sh
git clone https://github.com/sebastienrousseau/pain001.git
```

#### Pain.001.001.03

This will generate a payment initiation message in the format of Pain.001.001.03.

```sh
python -m pain001 \
python -m pain001 \
-t pain.001.001.03 \
-m templates/pain.001.001.03/template.xml \
-s templates/pain.001.001.03/pain.001.001.03.xsd \
-d templates/pain.001.001.03/template.csv
```
```

#### Pain.001.001.04

This will generate a payment initiation message in the format of Pain.001.001.04.

```sh
python -m pain001 \
-t pain.001.001.04 \
-m templates/pain.001.001.04/template.xml \
-s templates/pain.001.001.04/pain.001.001.04.xsd \
-d templates/pain.001.001.04/template.csv
```

This will generate a payment initiation message from the sample CSV Data file.
#### Pain.001.001.05

This will generate a payment initiation message in the format of Pain.001.001.05.

```sh
python -m pain001 \
-t pain.001.001.05 \
-m templates/pain.001.001.05/template.xml \
-s templates/pain.001.001.05/pain.001.001.05.xsd \
-d templates/pain.001.001.05/template.csv
```

#### Pain.001.001.06

This will generate a payment initiation message in the format of Pain.001.001.06.

```sh
python -m pain001 \
-t pain.001.001.06 \
-m templates/pain.001.001.06/template.xml \
-s templates/pain.001.001.06/pain.001.001.06.xsd \
-d templates/pain.001.001.06/template.csv
```

#### Pain.001.001.07

This will generate a payment initiation message in the format of Pain.001.001.07.

```sh
python -m pain001 \
-t pain.001.001.07 \
-m templates/pain.001.001.07/template.xml \
-s templates/pain.001.001.07/pain.001.001.07.xsd \
-d templates/pain.001.001.07/template.csv
```

#### Pain.001.001.08

This will generate a payment initiation message in the format of Pain.001.001.08.

```sh
python -m pain001 \
-t pain.001.001.08 \
-m templates/pain.001.001.08/template.xml \
-s templates/pain.001.001.08/pain.001.001.08.xsd \
-d templates/pain.001.001.08/template.csv
```

#### Pain.001.001.09

This will generate a payment initiation message in the format of Pain.001.001.09.

```sh
python -m pain001 \
-t pain.001.001.09 \
-m templates/pain.001.001.09/template.xml \
-s templates/pain.001.001.09/pain.001.001.09.xsd \
-d templates/pain.001.001.09/template.csv
```

You can do the same with the sample SQLite Data file:

Expand All @@ -243,38 +305,33 @@ python3 -m pain001 \
-d templates/pain.001.001.03/template.db
```

> **Note:** The XML file that **Pain001** generates will automatically be
validated against the XSD template file before the new XML file is saved. If
the validation fails, **Pain001** will stop running and display an error
message in your terminal.
> **Note:** The XML file that **Pain001** generates will automatically be validated against the XSD template file before the new XML file is saved. If the validation fails, **Pain001** will stop running and display an error message in your terminal.
### Embedded in an Application

To embed **Pain001** in a new or existing application, import the main function
and use it in your code.
To embed **Pain001** in a new or existing application, import the main function and use it in your code.

Here's an example:

```python
from pain001 import main

if __name__ == '__main__':
xml_message_type = 'pain.001.001.03'
xml_template_file_path = 'template.xml'
xsd_schema_file_path = 'schema.xsd'
data_file_path = 'data.csv'
main(
xml_message_type,
xml_template_file_path,
xsd_schema_file_path,
data_file_path
)
xml_message_type = 'pain.001.001.03'
xml_template_file_path = 'template.xml'
xsd_schema_file_path = 'schema.xsd'
data_file_path = 'data.csv'
main(
xml_message_type,
xml_template_file_path,
xsd_schema_file_path,
data_file_path
)
```

### Validation

To validate the generated XML file against a given xsd schema, use the
following method:
To validate the generated XML file against a given xsd schema, use the following method:

```python
from pain001.core import validate_xml_against_xsd
Expand All @@ -284,9 +341,9 @@ xml_file = 'generated.xml'
xsd_file = 'schema.xsd'

is_valid = validate_xml_against_xsd(
xml_message_type,
xml_file,
xsd_file
xml_message_type,
xml_file,
xsd_file
)
print(f"XML validation result: {is_valid}")
```
Expand All @@ -297,14 +354,11 @@ print(f"XML validation result: {is_valid}")
### Supported messages

This section gives access to the documentation related to the ISO 20022
message definitions supported by **Pain001**.
This section gives access to the documentation related to the ISO 20022 message definitions supported by **Pain001**.

#### Bank-to-Customer Cash Management

Set of messages used to request and provide account information for
reconciliation and cash positioning between an account servicer and its
customer.
Set of messages used to request and provide account information for reconciliation and cash positioning between an account servicer and its customer.

| Status | Message type | Name |
|---|---|---|
Expand All @@ -315,8 +369,7 @@ customer.

#### Payments Clearing and Settlement

Set of messages used between financial institutions for the clearing and
settlement of payment transactions.
Set of messages used between financial institutions for the clearing and settlement of payment transactions.

| Status | Message type | Name |
|---|---|---|
Expand All @@ -331,9 +384,7 @@ settlement of payment transactions.

#### Payments Initiation

Set of messages exchanged between a debtor (or buyer) and its bank or
between a creditor (or seller) and its bank to initiate, collect, manage
and monitor payments.
Set of messages exchanged between a debtor (or buyer) and its bank or between a creditor (or seller) and its bank to initiate, collect, manage and monitor payments.

| Status | Message type | Name |
|---|---|---|
Expand All @@ -349,26 +400,20 @@ and monitor payments.

## License

The project is licensed under the terms of both the MIT license and the
Apache License (Version 2.0).
The project is licensed under the terms of both the MIT license and the Apache License (Version 2.0).

- [Apache License, Version 2.0][01]
- [MIT license][02]

## Contribution

We welcome contributions to **Pain001**. Please see the
[contributing instructions][04] for more information.
We welcome contributions to **Pain001**. Please see the [contributing instructions][04] for more information.

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the
Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

## Acknowledgements

We would like to extend a big thank you to all the awesome contributors
of [Pain001][05] for their help and support.
We would like to extend a big thank you to all the awesome contributors of [Pain001][05] for their help and support.

[00]: https://pain001.com
[01]: https://opensource.org/license/apache-2-0/
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ mdurl = "0.1.2"
pygments = "2.18.0"
python = "^3.9"
rich = "13.7.1"
setuptools = "^65.5.1"
xmlschema = "3.3.1"

[tool.poetry.group.dev.dependencies]
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ install_requires =
pygments==2.18.0
python=3.9
rich==13.7.1
setuptools==65.5.1
xmlschema==3.3.1

[options.extras_require]
Expand Down
27 changes: 27 additions & 0 deletions templates/pain.001.001.09/pain.001.001.09.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@
</DbtrAgt>
<ChrgBr>DEBT</ChrgBr>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>PaymentID6789</EndToEndId>
</PmtId>
<Amt>
<InstdAmt Ccy="EUR">150.00</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BICFI xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.09">DEUTDEFFXXX</BICFI>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Global Tech</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>DE68210501700024690959</IBAN>
</Id>
</CdtrAcct>

<SplmtryData>
<Envlp>
<WC />
</Envlp>
</SplmtryData>
</CdtTrfTxInf>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>PaymentID4321</EndToEndId>
</PmtId>
Expand Down

0 comments on commit 0f26334

Please sign in to comment.