ipay-paymentgateway 0.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ipay_paymentgateway-0.0.5/LICENSE +21 -0
- ipay_paymentgateway-0.0.5/PKG-INFO +98 -0
- ipay_paymentgateway-0.0.5/README.md +74 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/__init__.py +3 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/config.py +3 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/gateway.py +37 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/resources/__init__.py +0 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/resources/order.py +29 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway/resources/transaction.py +5 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway.egg-info/PKG-INFO +98 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway.egg-info/SOURCES.txt +17 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway.egg-info/dependency_links.txt +1 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway.egg-info/requires.txt +1 -0
- ipay_paymentgateway-0.0.5/ipay_paymentgateway.egg-info/top_level.txt +1 -0
- ipay_paymentgateway-0.0.5/setup.cfg +4 -0
- ipay_paymentgateway-0.0.5/setup.py +30 -0
- ipay_paymentgateway-0.0.5/tests/test_gateway.py +18 -0
- ipay_paymentgateway-0.0.5/tests/test_order.py +33 -0
- ipay_paymentgateway-0.0.5/tests/test_transaction.py +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ipay (https://www.ipay.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ipay-paymentgateway
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: A Python library for the Ipay payment gateway.
|
|
5
|
+
Author: Ipay
|
|
6
|
+
Author-email: support@salispay.com
|
|
7
|
+
Keywords: ipay,paymentgateway
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: keywords
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
# IPay Payment Gateway
|
|
26
|
+
|
|
27
|
+
IPay Payment Gateway is a Python library that provides an easy-to-use interface for interacting with the IPay payment gateway API. This library allows you to create orders, check order statuses, and manage transactions securely and efficiently.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Order Management**: Create and manage orders through IPay.
|
|
32
|
+
- **Transaction Management**: Handle transactions with ease.
|
|
33
|
+
- **Secure Authentication**: Uses secure basic authentication for API requests.
|
|
34
|
+
- **System Information**: Attaches system and server information to each request for better tracking and security.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
You can install the package via pip. Run the following command:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install ipay-paymentgateway
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Initializing the Gateway
|
|
47
|
+
|
|
48
|
+
To start using the IPay Gateway, initialize the IPayPaymentGateway class with your client ID and client secret:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
from ipay_paymentgateway import IPayPaymentGateway
|
|
52
|
+
|
|
53
|
+
gateway = IPayPaymentGateway('your-client-id', 'your-client-secret')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Creating an Order
|
|
57
|
+
|
|
58
|
+
To create an order, use the create_order method of the OrderAPI class:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
order_data = {
|
|
62
|
+
'receiptId': '00000001',
|
|
63
|
+
'amount': 100,
|
|
64
|
+
'currency': 'INR',
|
|
65
|
+
'description': 'Test Payment',
|
|
66
|
+
'customerFields': {
|
|
67
|
+
'name': 'Sample User',
|
|
68
|
+
'email': 'xxx@yyy.xom',
|
|
69
|
+
'phone': '1234567890'
|
|
70
|
+
},
|
|
71
|
+
'uiMode': 'checkout',
|
|
72
|
+
'redirectType' : 'post' // or 'redirect'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
order_response = gateway.order.create_order(order_data)
|
|
77
|
+
print("Order Response:", order_response)
|
|
78
|
+
except Exception as e:
|
|
79
|
+
print('Error:', e)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Checking Order Status
|
|
83
|
+
|
|
84
|
+
To check the status of an existing order, use the check_status method:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
order_id = 'order-id'
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
status_response = gateway.order.check_status(order_id)
|
|
91
|
+
print("Order Status:", status_response)
|
|
92
|
+
except Exception as e:
|
|
93
|
+
print('Error:', e)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# IPay Payment Gateway
|
|
2
|
+
|
|
3
|
+
IPay Payment Gateway is a Python library that provides an easy-to-use interface for interacting with the IPay payment gateway API. This library allows you to create orders, check order statuses, and manage transactions securely and efficiently.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Order Management**: Create and manage orders through IPay.
|
|
8
|
+
- **Transaction Management**: Handle transactions with ease.
|
|
9
|
+
- **Secure Authentication**: Uses secure basic authentication for API requests.
|
|
10
|
+
- **System Information**: Attaches system and server information to each request for better tracking and security.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
You can install the package via pip. Run the following command:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install ipay-paymentgateway
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Initializing the Gateway
|
|
23
|
+
|
|
24
|
+
To start using the IPay Gateway, initialize the IPayPaymentGateway class with your client ID and client secret:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
from ipay_paymentgateway import IPayPaymentGateway
|
|
28
|
+
|
|
29
|
+
gateway = IPayPaymentGateway('your-client-id', 'your-client-secret')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Creating an Order
|
|
33
|
+
|
|
34
|
+
To create an order, use the create_order method of the OrderAPI class:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
order_data = {
|
|
38
|
+
'receiptId': '00000001',
|
|
39
|
+
'amount': 100,
|
|
40
|
+
'currency': 'INR',
|
|
41
|
+
'description': 'Test Payment',
|
|
42
|
+
'customerFields': {
|
|
43
|
+
'name': 'Sample User',
|
|
44
|
+
'email': 'xxx@yyy.xom',
|
|
45
|
+
'phone': '1234567890'
|
|
46
|
+
},
|
|
47
|
+
'uiMode': 'checkout',
|
|
48
|
+
'redirectType' : 'post' // or 'redirect'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
order_response = gateway.order.create_order(order_data)
|
|
53
|
+
print("Order Response:", order_response)
|
|
54
|
+
except Exception as e:
|
|
55
|
+
print('Error:', e)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Checking Order Status
|
|
59
|
+
|
|
60
|
+
To check the status of an existing order, use the check_status method:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
order_id = 'order-id'
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
status_response = gateway.order.check_status(order_id)
|
|
67
|
+
print("Order Status:", status_response)
|
|
68
|
+
except Exception as e:
|
|
69
|
+
print('Error:', e)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import platform
|
|
3
|
+
import requests
|
|
4
|
+
from .resources.order import OrderAPI
|
|
5
|
+
from .resources.transaction import TransactionAPI
|
|
6
|
+
|
|
7
|
+
class IPayPaymentGateway:
|
|
8
|
+
def __init__(self, client_id, client_secret):
|
|
9
|
+
self.client_id = client_id
|
|
10
|
+
self.client_secret = client_secret
|
|
11
|
+
self.session = requests.Session()
|
|
12
|
+
self.session.headers.update({
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
'Accept': 'application/json',
|
|
15
|
+
'Authorization': self._get_basic_auth_header(),
|
|
16
|
+
'System-Name': platform.system(),
|
|
17
|
+
'Node-Name': platform.node(),
|
|
18
|
+
'Release': platform.release(),
|
|
19
|
+
'Version': platform.version(),
|
|
20
|
+
'Machine': platform.machine(),
|
|
21
|
+
'Processor': platform.processor()
|
|
22
|
+
})
|
|
23
|
+
self.order = OrderAPI(self.session)
|
|
24
|
+
self.transaction = TransactionAPI(self.session)
|
|
25
|
+
|
|
26
|
+
def _get_basic_auth_header(self):
|
|
27
|
+
credentials = f"{self.client_id}:{self.client_secret}"
|
|
28
|
+
encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8')
|
|
29
|
+
return f"Basic {encoded_credentials}"
|
|
30
|
+
|
|
31
|
+
def _handle_request(self, method, url, **kwargs):
|
|
32
|
+
try:
|
|
33
|
+
response = method(url, **kwargs)
|
|
34
|
+
response.raise_for_status()
|
|
35
|
+
return response.json()
|
|
36
|
+
except requests.exceptions.RequestException as e:
|
|
37
|
+
return {'error': str(e)}
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from ..config import CREATE_ORDER_URL, CHECK_STATUS_URL
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class CustomerFields:
|
|
6
|
+
name: str
|
|
7
|
+
email: str
|
|
8
|
+
phone: str
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class OrderData:
|
|
12
|
+
receiptId: str
|
|
13
|
+
amount: int
|
|
14
|
+
currency: str
|
|
15
|
+
description: str
|
|
16
|
+
customerFields: CustomerFields
|
|
17
|
+
uiMode: str
|
|
18
|
+
redirectType: str
|
|
19
|
+
|
|
20
|
+
class OrderAPI:
|
|
21
|
+
def __init__(self, session):
|
|
22
|
+
self.session = session
|
|
23
|
+
|
|
24
|
+
def create_order(self, order_data: OrderData):
|
|
25
|
+
return self.session.post(CREATE_ORDER_URL, json=order_data).json()
|
|
26
|
+
|
|
27
|
+
def check_status(self, order_id: str):
|
|
28
|
+
url = f"{CHECK_STATUS_URL}?orderId={order_id}"
|
|
29
|
+
return self.session.get(url).json()
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ipay-paymentgateway
|
|
3
|
+
Version: 0.0.5
|
|
4
|
+
Summary: A Python library for the Ipay payment gateway.
|
|
5
|
+
Author: Ipay
|
|
6
|
+
Author-email: support@salispay.com
|
|
7
|
+
Keywords: ipay,paymentgateway
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: keywords
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
# IPay Payment Gateway
|
|
26
|
+
|
|
27
|
+
IPay Payment Gateway is a Python library that provides an easy-to-use interface for interacting with the IPay payment gateway API. This library allows you to create orders, check order statuses, and manage transactions securely and efficiently.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **Order Management**: Create and manage orders through IPay.
|
|
32
|
+
- **Transaction Management**: Handle transactions with ease.
|
|
33
|
+
- **Secure Authentication**: Uses secure basic authentication for API requests.
|
|
34
|
+
- **System Information**: Attaches system and server information to each request for better tracking and security.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
You can install the package via pip. Run the following command:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install ipay-paymentgateway
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Initializing the Gateway
|
|
47
|
+
|
|
48
|
+
To start using the IPay Gateway, initialize the IPayPaymentGateway class with your client ID and client secret:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
from ipay_paymentgateway import IPayPaymentGateway
|
|
52
|
+
|
|
53
|
+
gateway = IPayPaymentGateway('your-client-id', 'your-client-secret')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Creating an Order
|
|
57
|
+
|
|
58
|
+
To create an order, use the create_order method of the OrderAPI class:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
order_data = {
|
|
62
|
+
'receiptId': '00000001',
|
|
63
|
+
'amount': 100,
|
|
64
|
+
'currency': 'INR',
|
|
65
|
+
'description': 'Test Payment',
|
|
66
|
+
'customerFields': {
|
|
67
|
+
'name': 'Sample User',
|
|
68
|
+
'email': 'xxx@yyy.xom',
|
|
69
|
+
'phone': '1234567890'
|
|
70
|
+
},
|
|
71
|
+
'uiMode': 'checkout',
|
|
72
|
+
'redirectType' : 'post' // or 'redirect'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
order_response = gateway.order.create_order(order_data)
|
|
77
|
+
print("Order Response:", order_response)
|
|
78
|
+
except Exception as e:
|
|
79
|
+
print('Error:', e)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Checking Order Status
|
|
83
|
+
|
|
84
|
+
To check the status of an existing order, use the check_status method:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
order_id = 'order-id'
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
status_response = gateway.order.check_status(order_id)
|
|
91
|
+
print("Order Status:", status_response)
|
|
92
|
+
except Exception as e:
|
|
93
|
+
print('Error:', e)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
ipay_paymentgateway/__init__.py
|
|
5
|
+
ipay_paymentgateway/config.py
|
|
6
|
+
ipay_paymentgateway/gateway.py
|
|
7
|
+
ipay_paymentgateway.egg-info/PKG-INFO
|
|
8
|
+
ipay_paymentgateway.egg-info/SOURCES.txt
|
|
9
|
+
ipay_paymentgateway.egg-info/dependency_links.txt
|
|
10
|
+
ipay_paymentgateway.egg-info/requires.txt
|
|
11
|
+
ipay_paymentgateway.egg-info/top_level.txt
|
|
12
|
+
ipay_paymentgateway/resources/__init__.py
|
|
13
|
+
ipay_paymentgateway/resources/order.py
|
|
14
|
+
ipay_paymentgateway/resources/transaction.py
|
|
15
|
+
tests/test_gateway.py
|
|
16
|
+
tests/test_order.py
|
|
17
|
+
tests/test_transaction.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ipay_paymentgateway
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="ipay-paymentgateway",
|
|
8
|
+
version="0.0.5",
|
|
9
|
+
author="Ipay",
|
|
10
|
+
author_email="support@salispay.com",
|
|
11
|
+
description="A Python library for the Ipay payment gateway.",
|
|
12
|
+
long_description=long_description,
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
packages=find_packages(
|
|
15
|
+
include=[
|
|
16
|
+
"ipay_paymentgateway",
|
|
17
|
+
"ipay_paymentgateway.*"
|
|
18
|
+
]
|
|
19
|
+
),
|
|
20
|
+
# package_dir={'': 'ipay_paymentgateway'},
|
|
21
|
+
classifiers=[
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
],
|
|
25
|
+
keywords=["ipay", "paymentgateway"],
|
|
26
|
+
python_requires='>=3.8',
|
|
27
|
+
install_requires=[
|
|
28
|
+
"requests",
|
|
29
|
+
],
|
|
30
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from ipay_paymentgateway.gateway import IPayPaymentGateway
|
|
3
|
+
from ompay_paymentgateway import OmpayPaymentGateway
|
|
4
|
+
|
|
5
|
+
class TestIPayPaymentGateway(unittest.TestCase):
|
|
6
|
+
def setUp(self):
|
|
7
|
+
self.gateway = IPayPaymentGateway('test_client_id', 'test_client_secret')
|
|
8
|
+
|
|
9
|
+
def test_get_basic_auth_header(self):
|
|
10
|
+
header = self.gateway._get_basic_auth_header()
|
|
11
|
+
self.assertTrue(header.startswith("Basic "))
|
|
12
|
+
|
|
13
|
+
def test_handle_request(self):
|
|
14
|
+
response = self.gateway._handle_request(self.gateway.session.get, 'https://jsonplaceholder.typicode.com/todos/1')
|
|
15
|
+
self.assertIn('title', response)
|
|
16
|
+
|
|
17
|
+
if __name__ == '__main__':
|
|
18
|
+
unittest.main()
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from ipay_paymentgateway.gateway import IPayPaymentGateway
|
|
3
|
+
from ompay_paymentgateway import OmpayPaymentGateway
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestOrderAPI(unittest.TestCase):
|
|
7
|
+
def setUp(self):
|
|
8
|
+
self.gateway = IPayPaymentGateway('test_client_id', 'test_client_secret')
|
|
9
|
+
self.order_api = self.gateway.order
|
|
10
|
+
|
|
11
|
+
def test_create_order(self):
|
|
12
|
+
order_data = {
|
|
13
|
+
'receiptId': 'RE_DVGSD24535SFGER01',
|
|
14
|
+
'amount': 1,
|
|
15
|
+
'currency': 'INR',
|
|
16
|
+
'description': 'Test Payment',
|
|
17
|
+
'customerFields': {
|
|
18
|
+
'name': 'Madhan R',
|
|
19
|
+
'email': 'madhan.k@ipay.in',
|
|
20
|
+
'phone': '1234567890'
|
|
21
|
+
},
|
|
22
|
+
'uiMode': 'checkout',
|
|
23
|
+
'redirectType': 'redirect'
|
|
24
|
+
}
|
|
25
|
+
response = self.order_api.create_order(order_data)
|
|
26
|
+
self.assertIn('resCode', response)
|
|
27
|
+
|
|
28
|
+
def test_check_status(self):
|
|
29
|
+
response = self.order_api.check_status('invalid_order_id')
|
|
30
|
+
#self.assertIn('resCode', response)
|
|
31
|
+
|
|
32
|
+
if __name__ == '__main__':
|
|
33
|
+
unittest.main()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from ipay_paymentgateway.gateway import IPayPaymentGateway
|
|
3
|
+
from ompay_paymentgateway import OmpayPaymentGateway
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestTransactionAPI(unittest.TestCase):
|
|
7
|
+
def setUp(self):
|
|
8
|
+
self.gateway = IPayPaymentGateway('test_client_id', 'test_client_secret')
|
|
9
|
+
self.transaction_api = self.gateway.transaction
|
|
10
|
+
|
|
11
|
+
def test_transaction_api_initialization(self):
|
|
12
|
+
self.assertIsNotNone(self.transaction_api)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == '__main__':
|
|
16
|
+
unittest.main()
|