Skip to content

Commit 3492c97

Browse files
author
bitbucket-pipelines
committed
Generating Python SDK.
1 parent 4e4d008 commit 3492c97

File tree

856 files changed

+53067
-42541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

856 files changed

+53067
-42541
lines changed

.github/workflows/python.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5+
6+
name: cashfree_pg Python package
7+
8+
on: [push, pull_request]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -r requirements.txt
31+
pip install -r test-requirements.txt
32+
- name: Test with pytest
33+
run: |
34+
pytest --cov=cashfree_pg

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,5 @@ docs/_build/
6262
# PyBuilder
6363
target/
6464

65-
#Ipython Notebook
65+
# Ipython Notebook
6666
.ipynb_checkpoints
67-
68-
cashfree_pg/api
69-
.DS_Store
70-
__init__.py
71-
api_client.py
72-
api_response.py
73-
docs/

.gitlab-ci.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ stages:
1414
- pip install -r test-requirements.txt
1515
- pytest --cov=cashfree_pg
1616

17-
pytest-3.7:
17+
pytest-3.9:
1818
extends: .pytest
19-
image: python:3.7-alpine
20-
pytest-3.8:
19+
image: python:3.9-alpine
20+
pytest-3.10:
2121
extends: .pytest
22-
image: python:3.8-alpine
23-
pytest-3.9:
22+
image: python:3.10-alpine
23+
pytest-3.11:
24+
extends: .pytest
25+
image: python:3.11-alpine
26+
pytest-3.12:
27+
extends: .pytest
28+
image: python:3.12-alpine
29+
pytest-3.13:
2430
extends: .pytest
25-
image: python:3.9-alpine
31+
image: python:3.13-alpine

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.0.0
1+
7.18.0

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# ref: https://docs.travis-ci.com/user/languages/python
22
language: python
33
python:
4-
- "3.7"
5-
- "3.8"
64
- "3.9"
75
- "3.10"
86
- "3.11"
7+
- "3.12"
8+
- "3.13"
99
# uncomment the following if needed
10-
#- "3.11-dev" # 3.11 development branch
10+
#- "3.13-dev" # 3.13 development branch
1111
#- "nightly" # nightly build
1212
# command to install dependencies
1313
install:

README.md

Lines changed: 89 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Cashfree PG Python SDK
2-
![GitHub](https://img.shields.io/github/license/cashfree/cashfree-pg-sdk-python) ![Discord](https://img.shields.io/discord/931125665669972018?label=discord) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/cashfree/cashfree-pg-sdk-python/master) ![GitHub release (with filter)](https://img.shields.io/github/v/release/cashfree/cashfree-pg-sdk-python?label=latest) ![GitHub forks](https://img.shields.io/github/forks/cashfree/cashfree-pg-sdk-python) ![Order Create API Order Create API](https://statuspage.cashfree.com/badge/pg-create-order-api/status)
1+
# Cashfree PG Node SDK
2+
![GitHub](https://img.shields.io/github/license/cashfree/cashfree-pg-sdk-nodejs) ![Discord](https://img.shields.io/discord/931125665669972018?label=discord) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/cashfree/cashfree-pg-sdk-nodejs/main) ![GitHub release (with filter)](https://img.shields.io/github/v/release/cashfree/cashfree-pg-sdk-nodejs?label=latest) ![npm](https://img.shields.io/npm/v/cashfree-pg) ![GitHub forks](https://img.shields.io/github/forks/cashfree/cashfree-pg-sdk-nodejs) [![Coverage Status](https://coveralls.io/repos/github/cashfree/cashfree-pg-sdk-nodejs/badge.svg?branch=)](https://coveralls.io/github/cashfree/cashfree-pg-sdk-nodejs?branch=main)
33

4-
The Cashfree PG Python SDK offers a convenient solution to access [Cashfree PG APIs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) from a server-side Go applications.
4+
The Cashfree PG Node SDK offers a convenient solution to access [Cashfree PG APIs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) from a server-side JavaScript applications.
55

66

77

@@ -17,44 +17,103 @@ Try out our interactive guides at [Cashfree Dev Studio](https://www.cashfree.com
1717

1818
### Installation
1919
```bash
20-
pip install cashfree_pg
20+
npm i cashfree-pg
2121
```
2222
### Configuration
2323

24-
```python
25-
from cashfree_pg.models.create_order_request import CreateOrderRequest
26-
from cashfree_pg.api_client import Cashfree
27-
from cashfree_pg.models.customer_details import CustomerDetails
28-
from cashfree_pg.models.order_meta import OrderMeta
24+
## Version >=5
2925

30-
Cashfree.XClientId = "<x-client-id>"
31-
Cashfree.XClientSecret = "<x-client-secret>"
32-
Cashfree.XEnvironment = Cashfree.SANDBOX
33-
x_api_version = "2023-08-01"
26+
```javascript
27+
import { Cashfree } from "cashfree-pg";
28+
29+
var cashfree = new Cashfree(Cashfree.SANDBOX, "<x-client-id>", "<x-client-secret>")
3430
```
3531

3632
Generate your API keys (x-client-id , x-client-secret) from [Cashfree Merchant Dashboard](https://merchant.cashfree.com/merchants/login)
3733

3834
### Basic Usage
3935
Create Order
40-
```python
41-
customerDetails = CustomerDetails(customer_id="walterwNrcMi", customer_phone="9999999999")
42-
orderMeta = OrderMeta(return_url="https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}")
43-
createOrderRequest = CreateOrderRequest(order_amount=1, order_currency="INR", customer_details=customerDetails, order_meta=orderMeta)
44-
try:
45-
api_response = Cashfree().PGCreateOrder(x_api_version, createOrderRequest, None, None)
46-
print(api_response.data)
47-
except Exception as e:
48-
print(e)
36+
```javascript
37+
var request = {
38+
"order_amount": 1,
39+
"order_currency": "INR",
40+
"order_id": "order_34692745",
41+
"customer_details": {
42+
"customer_id": "walterwNrcMi",
43+
"customer_phone": "9999999999"
44+
},
45+
"order_meta": {
46+
"return_url": "https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}"
47+
}
48+
};
49+
Cashfree.PGCreateOrder(request).then((response) => {
50+
console.log('Order Created successfully:',response.data)
51+
}).catch((error) => {
52+
console.error('Error:', error.response.data.message);
53+
});
4954
```
5055

5156
Get Order
52-
```python
53-
try:
54-
api_response = Cashfree().PGFetchOrder(x_api_version, "order_3242X4jQ5f0S9KYxZO9mtDL1Kx2Y7u", None)
55-
print(api_response.data)
56-
except Exception as e:
57-
print(e)
57+
```javascript
58+
Cashfree.PGFetchOrder("<order_id>").then((response) => {
59+
console.log('Order fetched successfully:', response.data);
60+
}).catch((error) => {
61+
console.error('Error:', error.response.data.message);
62+
});
63+
```
64+
65+
## Version <5
66+
67+
```javascript
68+
import { Cashfree } from "cashfree-pg";
69+
70+
Cashfree.XClientId = "<x-client-id>";
71+
Cashfree.XClientSecret = "<x-client-secret>";
72+
Cashfree.XEnvironment = Cashfree.Environment.SANDBOX;
73+
```
74+
75+
Generate your API keys (x-client-id , x-client-secret) from [Cashfree Merchant Dashboard](https://merchant.cashfree.com/merchants/login)
76+
77+
### Basic Usage
78+
Create Order
79+
```javascript
80+
var request = {
81+
"order_amount": 1,
82+
"order_currency": "INR",
83+
"order_id": "order_34692745",
84+
"customer_details": {
85+
"customer_id": "walterwNrcMi",
86+
"customer_phone": "9999999999"
87+
},
88+
"order_meta": {
89+
"return_url": "https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}"
90+
}
91+
};
92+
Cashfree.PGCreateOrder("2023-08-01", request).then((response) => {
93+
console.log('Order Created successfully:',response.data)
94+
}).catch((error) => {
95+
console.error('Error:', error.response.data.message);
96+
});
97+
```
98+
99+
Get Order
100+
```javascript
101+
Cashfree.PGFetchOrder("2023-08-01", "<order_id>").then((response) => {
102+
console.log('Order fetched successfully:', response.data);
103+
}).catch((error) => {
104+
console.error('Error:', error.response.data.message);
105+
});
106+
```
107+
108+
Validate Webhook
109+
```javascript
110+
app.post('/webhook', function (req, res) {
111+
try {
112+
Cashfree.PGVerifyWebhookSignature(req.headers["x-webhook-signature"], req.rawBody, req.headers["x-webhook-timestamp"]);
113+
} catch (err) {
114+
console.log(err.message)
115+
}
116+
})
58117
```
59118

60119
## Supported Resources
@@ -73,10 +132,9 @@ except Exception as e:
73132

74133
- [Settlements](docs/Settlements.md)
75134

76-
- [Reconciliation](docs/Reconciliation.md)
77-
78-
- [Webhook](docs/Webhook.md)
135+
- [Offers](docs/Offers.md)
79136

137+
- [Reconciliation](docs/Reconciliation.md)
80138

81139
## Licence
82140

0 commit comments

Comments
 (0)