Skip to content

Commit

Permalink
fix(ZMSKVR-125): cancel email not sending to client in zmscitizenapi (#…
Browse files Browse the repository at this point in the history
…880)

* clean(ZMSKVR): cleanup zmsclient Http request class

* feat(ZMSKVR): refactor citizenapi LoggerService to use zmsslim monolog

* fix(ZMSKVR-125): sending cancel appointment email sender address

* clean(ZMSKVR-125): remove error_logs

* fix(ZMSKVR-125): formatting

* clean(ZMSKVR-125): tpying and duplicate code line

---------

Co-authored-by: Thomas Fink <[email protected]>
  • Loading branch information
ThomasAFink and Thomas Fink authored Feb 17, 2025
1 parent 4f6155a commit 972ed05
Show file tree
Hide file tree
Showing 56 changed files with 403 additions and 396 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ To run Checks locally in your local docker container:

0. Run all at once:
- `ddev exec "./cli modules loop 'vendor/bin/phpcs --standard=psr12 src/'"`
- `ddev exec "./cli modules loop 'vendor/bin/phpcbf --standard=psr12 src/'"`

1. **Enter the container** (if using DDEV or Docker):
- `ddev ssh`
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Collection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 0 additions & 1 deletion mellon/src/Mellon/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
class Condition
{

protected $collection = [];

public function __construct(Valid ...$validList)
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/Message.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/MessageList.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/Parameter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -12,7 +13,6 @@
*/
abstract class Parameter
{

/**
* value of parameter
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Unvalidated.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/Valid.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -13,7 +14,6 @@
*/
class Valid extends \BO\Mellon\Parameter
{

/**
* validation errors
*
Expand Down
5 changes: 3 additions & 2 deletions mellon/src/Mellon/ValidArray.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidArray extends \BO\Mellon\Valid
{

/**
* Allow native arrays anc class replacements
*
Expand All @@ -21,7 +21,8 @@ class ValidArray extends \BO\Mellon\Valid
*/
public function isArray($message = 'no valid array')
{
if (is_array($this->value)
if (
is_array($this->value)
|| (
$this->value instanceof \Traversable
&& $this->value instanceof \Countable
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidBool.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidBool extends Valid
{

/**
* Allow only boolean values like
* Allowed values are:
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidDate.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
5 changes: 3 additions & 2 deletions mellon/src/Mellon/ValidDatetime.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/

namespace BO\Mellon;

use \DateTimeImmutable;
use \DateTime;
use DateTimeImmutable;
use DateTime;

class ValidDatetime extends Valid
{
Expand Down
4 changes: 3 additions & 1 deletion mellon/src/Mellon/ValidFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down Expand Up @@ -44,7 +45,8 @@ public function isFile($name = 'fileupload', $message = 'No valid file found.')
public function hasType($type = 'jpeg', $message = 'Invalid file type.')
{
if (isset($_FILES[$this->fileName])) {
if ((! empty($_FILES[$this->fileName]["type"])) &&
if (
(! empty($_FILES[$this->fileName]["type"])) &&
($_FILES[$this->fileName]['type'] != $this->acceptableTypes[$type])
) {
$this->setFailure($message);
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidJson.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -14,7 +15,6 @@
*/
class ValidJson extends Valid
{

protected $originalJsonString = null;
protected $defaultJsonString = '{}';

Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidMail.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidNumber.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidNumber extends Valid
{

/**
* Allow only integer numbers
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidPath.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidString.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidString extends Valid
{

/**
* Allow strings smaller than 64kb and do htmlspecialchars()
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidUrl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidationException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Validator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/ProcessConfirmationMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProcessConfirmationMail extends BaseController
{
/**
* @SuppressWarnings(Param)
* @return String
* @return string
*/
public function readResponse(
\Psr\Http\Message\RequestInterface $request,
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/ProcessDeleteMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProcessDeleteMail extends BaseController
{
/**
* @SuppressWarnings(Param)
* @return String
* @return string
*/
public function readResponse(
\Psr\Http\Message\RequestInterface $request,
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/ProcessPreconfirmationMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProcessPreconfirmationMail extends BaseController
{
/**
* @SuppressWarnings(Param)
* @return String
* @return string
*/
public function readResponse(
\Psr\Http\Message\RequestInterface $request,
Expand Down
31 changes: 20 additions & 11 deletions zmscitizenapi/src/Zmscitizenapi/Models/ThinnedScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@
class ThinnedScope extends Entity implements JsonSerializable
{
public static $schema = 'citizenapi/thinnedScope.json';
/** @var int */
/** @var int */
public int $id;
/** @var ThinnedProvider|null */
/** @var ThinnedProvider|null */
public ?ThinnedProvider $provider;
/** @var string|null */
/** @var string|null */
public ?string $shortName;
/** @var bool|null */
/** @var string|null */
public ?string $emailFrom;
/** @var bool|null */
public ?bool $telephoneActivated;
/** @var bool|null */
/** @var bool|null */
public ?bool $telephoneRequired;
/** @var bool|null */
/** @var bool|null */
public ?bool $customTextfieldActivated;
/** @var bool|null */
/** @var bool|null */
public ?bool $customTextfieldRequired;
/** @var string|null */
/** @var string|null */
public ?string $customTextfieldLabel;
/** @var bool|null */
/** @var bool|null */
public ?bool $captchaActivatedRequired;
/** @var string|null */
/** @var string|null */
public ?string $displayInfo;
public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?string $shortName = null, ?bool $telephoneActivated = null, ?bool $telephoneRequired = null, ?bool $customTextfieldActivated = null, ?bool $customTextfieldRequired = null, ?string $customTextfieldLabel = null, ?bool $captchaActivatedRequired = null, ?string $displayInfo = null)
public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?string $shortName = null, ?string $emailFrom = null, ?bool $telephoneActivated = null, ?bool $telephoneRequired = null, ?bool $customTextfieldActivated = null, ?bool $customTextfieldRequired = null, ?string $customTextfieldLabel = null, ?bool $captchaActivatedRequired = null, ?string $displayInfo = null)
{
$this->id = $id;
$this->provider = $provider;
$this->shortName = $shortName;
$this->emailFrom = $emailFrom;
$this->telephoneActivated = $telephoneActivated;
$this->telephoneRequired = $telephoneRequired;
$this->customTextfieldActivated = $customTextfieldActivated;
Expand Down Expand Up @@ -64,6 +67,11 @@ public function getShortName(): ?string
return $this->shortName;
}

public function getEmailFrom(): ?string
{
return $this->emailFrom;
}

public function getTelephoneActivated(): ?bool
{
return $this->telephoneActivated;
Expand Down Expand Up @@ -105,6 +113,7 @@ public function toArray(): array
'id' => $this->id,
'provider' => $this->provider,
'shortName' => $this->shortName,
'emailFrom' => $this->emailFrom,
'telephoneActivated' => $this->telephoneActivated,
'telephoneRequired' => $this->telephoneRequired,
'customTextfieldActivated' => $this->customTextfieldActivated,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function processCancel(array $body): ThinnedProcess|array
]];
}

// Send cancellation email before cancelling the appointment
$this->sendCancellationEmail($process);
return $this->cancelProcess($process);
}
Expand Down Expand Up @@ -80,6 +79,6 @@ private function cancelProcess(ThinnedProcess $process): ThinnedProcess|array
private function sendCancellationEmail(ThinnedProcess $process): void
{
$processEntity = MapperService::thinnedProcessToProcess($process);
ZmsApiFacadeService::sendCancelationEmail($processEntity);
ZmsApiFacadeService::sendCancellationEmail($processEntity);
}
}
Loading

0 comments on commit 972ed05

Please sign in to comment.