victoriabank-mia-sdk


Namevictoriabank-mia-sdk JSON
Version 1.1.5 PyPI version JSON
download
home_pageNone
SummaryPython SDK for Victoriabank MIA API
upload_time2025-10-27 13:24:46
maintainerNone
docs_urlNone
authorAlexander Minza
requires_python>=3.9
licenseNone
keywords victoriabank moldova mia qr payments api sdk python
VCS
bugtrack_url
requirements cryptography PyJWT httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK for Victoriabank MIA API
* Victoriabank IPS Business WebApi docs: https://test-ipspj.victoriabank.md
* Victoriabank IPS DemoPay WebApi https://test-ipspj-demopay.victoriabank.md/swagger/
* GitHub project https://github.com/alexminza/victoriabank-mia-sdk-python
* PyPI package https://pypi.org/project/victoriabank-mia-sdk/

## Installation
To easily install or upgrade to the latest release, use `pip`:
```shell
pip install --upgrade victoriabank-mia-sdk
```

## Getting started
Import SDK:

```python
from victoriabank_mia_sdk import VictoriabankMiaSdk, VictoriabankMiaAuthRequest, VictoriabankMiaApiRequest
```

Add project configuration:

```python
import os, datetime

VB_PUBLIC_KEY_PATH = os.getenv('VB_PUBLIC_KEY_PATH')
VB_MIA_USERNAME = os.getenv('VB_MIA_USERNAME')
VB_MIA_PASSWORD = os.getenv('VB_MIA_PASSWORD')
VB_IBAN = os.getenv('VB_IBAN')
```

## SDK usage examples
### Get Access Token with username and password

```python
vb_mia_auth = VictoriabankMiaAuthRequest \
    .create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL) \
    .generate_token(username=VB_MIA_USERNAME, password=VB_MIA_PASSWORD)

vb_mia_token = vb_mia_auth['accessToken']
```

### Create a dynamic order payment QR

```python
vb_mia_qr_data = {
    'header': {
        'qrType': 'DYNM', # Type of QR code: DYNM - Dynamic QR, STAT - Static QR, HYBR - Hybrid QR
        'amountType': 'Fixed', # Specifies the type of amount: Fixed - Dynamic QR, Controlled - Static QR, Free - Hybrid QR
        'pmtContext': 'e' #Payment context: m - mobile payment, e - e-commerce payment, i - invoice payment, 0 - other
    },
    'extension': {
        'creditorAccount': {
            'iban': f'{VB_IBAN}' # The account from which funds will be debited credited.
        },
        'amount': {
            'sum': 123.45, # The total sum to be paid.
            'currency': 'MDL' # The currency in which the sum is specified.
        },
        'dba': 'TEST SRL', #Commercial name that will appear in client APP.
        'remittanceInfo4Payer': 'Order #123', #Payment destination.
        'creditorRef': '123', #External payment reference.
        'ttl': {
            'length': 60, #The duration for which the QR code is valid.
            'units': 'mm' #The unit of time for the TTL: ss - seconds, mm - minutes
        }
    }
}

vb_mia_api_request = VictoriabankMiaApiRequest.create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL)
vb_mia_create_qr_response = vb_mia_api_request.qr_create(
    data=vb_mia_qr_data,
    token=vb_mia_token)
```

### Decode callback and validate signature

```python
callback_jwt = """eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduYWxDb2RlIjoiRXhwaXJhdGlvbiIsInNpZ25hbER0VG0iOiIyMDI0LTEwLTAxVDE1OjA3OjQ1KzAzOjAwIiwicXJIZWFkZXJVVUlEIjoiYmQxMjA0OWItNjUxZC00MGEwLWIyYmMtZDZhMGY3ZTJiN2M3IiwicXJFeHRlbnNpb25VVUlEIjoiNjU0YWNkNjktNjAyYy00MzUxLTk1OTItODE0M2FlMjhkM2U0IiwicGF5bWVudCI6bnVsbH0.WJ5t8jtg2_6DPrxQNIcu50gsW7cDC8IMdjvOBO9wW3toIdeAljlMPxd_lLCWJiKXToRAVHU7a1EB4mLyzyw1iCcRadnsSqm21TrpDZWTjv3uL-XiMLrWOsGBf0aJJRFcGbysU_ym9YLonQMmYLF0voq39yAPMHO7CLCniSMhVdJ9Q5xnrq52y6Yn5YzefCNb2tAQ-erm-8_mCaF0DWd0UFhPA6TRXyV2l5GCkLbyhlUB9gVoVTdSN-XxA_1aoNTusheZPDH1InL03Bx3G8muaVxOMrMIsVCJJYAaTFKiQTBf0M49oTQpdPWeeS9wHaS7aSS3gUcFsOOEPavj7J8vxg"""

with open(VB_PUBLIC_KEY_PATH, mode='rb') as vb_public_key_file:
    vb_public_key_pem = vb_public_key_file.read()

decoded_payload = VictoriabankMiaSdk.decode_callback(
    callback_jwt=callback_jwt,
    public_key_pem=vb_public_key_pem)
```

### Perform a test QR payment

```python
vb_test_pay_data = {
    'qrHeaderUUID': vb_mia_create_qr_response['qrHeaderUUID']
}

vb_test_pay_response = vb_mia_api_request.test_pay(
    data=vb_test_pay_data,
    token=vb_mia_token)
```

### Get payment details

```python
vb_qr_extension_status_response = vb_mia_api_request.qr_extension_status(
    qr_extension_id=vb_mia_create_qr_response['qrExtensionUUID'],
    token=vb_mia_token)
```

### Refund payment

```python
vb_payment_reference: str = vb_qr_extension_status_response['payments'][0]['reference']
vb_transaction_id = vb_payment_reference.split('|')[3]

vb_transaction_reverse_response = vb_mia_api_request.transaction_reverse(
    transaction_id=vb_transaction_id,
    token=vb_mia_token)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "victoriabank-mia-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "victoriabank, moldova, mia, qr, payments, api, sdk, python",
    "author": "Alexander Minza",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0b/25/c5ff7ba0eac9b3fa1d64bc94f5a80e6f0086e60db37722f5a11dded53973/victoriabank_mia_sdk-1.1.5.tar.gz",
    "platform": null,
    "description": "# Python SDK for Victoriabank MIA API\n* Victoriabank IPS Business WebApi docs: https://test-ipspj.victoriabank.md\n* Victoriabank IPS DemoPay WebApi https://test-ipspj-demopay.victoriabank.md/swagger/\n* GitHub project https://github.com/alexminza/victoriabank-mia-sdk-python\n* PyPI package https://pypi.org/project/victoriabank-mia-sdk/\n\n## Installation\nTo easily install or upgrade to the latest release, use `pip`:\n```shell\npip install --upgrade victoriabank-mia-sdk\n```\n\n## Getting started\nImport SDK:\n\n```python\nfrom victoriabank_mia_sdk import VictoriabankMiaSdk, VictoriabankMiaAuthRequest, VictoriabankMiaApiRequest\n```\n\nAdd project configuration:\n\n```python\nimport os, datetime\n\nVB_PUBLIC_KEY_PATH = os.getenv('VB_PUBLIC_KEY_PATH')\nVB_MIA_USERNAME = os.getenv('VB_MIA_USERNAME')\nVB_MIA_PASSWORD = os.getenv('VB_MIA_PASSWORD')\nVB_IBAN = os.getenv('VB_IBAN')\n```\n\n## SDK usage examples\n### Get Access Token with username and password\n\n```python\nvb_mia_auth = VictoriabankMiaAuthRequest \\\n    .create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL) \\\n    .generate_token(username=VB_MIA_USERNAME, password=VB_MIA_PASSWORD)\n\nvb_mia_token = vb_mia_auth['accessToken']\n```\n\n### Create a dynamic order payment QR\n\n```python\nvb_mia_qr_data = {\n    'header': {\n        'qrType': 'DYNM', # Type of QR code: DYNM - Dynamic QR, STAT - Static QR, HYBR - Hybrid QR\n        'amountType': 'Fixed', # Specifies the type of amount: Fixed - Dynamic QR, Controlled - Static QR, Free - Hybrid QR\n        'pmtContext': 'e' #Payment context: m - mobile payment, e - e-commerce payment, i - invoice payment, 0 - other\n    },\n    'extension': {\n        'creditorAccount': {\n            'iban': f'{VB_IBAN}' # The account from which funds will be debited credited.\n        },\n        'amount': {\n            'sum': 123.45, # The total sum to be paid.\n            'currency': 'MDL' # The currency in which the sum is specified.\n        },\n        'dba': 'TEST SRL', #Commercial name that will appear in client APP.\n        'remittanceInfo4Payer': 'Order #123', #Payment destination.\n        'creditorRef': '123', #External payment reference.\n        'ttl': {\n            'length': 60, #The duration for which the QR code is valid.\n            'units': 'mm' #The unit of time for the TTL: ss - seconds, mm - minutes\n        }\n    }\n}\n\nvb_mia_api_request = VictoriabankMiaApiRequest.create(base_url=VictoriabankMiaSdk.SANDBOX_BASE_URL)\nvb_mia_create_qr_response = vb_mia_api_request.qr_create(\n    data=vb_mia_qr_data,\n    token=vb_mia_token)\n```\n\n### Decode callback and validate signature\n\n```python\ncallback_jwt = \"\"\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWduYWxDb2RlIjoiRXhwaXJhdGlvbiIsInNpZ25hbER0VG0iOiIyMDI0LTEwLTAxVDE1OjA3OjQ1KzAzOjAwIiwicXJIZWFkZXJVVUlEIjoiYmQxMjA0OWItNjUxZC00MGEwLWIyYmMtZDZhMGY3ZTJiN2M3IiwicXJFeHRlbnNpb25VVUlEIjoiNjU0YWNkNjktNjAyYy00MzUxLTk1OTItODE0M2FlMjhkM2U0IiwicGF5bWVudCI6bnVsbH0.WJ5t8jtg2_6DPrxQNIcu50gsW7cDC8IMdjvOBO9wW3toIdeAljlMPxd_lLCWJiKXToRAVHU7a1EB4mLyzyw1iCcRadnsSqm21TrpDZWTjv3uL-XiMLrWOsGBf0aJJRFcGbysU_ym9YLonQMmYLF0voq39yAPMHO7CLCniSMhVdJ9Q5xnrq52y6Yn5YzefCNb2tAQ-erm-8_mCaF0DWd0UFhPA6TRXyV2l5GCkLbyhlUB9gVoVTdSN-XxA_1aoNTusheZPDH1InL03Bx3G8muaVxOMrMIsVCJJYAaTFKiQTBf0M49oTQpdPWeeS9wHaS7aSS3gUcFsOOEPavj7J8vxg\"\"\"\n\nwith open(VB_PUBLIC_KEY_PATH, mode='rb') as vb_public_key_file:\n    vb_public_key_pem = vb_public_key_file.read()\n\ndecoded_payload = VictoriabankMiaSdk.decode_callback(\n    callback_jwt=callback_jwt,\n    public_key_pem=vb_public_key_pem)\n```\n\n### Perform a test QR payment\n\n```python\nvb_test_pay_data = {\n    'qrHeaderUUID': vb_mia_create_qr_response['qrHeaderUUID']\n}\n\nvb_test_pay_response = vb_mia_api_request.test_pay(\n    data=vb_test_pay_data,\n    token=vb_mia_token)\n```\n\n### Get payment details\n\n```python\nvb_qr_extension_status_response = vb_mia_api_request.qr_extension_status(\n    qr_extension_id=vb_mia_create_qr_response['qrExtensionUUID'],\n    token=vb_mia_token)\n```\n\n### Refund payment\n\n```python\nvb_payment_reference: str = vb_qr_extension_status_response['payments'][0]['reference']\nvb_transaction_id = vb_payment_reference.split('|')[3]\n\nvb_transaction_reverse_response = vb_mia_api_request.transaction_reverse(\n    transaction_id=vb_transaction_id,\n    token=vb_mia_token)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for Victoriabank MIA API",
    "version": "1.1.5",
    "project_urls": {
        "Documentation": "https://test-ipspj.victoriabank.md",
        "Homepage": "https://github.com/alexminza/victoriabank-mia-sdk-python",
        "Issues": "https://github.com/alexminza/victoriabank-mia-sdk-python/issues",
        "Repository": "https://github.com/alexminza/victoriabank-mia-sdk-python"
    },
    "split_keywords": [
        "victoriabank",
        " moldova",
        " mia",
        " qr",
        " payments",
        " api",
        " sdk",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0214bd20d801b760345d3d3f41310da323f5350fc92947a096e2f99d4cf97dc2",
                "md5": "073dcc2e833d7131146a741bbd54d05f",
                "sha256": "348740f1328e5aadd4a48c9a6484dcedccffdc5c8a6e9bb45e8b3cee761c09e7"
            },
            "downloads": -1,
            "filename": "victoriabank_mia_sdk-1.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "073dcc2e833d7131146a741bbd54d05f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 21799,
            "upload_time": "2025-10-27T13:24:44",
            "upload_time_iso_8601": "2025-10-27T13:24:44.968447Z",
            "url": "https://files.pythonhosted.org/packages/02/14/bd20d801b760345d3d3f41310da323f5350fc92947a096e2f99d4cf97dc2/victoriabank_mia_sdk-1.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0b25c5ff7ba0eac9b3fa1d64bc94f5a80e6f0086e60db37722f5a11dded53973",
                "md5": "23d726ee3462438e824d9bdd9f7acfc8",
                "sha256": "f42883a174ccbad528f315c538226ddf10d4f83425c93f4c685daa0e002b2066"
            },
            "downloads": -1,
            "filename": "victoriabank_mia_sdk-1.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "23d726ee3462438e824d9bdd9f7acfc8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 22051,
            "upload_time": "2025-10-27T13:24:46",
            "upload_time_iso_8601": "2025-10-27T13:24:46.375789Z",
            "url": "https://files.pythonhosted.org/packages/0b/25/c5ff7ba0eac9b3fa1d64bc94f5a80e6f0086e60db37722f5a11dded53973/victoriabank_mia_sdk-1.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-27 13:24:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexminza",
    "github_project": "victoriabank-mia-sdk-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "cryptography",
            "specs": []
        },
        {
            "name": "PyJWT",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        }
    ],
    "lcname": "victoriabank-mia-sdk"
}
        
Elapsed time: 3.89807s