A Python client for interacting with PASHA Bank's API.
You can install the package using pip:
pip install pasha-bank-api
To use the library, you first need to initialize the PashaBankAPI
class with the necessary credentials.
from pasha_bank_api import PashaBankAPI, Currency, Language
api = PashaBankAPI(
base_url='https://ecomm.pashabank.az:18443/ecomm2/MerchantHandler',
ssl_cert='path/to/cert.pem',
ssl_key='path/to/key.pem',
ssl_pass='your_password'
)
Register a financial transaction without given card data for the purchase.
response = api.start_sms_transaction(
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
terminal_id='123456',
description='Purchase description',
language=Language.EN
)
print(response)
Register a financial transaction with given card data.
response = api.start_card_sms_transaction(
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
cardname='John Doe',
pan='4111111111111111',
expiry='1225',
cvv2='123',
description='Purchase description',
language=Language.EN
)
print(response)
Register a DMS authorization.
response = api.start_dms_authorization(
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
description='Authorization description',
language=Language.EN
)
print(response)
Perform a DMS transaction.
response = api.dms_transaction(
trans_id='12345',
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
description='DMS transaction description',
language=Language.EN
)
print(response)
Perform a transaction reversal.
response = api.reversal(
trans_id='12345',
amount='100',
suspected_fraud='1'
)
print(response)
Perform a transaction refund.
response = api.refund(
trans_id='12345',
amount='100'
)
print(response)
Register a recurring payment.
response = api.recurring_payment_registration(
command='e',
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
biller_client_id='biller123',
perspayee_expiry='1225',
description='Recurring payment registration',
language=Language.EN,
perspayee_gen=1,
perspayee_overwrite=0
)
print(response)
Execute a recurring payment.
response = api.recurring_payment_execution(
biller_client_id='biller123',
amount='100',
currency=Currency.AZN,
client_ip_addr='192.168.1.1',
description='Recurring payment execution'
)
print(response)
Delete a recurring payment.
response = api.recurring_payment_deletion(
biller_client_id='biller123'
)
print(response)
Get the result of a transaction.
response = api.transaction_result(
trans_id='12345'
)
print(response)
To run the tests, ensure you are in the Poetry shell, and run:
pytest
Contributions are welcome! Please submit a pull request or open an issue to discuss what you want to change.
This project is licensed under the MIT License.