Skip to main content

Payment Parser

Parses a payment file, with multiple blocks of data, into individual CSVs.

PyPI version CodeFactor Grade GitHub languages GitHub license
GitHub pull requests GitHub issues GitHub contributors
GitHub Release Date GitHub last commit GitHub commit activity
GitHub forks GitHub stars GitHub watchers Twitter Follow

The payments file is

  • Stored in fixed-width format
  • Contains hyphen line for calculating column widths
  • Can be split into blocks of text on a split_term

Installation

pip3 install payment-parser

Example Code Usage:

from payment_parser import parse_doc
parse_doc(
    file="payment_parser/T140_sample.txt", 
    output_dir="payment_parser/output/", 
    split_term="MASTERCARD WORLDWIDE", 
    verbose=True,
)

Example CLI Usage:

payment_parser --file "payment_parser/T140_sample.txt" --output_dir "payment_parser/output/" --verbose=False

CLI Output:

File: payment_parser/T140_sample.txt, Split Term: MASTERCARD WORLDWIDE, Output Dir: payment_parser/output/, Verbose: False
Block: 1/13, Report: 1IP727010-AA, Table type: 1
*****   No data found in block above.
Block: 2/13, Report: 1IP727020-AA, Table type: 2
Block: 3/13, Report: 1IP727020-AA, Table type: 2
Block: 4/13, Report: 1IP727020-AA, Table type: 2
Block: 5/13, Report: 1IP727020-AA, Table type: 2
Block: 6/13, Report: 1IP727020-AA, Table type: 2
Block: 7/13, Report: 1IP727020-AA, Table type: 2
Block: 8/13, Report: 1IP728010-AA, Table type: 4
Block: 9/13, Report: 1IP728010-AA, Table type: 4
Block: 10/13, Report: 1IP728010-AA, Table type: 3
Block: 11/13, Report: 1IP728010-AA, Table type: 3
Block: 12/13, Report: 1IP728010-AA, Table type: 3
Block: 13/13, Report: 1IP728010-AA, Table type: 5

Help/Docs Usage:

payment_parser --help                                                                                     

Help/Docs Output:

usage: payment_parser [-h] [--file FILE] [--output_dir OUTPUT_DIR] [--split_term SPLIT_TERM] [--verbose VERBOSE]

optional arguments:
  -h, --help            show this help message and exit
  --file FILE           The absolute path of the file to parse.
  --output_dir OUTPUT_DIR
                        The absolute folder path for saving the parse results.
  --split_term SPLIT_TERM
                        Word or phrase used to split file into chunks.
  --verbose VERBOSE     Whether to enable extra logging.

Metadata

Release files for payment-parser 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for payment-parser 0.2.3
File Size Uploaded
payment_parser-0.2.3.tar.gz 18.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for payment-parser 0.2.3
File Interpreter ABI Platform
payment_parser-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / payment_parser-0.2.3.tar.gz

Download URL payment_parser-0.2.3.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8b5c69567c78fd61810ef07270e1ea5a2cc1348d787a7944179e7f7eb1c01c88
BLAKE2b-256 checksum
How to use checksums
3ff4569ff653b4b3a4a7b4a1880f12940bbda348d5af7a8589da1959b1ad3046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / payment_parser-0.2.3-py3-none-any.whl

Download URL payment_parser-0.2.3-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5748230f56e5d8adc8aae9de0b59e63fab1bd4184a9612f59c14f059c7176496
BLAKE2b-256 checksum
How to use checksums
587680d78dfbd3ac3d3c71a43dd8136a43f0d2f71a321021ad27ab83603f12e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page