Skip to content

Commit 33c52d4

Browse files
LuboZlubos.zlatohlavek
andauthored
Python (#3)
* triv: #23799 wip: python documentation * triv: #23799 wip: python documentation - added chargeback and save card section * triv: #23799 wip: python documentation - added preuthorization, updated create payment code * triv: #23799 wip: python documentation - added direct payment section * triv: #23799 added cancel payment section * triv: #23799 code samples and appearance section * triv: #23799 added logger section * triv: #23799 moved redirect uri parameter from client initialization, changed indent in python code * triv: #23799 moved redirect uri parameter from client initialization, changed indent in python code * triv: #23799 added error handling section * triv: #23799 added error handling section * triv: #23799 added full payment to create payment code example * triv: #23799 added ip_address as parameter to create_payment * triv: #23799 renamed simple statuses * triv: #23799 moved base_url from client initialization added mode parameter * triv: #23799 added node logging documentation * triv: #23799 install command --------- Co-authored-by: lubos.zlatohlavek <lubos.zlatohlavek@smartbase.sk>
1 parent f9d47c5 commit 33c52d4

19 files changed

+161
-27
lines changed

code_samples/python/v1.0.0/cancel_payment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from tatrapayplus import TatrapayPlusClient
22

33
client = TatrapayPlusClient(
4-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
54
"your-client-id",
65
"your-client-secret"
76
)

code_samples/python/v1.0.0/chargeback.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
from tatrapayplus.models import *
33

44
client = TatrapayPlusClient(
5-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
65
"your-client-id",
7-
"your-client-secret",
6+
"your-client-secret"
87
)
98
payment_id = "b54afd37-5bb9-4080-9416-5ec450779087"
109
chargeback_data = CardPayUpdateInstruction(

code_samples/python/v1.0.0/confirm_cancel_pre_authorization.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
from tatrapayplus.models import *
33

44
client = TatrapayPlusClient(
5-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
65
"your-client-id",
7-
"your-client-secret",
6+
"your-client-secret"
87
)
98
payment_id = "b54afd37-5bb9-4080-9416-5ec450779087"
109
cancel_pre_authorization_data = CardPayUpdateInstruction(

code_samples/python/v1.0.0/create_payment.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,48 @@
22
from tatrapayplus.models import *
33

44
client = TatrapayPlusClient(
5-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
65
"your-client-id",
76
"your-client-secret",
87
)
98

109
payment_data = InitiatePaymentRequest(
1110
base_payment=BasePayment(
1211
instructed_amount=Amount(
13-
amount_value=120.0,
12+
amount_value=10.0,
1413
currency="EUR",
1514
),
1615
end_to_end="ORDER123456",
1716
),
1817
bank_transfer=BankTransfer(),
18+
pay_later=PayLater(
19+
order=Order(
20+
order_no="ORDER123456",
21+
order_items=[
22+
OrderItem(
23+
quantity=1,
24+
total_item_price=10.0,
25+
item_detail=ItemDetail(
26+
item_detail_sk=ItemDetailLangUnit(
27+
item_name="Testovací produkt",
28+
item_description="Popis produktu",
29+
),
30+
item_detail_en=ItemDetailLangUnit(
31+
item_name="Test Product",
32+
item_description="Product description",
33+
),
34+
),
35+
)
36+
],
37+
),
38+
),
39+
card_detail=CardDetail(
40+
card_holder="Janko Hruška",
41+
),
42+
user_data=UserData(
43+
first_name="Janko",
44+
last_name="Hruska",
45+
email="janko.hruska@example.com",
46+
),
1947
)
2048

21-
response = client.create_payment(payment_data, "https://your-redirect-uri.com")
49+
response = client.create_payment(payment_data, "https://your-redirect-uri.com", "127.0.0.1")

code_samples/python/v1.0.0/create_payment_direct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from tatrapayplus import TatrapayPlusClient
21
from tatrapayplus.models import *
32

43
payment_data = InitiateDirectTransactionRequest(
@@ -50,4 +49,4 @@
5049
),
5150
)
5251

53-
client.create_payment_direct(payment_data, "https://your-redirect-uri.com")
52+
client.create_payment_direct(payment_data, "https://your-redirect-uri.com", "127.0.0.1")

code_samples/python/v1.0.0/create_payment_pre_authorization.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
from tatrapayplus.models import *
33

44
client = TatrapayPlusClient(
5-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
65
"your-client-id",
7-
"your-client-secret"
6+
"your-client-secret",
87
)
98

109
payment_data = InitiatePaymentRequest(
@@ -22,4 +21,4 @@
2221
bank_transfer=BankTransfer(),
2322
)
2423

25-
response = client.create_payment(payment_data, "https://your-redirect-uri.com")
24+
response = client.create_payment(payment_data, "https://your-redirect-uri.com", "127.0.0.1")

code_samples/python/v1.0.0/get_access_token.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from tatrapayplus import TatrapayPlusClient
22

33
client = TatrapayPlusClient(
4-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
54
"your-client-id",
65
"your-client-secret",
76
)

code_samples/python/v1.0.0/get_available_payment_methods.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from tatrapayplus import TatrapayPlusClient, PaymentMethod
22

33
client = TatrapayPlusClient(
4-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
54
"your-client-id",
6-
"your-client-secret"
5+
"your-client-secret",
76
)
87

98
# Get all available payment methods for this transaction
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from tatrapayplus import TatrapayPlusClient
22

33
client = TatrapayPlusClient(
4-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
54
"your-client-id",
6-
"your-client-secret"
5+
"your-client-secret",
76
)
87
payment_id = "b54afd37-5bb9-4080-9416-5ec450779087" # Retrieved from create payment intent
98
payment_status = client.get_payment_status(payment_id)

code_samples/python/v1.0.0/set_colors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from tatrapayplus.models import *
33

44
client = TatrapayPlusClient(
5-
"https://api.tatrabanka.sk/tatrapayplus/sandbox",
65
"your-client-id",
76
"your-client-secret"
87
)

0 commit comments

Comments
 (0)