Skip to content

Commit 252f886

Browse files
committed
digital card updates + make commands
1 parent bb2a1f3 commit 252f886

Some content is hidden

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

60 files changed

+952
-377
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ jobs:
7676
- name: Run Ruff
7777
run: uv run ruff check
7878

79+
- name: Run Black
80+
run: uv run black . --check
81+
7982
- name: Run Pytests
8083
run: uv run pytest tests
8184

.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.9.4
3+
rev: v0.11.9
44
hooks:
55
- id: ruff
66
name: ruff
77
language: python
88
args: [ --fix ]
99
- id: ruff-format
10+
- repo: https://github.com/psf/black
11+
rev: 25.1.0
12+
hooks:
13+
- id: black
14+
name: black
15+
args:
16+
- .
17+
- --check
1018
- repo: https://github.com/astral-sh/uv-pre-commit
11-
rev: 0.5.29
19+
rev: 0.7.3
1220
hooks:
1321
- id: uv-lock
14-
- id: uv-export
22+
- id: uv-export

Makefile

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
.PHONY: tests, uvrr, uvrr-check, uvrr-format, uvr-floats-check-floats, uvr-floats-transfer
1+
.PHONY: uvr-black-check, uvr-black-format, uvr-coverage, uvr-tests, uvrr, uvrr-check, uvrr-format, uvr-floats-check-floats, uvr-floats-transfer
22

33
all: help
44

5-
tests:
6-
uv run pytests tests
5+
uvrr: uvrr-check uvrr-format uvr-black-format uvr-tests
76

8-
uvrr: uvrr-check uvrr-format
7+
uvr-tests:
8+
uv run pytest .
99

1010
uvrr-check:
11-
uv run ruff check .
11+
uv run ruff check . --fix
1212

1313
uvrr-format:
1414
uv run ruff format
@@ -19,10 +19,23 @@ uvr-floats-check-floats:
1919
uvr-floats-request-transfer:
2020
uv run examples/floats/request_payment_transfer.py
2121

22+
uvr-coverage:
23+
uv run coverage run -m pytest & uv run coverage run report
24+
25+
uvr-black-check:
26+
uv run black . --check --diff
27+
28+
uvr-black-format:
29+
uv run black . --diff
30+
2231
help:
2332
@echo "Run UV:"
24-
@echo " uvrr-check - uv run ruff check - Ruff Check"
25-
@echo " uvrr-format - uv run ruff format - Ruff Format"
33+
@echo " uvrr-check - uv run ruff check - Ruff Check"
34+
@echo " uvrr-format - uv run ruff format - Ruff Format"
35+
@echo " uvrp-tests - uv run pytest - Tests"
36+
@echo "Run Black:"
37+
@echo " uvrb-check - uv run black . --diff"
38+
@echo " uvrb-format - uv run black . --check --diff"
2639
@echo "Available requests:"
2740
@echo " uvr-floats-check-floats - Run examples/floats/check_floats.py (Tillo V2 GET - api/v2/float/check-floats)"
2841
@echo " uvr-floats-transfer - Run examples/floats/request_payment_transfer.py (Tillo V2 POST - api/v2/float/request-payment-transfer)"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import asyncio
2+
3+
from jpy_tillo_sdk import tillo
4+
from jpy_tillo_sdk.domain.physical_card.factory import (
5+
create_cancel_top_up_physical_card_request,
6+
)
7+
from jpy_tillo_sdk.enums import Currency, Sector
8+
9+
TILLO_HOST = ""
10+
TILLO_API_KEY = ""
11+
TILLO_SECRET = ""
12+
TILLO_HTTP_CLIENT_OPTIONS = {}
13+
14+
15+
def cancel_digital_code():
16+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
17+
18+
body = create_cancel_top_up_physical_card_request(
19+
client_request_id="test",
20+
original_client_request_id="origin",
21+
brand="test",
22+
code="test",
23+
pin="100",
24+
currency=Currency.EUR,
25+
sector=Sector.GIFT_CARD_MALL,
26+
amount="100",
27+
)
28+
29+
response = client.digital_card.cancel_digital_code(body=body)
30+
31+
print(response.text)
32+
33+
34+
cancel_digital_code()
35+
36+
37+
async def cancel_digital_code_async():
38+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
39+
40+
body = create_cancel_top_up_physical_card_request(
41+
client_request_id="test",
42+
original_client_request_id="origin",
43+
brand="test",
44+
code="test",
45+
pin="100",
46+
currency=Currency.EUR,
47+
sector=Sector.GIFT_CARD_MALL,
48+
amount="100",
49+
)
50+
51+
response = await client.digital_card_async.cancel_digital_code(body=body)
52+
53+
print(response.text)
54+
55+
56+
asyncio.run(cancel_digital_code_async())
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import asyncio
2+
3+
from jpy_tillo_sdk import tillo
4+
from jpy_tillo_sdk.domain.physical_card.factory import (
5+
create_cancel_top_up_physical_card_request,
6+
)
7+
from jpy_tillo_sdk.enums import Currency, Sector
8+
9+
TILLO_HOST = ""
10+
TILLO_API_KEY = ""
11+
TILLO_SECRET = ""
12+
TILLO_HTTP_CLIENT_OPTIONS = {}
13+
14+
15+
def cancel_digital_url():
16+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
17+
18+
body = create_cancel_top_up_physical_card_request(
19+
client_request_id="test",
20+
original_client_request_id="origin",
21+
brand="test",
22+
code="test",
23+
pin="100",
24+
currency=Currency.EUR,
25+
sector=Sector.GIFT_CARD_MALL,
26+
amount="100",
27+
)
28+
29+
response = client.digital_card.cancel_digital_url(body=body)
30+
31+
print(response.text)
32+
33+
34+
cancel_digital_url()
35+
36+
37+
async def cancel_digital_url_async():
38+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
39+
40+
body = create_cancel_top_up_physical_card_request(
41+
client_request_id="test",
42+
original_client_request_id="origin",
43+
brand="test",
44+
code="test",
45+
pin="100",
46+
currency=Currency.EUR,
47+
sector=Sector.GIFT_CARD_MALL,
48+
amount="100",
49+
)
50+
51+
response = await client.digital_card_async.cancel_digital_url(body=body)
52+
53+
print(response.text)
54+
55+
56+
asyncio.run(cancel_digital_url_async())
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import asyncio
2+
3+
from jpy_tillo_sdk import tillo
4+
from jpy_tillo_sdk.domain.physical_card.factory import create_balance_check_request
5+
from jpy_tillo_sdk.enums import Currency, Sector
6+
7+
TILLO_HOST = ""
8+
TILLO_API_KEY = ""
9+
TILLO_SECRET = ""
10+
TILLO_HTTP_CLIENT_OPTIONS = {}
11+
12+
13+
def check_balance():
14+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
15+
16+
body = create_balance_check_request(
17+
client_request_id="test",
18+
brand="test",
19+
code="test",
20+
pin="100",
21+
currency=Currency.EUR,
22+
sector=Sector.GIFT_CARD_MALL,
23+
)
24+
25+
response = client.digital_card.check_balance(body=body)
26+
27+
print(response.text)
28+
29+
30+
check_balance()
31+
32+
33+
async def check_balance_async():
34+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
35+
36+
body = create_balance_check_request(
37+
client_request_id="test",
38+
brand="test",
39+
code="test",
40+
pin="100",
41+
currency=Currency.EUR,
42+
sector=Sector.GIFT_CARD_MALL,
43+
)
44+
45+
response = await client.digital_card_async.check_balance(body=body)
46+
47+
print(response.text)
48+
49+
50+
asyncio.run(check_balance_async())
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import asyncio
2+
3+
from jpy_tillo_sdk import tillo
4+
5+
TILLO_HOST = ""
6+
TILLO_API_KEY = ""
7+
TILLO_SECRET = ""
8+
TILLO_HTTP_CLIENT_OPTIONS = {}
9+
10+
11+
def check_digital_order_status():
12+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
13+
14+
response = client.digital_card.check_digital_order(query_params={"reference": "ref"})
15+
16+
print(response.text)
17+
18+
19+
check_digital_order_status()
20+
21+
22+
async def check_digital_order_status_async():
23+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
24+
25+
response = await client.digital_card_async.check_digital_order(query_params={"reference": "ref"})
26+
27+
print(response.text)
28+
29+
30+
asyncio.run(check_digital_order_status_async())
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import asyncio
2+
3+
from jpy_tillo_sdk import tillo
4+
5+
TILLO_HOST = ""
6+
TILLO_API_KEY = ""
7+
TILLO_SECRET = ""
8+
TILLO_HTTP_CLIENT_OPTIONS = {}
9+
10+
11+
def check_stock():
12+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
13+
14+
response = client.digital_card.check_stock()
15+
16+
print(response.text)
17+
18+
19+
check_stock()
20+
21+
22+
async def check_stock_async():
23+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
24+
25+
response = await client.digital_card_async.check_stock()
26+
27+
print(response.text)
28+
29+
30+
asyncio.run(check_stock_async())

examples/digital_card/issue_digital_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def issue_digital_code_async():
4141
amount="10",
4242
)
4343

44-
response = client.digital_card.issue_digital_code(body=body)
44+
response = await client.digital_card_async.issue_digital_code(body=body)
4545

4646
print(response.text)
4747

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import asyncio
2+
import uuid
3+
4+
from jpy_tillo_sdk import tillo
5+
from jpy_tillo_sdk.domain.digital_card.factory import (
6+
create_standard_issue_request,
7+
)
8+
from jpy_tillo_sdk.enums import Currency
9+
10+
TILLO_HOST = ""
11+
TILLO_API_KEY = ""
12+
TILLO_SECRET = ""
13+
TILLO_HTTP_CLIENT_OPTIONS = {}
14+
15+
16+
def issue_digital_code():
17+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
18+
19+
body = create_standard_issue_request(
20+
client_request_id=str(uuid.uuid4()),
21+
brand="costa",
22+
currency=Currency.GBP,
23+
amount="10",
24+
)
25+
26+
response = client.digital_card.issue_digital_code(body=body)
27+
28+
print(response.text)
29+
30+
31+
issue_digital_code()
32+
33+
34+
async def issue_digital_code_async():
35+
client = tillo.Tillo(TILLO_API_KEY, TILLO_SECRET, TILLO_HTTP_CLIENT_OPTIONS)
36+
37+
body = create_standard_issue_request(
38+
client_request_id=str(uuid.uuid4()),
39+
brand="costa",
40+
currency=Currency.GBP,
41+
amount="10",
42+
)
43+
44+
response = await client.digital_card_async.order_digital_code(body=body)
45+
46+
print(response.text)
47+
48+
49+
asyncio.run(issue_digital_code_async())

0 commit comments

Comments
 (0)