Skip to main content

moadian

import json
from moadian import Moadian

with open("private.key", "r") as f:
    private_key = f.read()

moadian = Moadian("YourFiscalID", key)
moadian.get_server_information()
...
#{'signature': None, 'signatureKeyId': None, 'timestamp': 1693947922222, 'result':{'uid': 'c4f374f6-2fe7-4df2-9b39-150310a5dec1', 'packetType': 'SERVER_INFORMATION', 'data': {'serverTime': 1693947922222, 'publicKeys': [{'key': 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxdzREOEfk3vBQogDPGTMqdDQ7t0oDhuKMZkA+Wm1lhzjjhAGfSUOuDvOKRoUEQwP8oUcXRmYzcvCUgcfoRT5iz7HbovqH+bIeJwT4rmLmFcbfPke+E3DLUxOtIZifEXrKXWgSVPkRnhMgym6UiAtnzwA1rmKstJoWpk9Nv34CYgTk8DKQN5jQJqb9L/Ng0zOEEtI3zA424tsd9zv/kP4/SaSnbbnj0evqsZ29X6aBypvnTnwH9t3gbWM4I9eAVQhPYClawHTqvdaz/O/feqfm06QBFnCgL+CBdjLs30xQSLsPICjnlV1jMzoTZnAabWP6FRzzj6C2sxw9a/WwlXrKn3gldZ7Ctv6Jso72cEeCeUI1tzHMDJPU3Qy12RQzaXujpMhCz1DVa47RvqiumpTNyK9HfFIdhgoupFkxT14XLDl65S55MF6HuQvo/RHSbBJ93FQ+2/x/Q2MNGB3BXOjNwM2pj3ojbDv3pj9CHzvaYQUYM1yOcFmIJqJ72uvVf9Jx9iTObaNNF6pl52ADmh85GTAH1hz+4pR/E9IAXUIl/YiUneYu0G4tiDY4ZXykYNknNfhSgxmn/gPHT+7kL31nyxgjiEEhK0B0vagWvdRCNJSNGWpLtlq4FlCWTAnPI5ctiFgq925e+sySjNaORCoHraBXNEwyiHT2hu5ZipIW2cCAwEAAQ==', 'id': '6a2bcd88-a871-4245-a393-2843eafe6e02', 'algorithm': 'RSA', 'purpose': 1}]}, 'encryptionKeyId': None, 'symmetricKey': None, 'iv': None}}
moadian.get_economic_code_information("14007650912")
...
#{'signature': None, 'signatureKeyId': None, 'timestamp': 1693948551814, 'result': {'uid': '2c176d39-f90d-4e34-8629-3812716a5803', 'packetType': 'ECONOMIC_CODE_INFORMATION', 'data': {'nameTrade': 'گروه تجارت الکترونیک دیجی کالا', 'taxpayerStatus': 'ENABLED', 'taxpayerType': 'LEGAL', 'postalcodeTaxpayer': '1917763913', 'addressTaxpayer': 'استان تهران - شهر تهران محله جردن بلوار نلسون ماندلا بلوار صبا غربی پلاک 38 طبقه دوم'}, 'encryptionKeyId': None, 'symmetricKey': None, 'iv': None}}
# replace invoice with your invoice json and make sure you generate 'taxid' correctly.
invoice = '{"header": {}, "body": [{}], "payments": [{}]}'
invoice = json.loads(invoice)
moadian.send_invoice(invoice)

#{'signature': None, 'signatureKeyId': None, 'timestamp': 1693947237, 'result': [{'uid': '88a4e907-10f4-429f-ae89-3327579df***', 'referenceNumber': '395655e5-7830-4b68-bdf8-31ed1f098***', 'errorCode': None, 'errorDetail': None}]}
moadian.inquiry_by_reference_number("395655e5-7830-4b68-bdf8-31ed1f098***")
# this is just an example of inquiry response, your errors will be different.
...
#'signature': None, 'signatureKeyId': None, 'timestamp': 1693947277561, 'result': {'uid': None, 'packetType': 'INQUIRY_RESULT', 'data': [{'referenceNumber': '395655e5-7830-4b68-bdf8-31ed1f098***', 'uid': '88a4e907-10f4-429f-ae89-3327579df***', 'status': 'FAILED', 'data': {'confirmationReferenceId': None, 'error': [{'code': '010504', 'message': 'در مقدار وارد شده در فیلد «سریال صورتحساب» الگو(^[a-fA-F0-9]{10}$) رعایت نشده است.', 'errorType': 'ERROR'}, {'code': '011204', 'message': 'در مقدار وارد شده در فیلد «شماره اقتصادی خریدار» الگو(^\\d{14}$) رعایت نشده است.', 'errorType': 'ERROR'}], 'warning': [], 'success': False}, 'packetType': 'receive_invoice_confirm', 'fiscalId': 'YourFiscalId'}], 'encryptionKeyId': None, 'symmetricKey': None, 'iv': None}}

Metadata

Release files for moadian 1.0.4

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

Source distribution (sdist)

Source distribution for moadian 1.0.4
File Size Uploaded Provenance Actions
moadian-1.0.4.tar.gz 46.4 kB Without provenance Details for moadian-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moadian 1.0.4
File Interpreter ABI Platform Actions
moadian-1.0.4-py3-none-any.whl Python 3 none any Details for moadian-1.0.4-py3-none-any.whl

Total release size: 80.0 kB

Release files / moadian-1.0.4.tar.gz

Download URL moadian-1.0.4.tar.gz
Size 46.4 kB
Tags Source
SHA-256 checksum
How to use checksums
81c72da81ff500983a7217487735abd8e07b7aed8de57bf12bf01f5ee6cc7962
BLAKE2b-256 checksum
How to use checksums
c9151bfec8636a2860758e74197810b541c8bbbd26d7818cb53d3091381485f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / moadian-1.0.4-py3-none-any.whl

Download URL moadian-1.0.4-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f0fc2f0da0eab4651f4cdbfb30b6120d98cf162b2bcdce094e8904f62ca8c63
BLAKE2b-256 checksum
How to use checksums
eec0a06703abb1007f97a4913d8ff902080043ede0b5c6cfc89c3830f2642e82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for moadian 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files No provenance

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