Skip to content

Commit 17b277e

Browse files
Update Refund API responses (#19)
1 parent ce617e1 commit 17b277e

10 files changed

Lines changed: 848 additions & 943 deletions

File tree

.github/workflows/dev.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: dev workflow
22

33
on:
44
push:
5-
branches: [ master, main ]
5+
branches: [master, main]
66
pull_request:
7-
branches: [ master, main ]
7+
branches: [master, main]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
@@ -13,25 +13,40 @@ jobs:
1313
test:
1414
strategy:
1515
matrix:
16-
python-versions: [3.6, 3.7, 3.8, 3.9]
16+
python-versions: ["3.8", "3.9"]
1717
os: [ubuntu-18.04, macos-latest, windows-latest]
1818
runs-on: ${{ matrix.os }}
1919

2020
steps:
21-
- uses: actions/checkout@v2
22-
- uses: actions/setup-python@v2
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-versions }}
2525

26+
- name: Install Poetry
27+
uses: snok/install-poetry@v1
28+
with:
29+
virtualenvs-create: true
30+
virtualenvs-in-project: true
31+
32+
- name: Load cached venv
33+
id: cached-poetry-dependencies
34+
uses: actions/cache@v3
35+
with:
36+
path: ~/.cache
37+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
38+
2639
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install poetry tox tox-gh-actions
30-
poetry install
40+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
41+
run: poetry install --no-interaction --no-root
42+
43+
- name: Install package
44+
run: poetry install --no-interaction
3145

32-
- name: test with tox
33-
run:
34-
tox
46+
- name: Run tests
47+
run: |
48+
source $VENV
49+
poetry run pytest tests
3550
3651
- name: list files
3752
run: ls -l .

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ repos:
3232
hooks:
3333
- id: mypy
3434
exclude: tests/
35+
args: [--show-error-codes]

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Before you submit a pull request, check that it meets these guidelines:
9595
2. If the pull request adds functionality, the docs should be updated. Put
9696
your new functionality into a function with a docstring, and add the
9797
feature to the list in README.md.
98-
3. The pull request should work for Python 3.6, 3.7, 3.8 and 3.9. Check
98+
3. The pull request should work for Python 3.8 and 3.9. Check
9999
https://github.com/SetuHQ/setu-python-sdk/actions
100100
and make sure that the tests pass for all supported Python versions.
101101

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ try:
114114
),
115115
],
116116
)
117-
assert batch_initiate_refund_response.refunds[0].status == "MarkedForRefund"
117+
assert batch_initiate_refund_response.refunds[0].status == "Pending"
118118
except SetuAPIException as e:
119119
assert False
120120
```

poetry.lock

Lines changed: 805 additions & 918 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ classifiers=[
1313
'License :: OSI Approved :: MIT License',
1414
'Natural Language :: English',
1515
'Programming Language :: Python :: 3',
16-
'Programming Language :: Python :: 3.6',
17-
'Programming Language :: Python :: 3.7',
1816
'Programming Language :: Python :: 3.8',
1917
'Programming Language :: Python :: 3.9',
2018
]
@@ -24,7 +22,7 @@ packages = [
2422
]
2523

2624
[tool.poetry.dependencies]
27-
python = ">=3.6.2,<4.0"
25+
python = ">=3.8.0,<4.0"
2826
PyJWT = "^2.4.0"
2927
requests = "^2.27.1"
3028
marshmallow = "^3.14.1"
@@ -53,11 +51,13 @@ mkdocs-autorefs = "^0.3.1"
5351
pre-commit = "^2.17.0"
5452
toml = "^0.10.2"
5553
bump2version = "^1.0.1"
54+
types-requests = "^2.30.0.0"
55+
types-deprecated = "^1.2.9.2"
5656

5757
[tool.black]
5858
line-length = 120
5959
skip-string-normalization = true
60-
target-version = ['py36', 'py37', 'py38']
60+
target-version = ['py38']
6161
include = '\.pyi?$'
6262
exclude = '''
6363
/(
@@ -86,5 +86,5 @@ skip_gitignore = true
8686
#skip_glob = docs/conf.py
8787

8888
[build-system]
89-
requires = ["poetry-core>=1.0.0"]
89+
requires = ["poetry-core"]
9090
build-backend = "poetry.core.masonry.api"

setu/contract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ class RefundResponseItem:
189189
bill_id: str
190190
transaction_ref_id: str
191191
amount: Amount
192+
type: str
192193
status: str
194+
created_at: datetime
193195
deductions: Optional[List[Deduction]] = None
194196
initiated_at: Optional[datetime] = None
195197

setu/serial.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ class RefundResponseItemSchema(Schema):
175175
transaction_ref_id = fields.Str(data_key="transactionRefID")
176176
amount = fields.Nested(AmountSchema())
177177
status = fields.Str()
178+
type = fields.Str()
178179
deductions = fields.List(fields.Nested(DeductionResponseSchema()), required=False)
180+
created_at = fields.DateTime(data_key="createdAt")
179181
initiated_at = fields.DateTime(data_key="initiatedAt", required=False)
180182

181183
@post_load

setup.cfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@ exclude_lines =
4040

4141
[tox:tox]
4242
isolated_build = true
43-
envlist = py36, py37, py38, py39, format, lint, build
43+
envlist = py38, py39, format, lint, build
4444

4545
[gh-actions]
4646
python =
4747
3.9: py39
4848
3.8: py38, format, lint, build
49-
3.7: py37
50-
3.6: py36
5149

5250
[tool:pytest]
5351
log_cli = True
@@ -62,7 +60,7 @@ setenv =
6260
PYTHONPATH = {toxinidir}
6361
PYTHONWARNINGS = ignore
6462
commands =
65-
pytest --cov=setu --cov-branch --cov-report=xml --cov-report=term-missing tests
63+
pytest --cov-branch --cov-report=xml --cov-report=term-missing tests
6664

6765
[testenv:format]
6866
allowlist_externals =

tests/test_deeplink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_deeplink(v2_creds):
9292
],
9393
)
9494
LOGGER.info(batch_initiate_refund_response)
95-
assert batch_initiate_refund_response.refunds[0].status == "MarkedForRefund"
95+
assert batch_initiate_refund_response.refunds[0].status == "Pending"
9696

9797
# Get refund batch status
9898
refund_batch_status_response = dl.get_batch_refund_status(batch_initiate_refund_response.batch_id)
@@ -107,7 +107,7 @@ def test_deeplink(v2_creds):
107107

108108
refund_batch_status_response = dl.get_refund_status_by_identifier("bill", link.platform_bill_id)
109109
LOGGER.info(refund_batch_status_response)
110-
assert refund_batch_status_response.refunds[0].status == "MarkedForRefund"
110+
assert refund_batch_status_response.refunds[0].status == "Pending"
111111

112112
# Get individual refund status
113113
refund_status_response = dl.get_refund_status(batch_initiate_refund_response.refunds[0].id)

0 commit comments

Comments
 (0)