Skip to content

Commit

Permalink
Email address should now be mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
LuomaJuha committed Jul 10, 2023
1 parent 6319915 commit a57620e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions local/languages/finna/Payment/en-gb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Contact Information = "Contact information"
Date = "Date"
Details = "Details"
download_transaction_breakdown_pdf = "Download receipt (PDF)"
email_address_missing = "Email address is missing"
email_hello = "Hello %%firstname%%"
email_receipt_message = "A receipt for your payment is attached as a PDF file."
Excluding VAT = "Excluding VAT"
Expand Down
1 change: 1 addition & 0 deletions local/languages/finna/Payment/fi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Contact Information = "Yhteystiedot"
Date = "Päivämäärä"
Details = "Tiedot"
download_transaction_breakdown_pdf = "Lataa kuitti (PDF)"
email_address_missing = "Sähköpostiosoite puuttuu"
email_hello = "Hei %%firstname%%"
email_receipt_message = "Ohessa on kuitti maksustasi PDF-muodossa."
Excluding VAT = "Veroton"
Expand Down
1 change: 1 addition & 0 deletions local/languages/finna/Payment/sv.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Contact Information = "Kontaktinformation"
Date = "Datum"
Details = "Detaljer"
download_transaction_breakdown_pdf = "Ladda ner kvitto (PDF)"
email_address_missing = "E-postadress saknas"
email_hello = "Hej %%firstname%%"
email_receipt_message = "Ett kvitto på din betalning är bifogad som en PDF-fil."
Excluding VAT = "Exklusive moms"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace Finna\OnlinePayment\Handler;

use Finna\OnlinePayment\Handler\Connector\Paytrail\PaytrailPaymentAPI\Customer;
use Paytrail\SDK\Model\Customer;
use Finna\OnlinePayment\Handler\Connector\TurkuPaymentAPI\Client;
use Finna\OnlinePayment\Handler\Connector\TurkuPaymentAPI\Item;
use Finna\OnlinePayment\Handler\Connector\TurkuPaymentAPI\PaymentRequest;
Expand Down Expand Up @@ -111,7 +111,7 @@ public function startPayment(
// Use email from the ILS as default and use the one stored in Finna as a
// fallback:
$customer = (new Customer())
->setEmail(trim(($patron['email'] ?? '') ?: $user->email));
->setEmail(trim(($patron['email'] ?? '') ?: trim($user->email)));

$language = $this->languageMap[$this->getCurrentLanguageCode()] ?? 'FI';
$sapOrganization = [
Expand Down Expand Up @@ -223,6 +223,9 @@ public function startPayment(
'exception sending payment: ' . $e->getMessage(),
compact('user', 'patron', 'fines', 'request')
);
if (mb_strtolower($e->getMessage()) === 'email is empty') {
return 'Payment::email_address_missing';
}
return '';
}

Expand Down

0 comments on commit a57620e

Please sign in to comment.