Skip to content

Commit c052635

Browse files
committed
Respect coding guidelines
npm run format pre-commit run --all-files Change-Id: I5bda30bc0f3ddb11364d5c16f6a6b9c557d560f6
1 parent 9918bfc commit c052635

File tree

7 files changed

+171
-85
lines changed

7 files changed

+171
-85
lines changed

api/create_checkout.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def parse_args():
3838
global MERCHANT_CODE, AMOUNT_CENTS, RETURN_URL
3939

4040
if len(sys.argv) < 4:
41-
print("Usage: create_checkout.py MERCHANT_CODE AMOUNT_CENTS RETURN_URL", file=sys.stderr)
41+
print(
42+
"Usage: create_checkout.py MERCHANT_CODE AMOUNT_CENTS RETURN_URL",
43+
file=sys.stderr,
44+
)
4245
sys.exit(1)
4346

4447
MERCHANT_CODE = sys.argv[1].strip()
@@ -79,10 +82,8 @@ def main():
7982
"currency": "EUR",
8083
"merchant_code": MERCHANT_CODE,
8184
"description": "Fotobox Ausdruck",
82-
"hosted_checkout": {
83-
"enabled": True
84-
},
85-
"return_url": RETURN_URL
85+
"hosted_checkout": {"enabled": True},
86+
"return_url": RETURN_URL,
8687
}
8788

8889
response = requests.post(url, json=payload, headers=auth_headers(), timeout=30)

api/sumup_solo.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def parse_args():
5252
global MERCHANT_CODE, READER_ID, AFFILIATE_KEY, AMOUNT_CENTS
5353

5454
if len(sys.argv) < 5:
55-
print("Usage: sumup_solo.py MERCHANT READER AFFILIATE AMOUNT_CENTS", file=sys.stderr)
55+
print(
56+
"Usage: sumup_solo.py MERCHANT READER AFFILIATE AMOUNT_CENTS",
57+
file=sys.stderr,
58+
)
5659
sys.exit(1)
5760

5861
MERCHANT_CODE = sys.argv[1].strip()
@@ -114,7 +117,10 @@ def start_checkout():
114117
client_transaction_id = data.get("client_transaction_id")
115118

116119
if not client_transaction_id:
117-
print("ERROR: checkout succeeded but no client_transaction_id returned", file=sys.stderr)
120+
print(
121+
"ERROR: checkout succeeded but no client_transaction_id returned",
122+
file=sys.stderr,
123+
)
118124
return None, checkout_reference
119125

120126
return client_transaction_id, checkout_reference
@@ -170,14 +176,11 @@ def finish_print_job():
170176
print("ERROR: filename missing in JOB_FILE", file=sys.stderr)
171177
return False
172178

173-
cmd = [
174-
"php",
175-
PRINT_SCRIPT,
176-
str(filename),
177-
str(copies)
178-
]
179+
cmd = ["php", PRINT_SCRIPT, str(filename), str(copies)]
179180

180-
result = subprocess.run(cmd, capture_output=True, text=True, cwd="/var/www/html/api")
181+
result = subprocess.run(
182+
cmd, capture_output=True, text=True, cwd="/var/www/html/api"
183+
)
181184

182185
print("PRINT OUTPUT STDOUT:", result.stdout, file=sys.stderr)
183186
print("PRINT OUTPUT STDERR:", result.stderr, file=sys.stderr)

api/webhook_sumup.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
JOB_FILE = "/var/www/html/private/photobooth_current_print.json"
1010
# NEU: Pfad zum neuen Wrapper
11-
PRINT_SCRIPT = "/var/www/html/api/sumup_print_wrapper.php"
11+
PRINT_SCRIPT = "/var/www/html/api/sumup_print_wrapper.php"
1212

1313

1414
@app.route("/sumup/webhook", methods=["POST"])
@@ -45,19 +45,11 @@ def sumup_webhook():
4545

4646
print(f"Starte Druck via Wrapper: {filename} ({copies}x)")
4747

48-
cmd = [
49-
"php",
50-
PRINT_SCRIPT,
51-
str(filename),
52-
str(copies)
53-
]
48+
cmd = ["php", PRINT_SCRIPT, str(filename), str(copies)]
5449

5550
# KORREKTUR: Hinzufügen von cwd="/var/www/html/api" für relative Pfade
5651
result = subprocess.run(
57-
cmd,
58-
capture_output=True,
59-
text=True,
60-
cwd="/var/www/html/api"
52+
cmd, capture_output=True, text=True, cwd="/var/www/html/api"
6153
)
6254

6355
print("PRINT OUTPUT STDOUT:")

assets/js/payment_poll.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
const observer = new MutationObserver(() => {
4242
const overlay = document.querySelector('.overlay');
4343

44-
if (!overlay) { return; }
44+
if (!overlay) {
45+
return;
46+
}
4547

4648
if (overlay.innerHTML.includes('QR') || overlay.innerHTML.includes('bezahlen')) {
4749
startPolling();

assets/js/photoswipe.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ function initPhotoSwipeFromDOM(gallerySelector) {
171171
pswp.on('change', () => {
172172
$('#pswpQR').remove();
173173
const imgName = pswp.currSlide.data.src.split(/[\\/]/).pop();
174-
const qrWrapper = $('<div id="pswpQR"></div>')
175-
.addClass(`pswp-qrcode ${config.qr.pswp}`);
176-
174+
const qrWrapper = $('<div id="pswpQR"></div>').addClass(
175+
`pswp-qrcode ${config.qr.pswp}`
176+
);
177+
177178
const qrImage = $('<img>')
178179
.addClass('pswp-qrcode__image')
179180
.attr('src', `${environment.publicFolders.api}/qrcode.php?filename=${imgName}`)
@@ -257,7 +258,7 @@ function initPhotoSwipeFromDOM(gallerySelector) {
257258
const img = pswp.currSlide.data.src.split(/[\\/]/).pop();
258259
const msg = photoboothTools.getTranslation('really_delete_image');
259260
const really = config.delete.no_request ? true : await photoboothTools.confirm(`${img} ${msg}`);
260-
261+
261262
if (really) {
262263
photoBooth.deleteImage(img, () => {
263264
setTimeout(() => photoboothTools.reloadPage(), config.ui.notification_timeout * 1000);

0 commit comments

Comments
 (0)