Skip to content

Commit 9f36d22

Browse files
committed
Make SetuAPIException accessible from package index
1 parent b1569c5 commit 9f36d22

5 files changed

Lines changed: 41 additions & 8 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
`setu` is a Python SDK for accessing Setu’s [UPI Deeplinks](https://docs.setu.co/collect/biller/upi-deep-links) APIs. The SDK is designed with ease of access in mind, with native Python class objects for inputs & ouputs and custom exceptions.
44

5-
[![Version](https://img.shields.io/pypi/v/setu?color=%2320014B)](https://pypi.org/project/setu-python-sdk)
6-
[![Downloads](https://img.shields.io/pypi/dw/setu?color=%23FEB452)](https://www.npmjs.org/package/@setu/upi-deep-links)
5+
[![Version](https://img.shields.io/pypi/v/setu?color=%2320014B)](https://pypi.org/project/setu)
6+
[![Downloads](https://img.shields.io/pypi/dw/setu?color=%23FEB452)](https://pypi.org/project/setu)
77
[![License](https://img.shields.io/pypi/l/setu?color=%23FE90A0)](LICENSE.md)
88

99
<img src="assets/deeplinks.png" alt="SDK in action" width="100%">
@@ -12,8 +12,8 @@ Python package to connect to Setu's UPI Deep Link APIs
1212

1313
## Getting started
1414

15-
[SDK documentation →](https://opensource.setu.co/setu-python-sdk)
16-
[Full documentation →](https://docs.setu.co/payments/upi-deeplinks)
15+
[SDK documentation →](https://opensource.setu.co/setu-python-sdk) .
16+
[Full documentation →](https://docs.setu.co/payments/upi-deeplinks) .
1717
[Product overview →](https://setu.co/payments/upi-deeplinks)
1818

1919
### Installation
@@ -74,7 +74,7 @@ except SetuAPIException as e:
7474
assert False
7575
```
7676

77-
# Trigger mock payment for UPI payment link (Sandbox only)
77+
### Trigger mock payment for UPI payment link (Sandbox only)
7878

7979
```python
8080
try:

assets/deeplinks.png

117 KB
Loading

assets/preview.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
```python
2+
from setu import Deeplink, SetuAPIException
3+
4+
dl = Deeplink(
5+
scheme_id="c4f57443-dc1e-428f-8c4e-e5fd531057d2",
6+
secret="5b288618-473f-4193-ae1b-8c42f223798e",
7+
product_instance_id="861023031961584801",
8+
auth_type="OAUTH",
9+
mode="SANDBOX",
10+
)
11+
12+
try:
13+
# Create Payment Link
14+
link = dl.create_payment_link(
15+
amount_value=2000,
16+
biller_bill_id="test_transaction_1234",
17+
amount_exactness="EXACT",
18+
)
19+
assert link.payment_link.upi_id == "refundtest@kaypay"
20+
21+
# Mock Payment (Sandbox)
22+
credit_response = dl.trigger_mock_payment(
23+
200, link.payment_link.upi_id, link.platform_bill_id
24+
)
25+
26+
# Get Payment Link Status
27+
link_status = dl.check_payment_status(link.platform_bill_id)
28+
assert link_status.status == "PAYMENT_SUCCESSFUL"
29+
except SetuAPIException as e:
30+
LOGGER.error(e.error)
31+
assert True
32+
```

setu/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Top-level package for Setu UPI DeepLinks SDK."""
22
from setu.deeplink import Deeplink
3+
from setu.contract import SetuAPIException
34

45
__version__ = '1.1.0'
56

6-
__all__ = ["Deeplink"]
7+
__all__ = ["Deeplink", "SetuAPIException"]

tests/test_deeplink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import time
44
from datetime import datetime, timedelta
55

6-
from setu import Deeplink
7-
from setu.contract import Account, RefundRequestItem, SettlementSplits, SetuAPIException, SplitAccount
6+
from setu import Deeplink, SetuAPIException
7+
from setu.contract import Account, RefundRequestItem, SettlementSplits, SplitAccount
88

99
LOGGER = logging.getLogger(__name__)
1010

0 commit comments

Comments
 (0)