add qr_code print
This commit is contained in:
parent
a100af05de
commit
7c2a8eaa25
3 changed files with 159 additions and 2 deletions
|
|
@ -86,6 +86,10 @@ class BookingClient:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = booking.json().get("data", {})
|
data = booking.json().get("data", {})
|
||||||
|
# here
|
||||||
|
order_list_with_qr = booking.json().get("included", [])
|
||||||
|
qr_code=order_list_with_qr[0]["attributes"]["code"]
|
||||||
|
print(qr_code)
|
||||||
print(booking.text)
|
print(booking.text)
|
||||||
except (ValueError, JSONDecodeError):
|
except (ValueError, JSONDecodeError):
|
||||||
if "Bad Request" in booking.text and "400" in booking.text:
|
if "Bad Request" in booking.text and "400" in booking.text:
|
||||||
|
|
@ -110,7 +114,6 @@ class BookingClient:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
customer = checkout.json().get("default", {}).get("customer", {})
|
customer = checkout.json().get("default", {}).get("customer", {})
|
||||||
print(checkout.text)
|
|
||||||
except (ValueError, JSONDecodeError):
|
except (ValueError, JSONDecodeError):
|
||||||
print(f"❌ Invalid JSON response from checkout form: {checkout.text}")
|
print(f"❌ Invalid JSON response from checkout form: {checkout.text}")
|
||||||
# print(f"❌ Invalid JSON response from checkout form: {checkout.text[:200]}")
|
# print(f"❌ Invalid JSON response from checkout form: {checkout.text[:200]}")
|
||||||
|
|
@ -133,7 +136,6 @@ class BookingClient:
|
||||||
)
|
)
|
||||||
|
|
||||||
if final.ok:
|
if final.ok:
|
||||||
print(final.text)
|
|
||||||
print("✅ Reservation successful!")
|
print("✅ Reservation successful!")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
151
formatted_response_data.json
Normal file
151
formatted_response_data.json
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"type": "orders",
|
||||||
|
"id": "58075515",
|
||||||
|
"attributes": {
|
||||||
|
"number": "BO559015923",
|
||||||
|
"currency": "EUR",
|
||||||
|
"total": 0,
|
||||||
|
"modification_total": 0,
|
||||||
|
"net_amount": 0,
|
||||||
|
"tax_amount": 0,
|
||||||
|
"discount_amount": 0,
|
||||||
|
"status": "draft",
|
||||||
|
"access_token": "ykJiydQSaUSVPOyu6e2jfSROdXFIFE",
|
||||||
|
"expires_at": "2026-02-09T23:15:00+00:00",
|
||||||
|
"start_date": null,
|
||||||
|
"end_date": null,
|
||||||
|
"created_at": "2026-02-09T23:00:00+00:00",
|
||||||
|
"updated_at": "2026-02-09T23:00:01+00:00",
|
||||||
|
"custom_entry_map": {}
|
||||||
|
},
|
||||||
|
"relationships": {
|
||||||
|
"bookings": {
|
||||||
|
"links": {
|
||||||
|
"self": "https://b.anny.eu/api/v1/orders/58075515/relationships/bookings"
|
||||||
|
},
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"type": "bookings",
|
||||||
|
"id": "44007384",
|
||||||
|
"meta": {
|
||||||
|
"is_anonymous": false,
|
||||||
|
"has_personalization": false,
|
||||||
|
"personalization_name": null,
|
||||||
|
"sequenced_services_label": null,
|
||||||
|
"booking_group_identifier": "resource:8522-service:601-startDate:2026-02-14T11:00:00+00:00-endDate:2026-02-14T16:30:00+00:00-",
|
||||||
|
"has_custom_description": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"customer": {
|
||||||
|
"links": {
|
||||||
|
"self": "https://b.anny.eu/api/v1/orders/58075515/relationships/customer"
|
||||||
|
},
|
||||||
|
"data": null
|
||||||
|
},
|
||||||
|
"voucher": {
|
||||||
|
"links": {
|
||||||
|
"self": "https://b.anny.eu/api/v1/orders/58075515/relationships/voucher"
|
||||||
|
},
|
||||||
|
"data": null
|
||||||
|
},
|
||||||
|
"sub_orders": {
|
||||||
|
"links": {
|
||||||
|
"self": "https://b.anny.eu/api/v1/orders/58075515/relationships/sub_orders"
|
||||||
|
},
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"type": "orders",
|
||||||
|
"id": "58075551",
|
||||||
|
"meta": {
|
||||||
|
"download_url": "https://b.anny.eu/downloads/order-confirmation/58075551?access_token=aPhgH1ViMvJBi1ayIP1HaHCezjj0q0",
|
||||||
|
"voucher_code": null,
|
||||||
|
"is_base_order": false,
|
||||||
|
"payment_flow": "pay-offline"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"links": {
|
||||||
|
"self": "https://b.anny.eu/api/v1/orders/58075515"
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"download_url": "https://b.anny.eu/downloads/order-confirmation/58075515?access_token=ykJiydQSaUSVPOyu6e2jfSROdXFIFE",
|
||||||
|
"voucher_code": null,
|
||||||
|
"is_base_order": true,
|
||||||
|
"payment_flow": "pay-offline",
|
||||||
|
"pay_now_amount": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"title": "Study Desks | Branch Library Main Campus (Desk No. 18 | on gallery) (Study Desks): 14/02/2026 12:00 - 17:30 (CET)",
|
||||||
|
"quantity": 1,
|
||||||
|
"single_net_amount": 0,
|
||||||
|
"single_gross_amount": 0,
|
||||||
|
"net_amount": 0,
|
||||||
|
"tax_amount": 0,
|
||||||
|
"gross_amount": 0,
|
||||||
|
"tax_rate": 19,
|
||||||
|
"currency": "EUR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vat_breakdown": [
|
||||||
|
{
|
||||||
|
"tax_rate": 19,
|
||||||
|
"net_amount": 0,
|
||||||
|
"tax_amount": 0,
|
||||||
|
"gross_amount": 0,
|
||||||
|
"item_count": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"calculate_from_net": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"included": [
|
||||||
|
{
|
||||||
|
"type": "bookings",
|
||||||
|
"id": "44007384",
|
||||||
|
"attributes": {
|
||||||
|
"number": "BB25204794",
|
||||||
|
"status": "reserved",
|
||||||
|
"is_blocker": false,
|
||||||
|
"start_date": "2026-02-14T11:00:00+00:00",
|
||||||
|
"end_date": "2026-02-14T16:30:00+00:00",
|
||||||
|
"blocker_start_date": "2026-02-14T11:00:00+00:00",
|
||||||
|
"blocker_end_date": "2026-02-14T16:30:00+00:00",
|
||||||
|
"charged_duration": 330,
|
||||||
|
"weight": 1,
|
||||||
|
"is_sequence": false,
|
||||||
|
"price_hidden": true,
|
||||||
|
"visible_for_customer": true,
|
||||||
|
"can_edit": true,
|
||||||
|
"is_own": true,
|
||||||
|
"currency": "EUR",
|
||||||
|
"tax_rate": 19,
|
||||||
|
"total": 0,
|
||||||
|
"is_net_total": false,
|
||||||
|
"code": "!TIX4VWA5JvrbV7Sw7LK",
|
||||||
|
"subtotal": 0,
|
||||||
|
"charged_total": 0,
|
||||||
|
"charged_subtotal": 0,
|
||||||
|
"starting_fee": 0,
|
||||||
|
"description": null,
|
||||||
|
"customer_note": null,
|
||||||
|
"created_at": "2026-02-09T23:00:00+00:00",
|
||||||
|
"canceled_at": null,
|
||||||
|
"check_in_date": null,
|
||||||
|
"check_out_date": null,
|
||||||
|
"custom_entry_map": {},
|
||||||
|
"is_series": false,
|
||||||
|
"is_series_master": false,
|
||||||
|
"series_id": null,
|
||||||
|
"series_type": null
|
||||||
|
},
|
||||||
|
"relationships": {
|
||||||
|
"booking_add_ons": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
4
response_data.json
Normal file
4
response_data.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{"data":{"type":"orders","id":"58075515","attributes":{"number":"BO559015923","currency":"EUR","total":0,"modification_total":0,"net_amount":0,"tax_amount":0,"discount_amount":0,"status":"draft","access_token":"ykJiydQSaUSVPOyu6e2jfSROdXFIFE","expires_at":"2026-02-09T23:15:00+00:00","start_date":null,"end_date":null,"created_at":"2026-02-09T23:00:00+00:00","updated_at":"2026-02-09T23:00:01+00:00","custom_entry_map":{}},"relationships":{"bookings":{"links":{"self":"https:\/\/b.anny.eu\/api\/v1\/orders\/58075515\/relationships\/bookings"},"data":[{"type":"bookings","id":"44007384","meta":{"is_anonymous":false,"has_personalization":false,"personalization_name":null,"sequenced_services_label":null,"booking_group_identifier":"resource:8522-service:601-startDate:2026-02-14T11:00:00+00:00-endDate:2026-02-14T16:30:00+00:00-","has_custom_description":true}}]},"customer":{"links":{"self":"https:\/\/b.anny.eu\/api\/v1\/orders\/58075515\/relationships\/customer"},"data":null},"voucher":{"links":{"self":"https:\/\/b.anny.eu\/api\/v1\/orders\/58075515\/relationships\/voucher"},"data":null},"sub_orders":{"links":{"self":"https:\/\/b.anny.eu\/api\/v1\/orders\/58075515\/relationships\/sub_orders"},"data":[{"type":"orders","id":"58075551","meta":{"download_url":"https:\/\/b.anny.eu\/downloads\/order-confirmation\/58075551?access_token=aPhgH1ViMvJBi1ayIP1HaHCezjj0q0","voucher_code":null,"is_base_order":false,"payment_flow":"pay-offline"}}]}},"links":{"self":"https:\/\/b.anny.eu\/api\/v1\/orders\/58075515"},"meta":{"download_url":"https:\/\/b.anny.eu\/downloads\/order-confirmation\/58075515?access_token=ykJiydQSaUSVPOyu6e2jfSROdXFIFE","voucher_code":null,"is_base_order":true,"payment_flow":"pay-offline","pay_now_amount":0,"items":[{"title":"Study Desks | Branch Library Main Campus (Desk No. 18 | on gallery) (Study Desks): 14\/02\/2026 12:00 - 17:30 (CET)","quantity":1,"single_net_amount":0,"single_gross_amount":0,"net_amount":0,"tax_amount":0,"gross_amount":0,"tax_rate":19,"currency":"EUR"}],"vat_breakdown":[{"tax_rate":19,"net_amount":0,"tax_amount":0,"gross_amount":0,"item_count":1}],"calculate_from_net":false}},"included":[{"type":"bookings","id":"44007384","attributes":{"number":"BB25204794","status":"reserved","is_blocker":false,"start_date":"2026-02-14T11:00:00+00:00","end_date":"2026-02-14T16:30:00+00:00","blocker_start_date":"2026-02-14T11:00:00+00:00","blocker_end_date":"2026-02-14T16:30:00+00:00","charged_duration":330,"weight":1,"is_sequence":false,"price_hidden":true,"visible_for_customer":true,"can_edit":true,"is_own":true,"currency":"EUR","tax_rate":19,"total":0,"is_net_total":false,"code":"!TIX4VWA5JvrbV7Sw7LK","subtotal":0,"charged_total":0,"charged_subtotal":0,"starting_fee":0,"description":null,"customer_note":null,"created_at":"2026-02-09T23:00:00+00:00","canceled_at":null,"check_in_date":null,"check_out_date":null,"custom_entry_map":{},"is_series":false,"is_series_master":false,"series_id":null,"series_type":null},"relationships":{"booking_add_ons":""}}]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue