Skip to content

Commit 02be017

Browse files
author
Lung
committed
fixed problematic international QR code payments
1 parent 2dc69cc commit 02be017

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Payment/Payment.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ public function isPaymentOverdue(): bool
6767

6868
public function getQrPaymentString(): string
6969
{
70+
$swiftPart = '';
71+
if ($this->swift !== '') {
72+
$swiftPart = '+' . $this->swift;
73+
}
74+
7075
return
71-
'SPD*1.0*ACC:' . $this->iban . '*'
76+
'SPD*1.0*ACC:' . $this->iban . $swiftPart . '*'
7277
. 'AM:' . $this->price . '*'
7378
. 'CC:' . $this->mapDbCurrencyToIban($this->currency) . '*'
7479
. 'MSG:' . StringUtils::stripDiacritic($this->note) . '*'

tests/Unit/Payment/PaymentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function provideGetQrCode(): array
5656
],
5757
'examplePayment' => [
5858
$examplePayment1,
59-
'SPD*1.0*ACC:CZ2806000000000168540115*AM:450*CC:CZK*MSG:PLATBA ZA ZBOZI*X-KS:0558*X-VS:1234567890'
59+
'SPD*1.0*ACC:CZ2806000000000168540115+SWIFTCODE*AM:450*CC:CZK*MSG:PLATBA ZA ZBOZI*X-KS:0558*X-VS:1234567890'
6060
],
6161
];
6262
}

0 commit comments

Comments
 (0)