Windows-1252-PayPal-Mails verarbeiten
This commit is contained in:
@@ -109,6 +109,28 @@ try {
|
||||
$codeA = 'TXNAUTO' . strtoupper(bin2hex(random_bytes(4)));
|
||||
$mailA = paypal_flow_mail("Erika Musterfrau {$namensSuffix}", '12,50', $codeA, 'Kaffeekasse', '12,15');
|
||||
|
||||
// Outlook/Hotmail liefert weitergeleitete HTML-Mails mitunter als
|
||||
// Windows-1252, obwohl die umgebende Mail UTF-8 behauptet. Der Parser muss
|
||||
// insbesondere Umlaute und das dort einbyteige Eurozeichen konvertieren,
|
||||
// bevor seine Unicode-Regulaerausdruecke laufen.
|
||||
$codeWindows = 'TXNWIN' . strtoupper(bin2hex(random_bytes(4)));
|
||||
$mailWindows = str_replace(
|
||||
'€',
|
||||
'€',
|
||||
paypal_flow_mail('Jürgen Müller', '36,54', $codeWindows, 'Vielen Dank', null)
|
||||
);
|
||||
$mailWindows = (string) iconv('UTF-8', 'Windows-1252//TRANSLIT', $mailWindows);
|
||||
$parsedWindows = paypal_parse_notification($mailWindows);
|
||||
paypal_flow_assert('Windows-1252-Mail wird erkannt', $parsedWindows !== null, $failures, $passes);
|
||||
paypal_flow_assert(
|
||||
'Windows-1252-Mail liefert Name, Betrag und Transaktionscode',
|
||||
($parsedWindows['payer_name'] ?? '') === 'Jürgen Müller'
|
||||
&& ($parsedWindows['net_cents'] ?? 0) === 3654
|
||||
&& ($parsedWindows['transaction_code'] ?? '') === $codeWindows,
|
||||
$failures,
|
||||
$passes
|
||||
);
|
||||
|
||||
// Erst die Vorschau: sie darf nichts anlegen.
|
||||
$vorschau = paypal_process_raw($pdo, $empfaengerA, $mailA, true);
|
||||
paypal_flow_assert('Vorschau meldet die geplante Buchung', ($vorschau['status'] ?? '') === 'would_book', $failures, $passes);
|
||||
|
||||
Reference in New Issue
Block a user