Metadata-Version: 2.1
Name: napas-qr-python
Version: 0.1.1
Summary: VietQR for python.
Home-page: https://github.com/shinxz12/napas-qr-python
License: MIT
Author: shinxz12
Author-email: ngocbthe@gmail.com
Requires-Python: >=3.8.2,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.8
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: test
Requires-Dist: black (>=22.3.0,<23.0.0) ; extra == "test"
Requires-Dist: bump2version (>=1.0.1,<2.0.0) ; extra == "dev"
Requires-Dist: flake8 (>=3.9.2,<4.0.0) ; extra == "test"
Requires-Dist: flake8-docstrings (>=1.6.0,<2.0.0) ; extra == "test"
Requires-Dist: isort (>=5.8.0,<6.0.0) ; extra == "test"
Requires-Dist: mkdocs (>=1.1.2,<2.0.0) ; extra == "doc"
Requires-Dist: mkdocs-autorefs (>=0.2.1,<0.3.0) ; extra == "doc"
Requires-Dist: mkdocs-include-markdown-plugin (>=1.0.0,<2.0.0) ; extra == "doc"
Requires-Dist: mkdocs-material (>=6.1.7,<7.0.0) ; extra == "doc"
Requires-Dist: mkdocs-material-extensions (>=1.3.1,<2.0.0)
Requires-Dist: mkdocstrings (>=0.15.2,<0.16.0) ; extra == "doc"
Requires-Dist: mypy (>=1.9.0,<2.0.0) ; extra == "test"
Requires-Dist: pip (>=20.3.1,<21.0.0) ; extra == "dev"
Requires-Dist: pre-commit (>=2.12.0,<3.0.0) ; extra == "dev"
Requires-Dist: pytest (>=6.2.4,<7.0.0) ; extra == "test"
Requires-Dist: pytest-cov (>=2.12.0,<3.0.0) ; extra == "test"
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: segno (>=1.6.1,<2.0.0)
Requires-Dist: toml (>=0.10.2,<0.11.0) ; extra == "dev"
Requires-Dist: tox (>=3.20.1,<4.0.0) ; extra == "dev"
Requires-Dist: twine (>=3.3.0,<4.0.0) ; extra == "dev"
Requires-Dist: types-requests (>=2.31.0.20240311,<3.0.0.0)
Requires-Dist: virtualenv (>=20.2.2,<21.0.0) ; extra == "dev"
Description-Content-Type: text/markdown

# Napas QR Python

[![pypi](https://img.shields.io/pypi/v/napas-qr-python.svg)](https://pypi.org/project/napas-qr-python/)
[![python](https://img.shields.io/pypi/pyversions/napas-qr-python.svg)](https://pypi.org/project/napas-qr-python/)
[![Build Status](https://github.com/shinxz12/napas-qr-python/actions/workflows/dev.yml/badge.svg)](https://github.com/shinxz12/napas-qr-python/actions/workflows/dev.yml)


Generate VietQR for python following VietQR [Vi Version](https://vietqr.net/portal-service/download/documents/QR_Format_T&C_v1.0_VN_092021.pdf)
and [En Version](https://vietqr.net/portal-service/download/documents/QR_Format_T&C_v1.5.2_EN_102022.pdf)

* Documentation: <https://shinxz12.github.io/napas-qr-python>
* GitHub: <https://github.com/shinxz12/napas-qr-python>
* PyPI: <https://pypi.org/project/napas-qr-python/>
* Free software: MIT

## Features

* VietQR code encoder.
* Using [segno](https://segno.readthedocs.io/en/latest/) for QR generator.

# Parameters
| Field                     | Mandatory | Default Value | Description                                    |
|---------------------------|-----------|---------------|------------------------------------------------|
| bin_id                    | Yes       | None          | BIN ID                                         |
| consumer_id               | Yes       | None          | Card/Account ID                                |
| service_code              | Yes       | "ACCOUNT"     | "PAYMENT", "CASH_WITHDRAWL", "CARD", "ACCOUNT" |
| transaction_amount        | No        | None          | Amount                                         |
| purpose_of_transaction.   | No        | None          | Message                                        |
| point_of_initiation_method| Yes       | "DYNAMIC"     | "DYNAMIC" OR "STATIC"                          |
| transaction_currency      | Yes       | 704(VND)      | currency                                       |
| bill_number               | No        | None          | Bill number                                    |
| mobile_number             | No        | None          | Mobile Number                                  |
| store_label               | No        | None          | Store Label                                    |
| reference_label           | No        | None          | Reference Label                                |
| customer_label            | No        | None          | Customer Label                                 |

Please read more in the VietQR docs.

## Example

* Generate code with base informations and an account service:
```
from qr_pay import QRPay

qr_pay = QRPay('970436', '1031933430', purpose_of_transaction="Thanh toan hoa don")
code = qr_pay.code
# 00020101021153037045802VN38540010A00000072701240006970436011010319334300208QRIBFTTA62220818Thanh toan hoa don6304FCE9
# Generate QR code
qr_pay.generate_qr_pay()
```

<p align="center">
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxAQAAAABb53yxAAABN0lEQVR42mP4DwYNDLjoD/L3Gt+wNzB8v56/TfZ7A8OXOP9tseJAOiDz0lQQHeeunisOkv9r8xco/0E0NDQEqP7/zyvb/UH6XQ2rhdY3MPzYLdX6tryB4VMz77SJ7xsY/hqamx0H8r9MO3pxOj9Qf2aubhaQ/zf66b5qoPyHZB+95/kNDH/uLswS6geKb4g7CtL/NfzplWB/oDmpMdNPAuX/uuRemCbfwPBx61F9LZB5YtXXLgHFv5h8FbsPpP/HbcwG618kdXAtUP7z1O6AeyB9vxW3RoLcw3q8cB7Q/k9LM/rLQPr7n367DzT/y3f/LeFA939jX1g1AWj+/w9xLenlIP+9vXdUH+jeW/5by0Hqg3MLBID6v4Qfa0sChU9AddjceqD8hW9954H2fBDbmJotjzt8oTQALM/W5aEFuuoAAAAASUVORK5CYII=">
</p>

* Generate code with a card service and amount:
```
data = {
    "bin_id": "970436",
    "consumer_id": "9704368625581601018",
    "service_code": "CARD",
    "transaction_amount": 2000000
}
qr_pay = QRPay(**data)
code = qr_pay.code
# 0002010102115303704540720000005802VN38630010A00000072701330006970436011997043686255816010180208QRIBFTTC63045FCF
qr_pay.generate_qr_pay()
```

<p align="center">
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApAQAAAACAGz1bAAAA4UlEQVR42mP4DwINDFipD1KRU9gbGL7f3Lv3ewPDl4DYUHEgFbvbFkTFicYCqe+3tLYC5T6IhoYAVf7/bLUfqO8j6/3A+w0Mn8oW7VrfwPCb+2yZewPDT32O4/oNDH/kZaWvNzB8S/qyoh+oXSLTHsj7v6h5FlDlF+ErLseB+h6t+g3WdyekHCi4b9IqIO9X7L4QoMpfO36tym9g+Bpz1GU6UMmqlEXngaaIVQaEA035ZGEOtOGD4FVXe6DgNZntIHcGfbnADnJ1zurtIN7zUKAp3692ay8HqbwSGo7D7xAKAFDunMTKMVUkAAAAAElFTkSuQmCC">
</p>

* Generate QR code with custom styles following segno:
```
qr_pay = QRPay('970436', '1031933430')
# Code: 0002010102115303704540720000005802VN38630010A00000072701330006970436011997043686255816010180208QRIBFTTC63045FCF
styles = { "scale": 2, "dark": "darkblue"}
dist = "qr_code_style.png"
qr_pay.generate_qr_pay(dist=dist, styles=styles)
```

<p align="center">
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAABSAQMAAAD94hHYAAAABlBMVEUAAIv///+fga7nAAAA60lEQVR42rWTMWoGMAiFpa6BXEVwDXj1QFbBqwRcA9YupY1Zf6fw+CIv+gLxWxM+cgZUXotA5hf8qRBf5uZx68TAzoxVd7PuD/0gc9XFtalx6Q9JM1c/Eb2r/Xj+r2PaCUa/9SZDm6neuoFtl0F3/9UC5pZ28xsDHc1vfowWpHPevOAcq0fhQ9vsq/oh7E5E++bbaQnby79vJilztrPyRuE193KYih+1GYmPm2fe2Z7WzecoB2nb9b1DVmai7qv12es8AdGZuJc+PnCbPPKTc3aAR97GVrMHfyQDV/PG0zIQ8vBDmbjq/5P/7hvmnXQlddv3uQAAAABJRU5ErkJggg==">
</p>

