generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,195 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
250 changes: 250 additions & 0 deletions
250
src/src/crawler/events/req/pspInviaCarrelloRPTCarte.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
<?php | ||
|
||
namespace pagopa\crawler\events\req; | ||
|
||
use pagopa\crawler\AbstractEvent; | ||
use pagopa\crawler\MapEvents; | ||
use pagopa\crawler\methods\MethodInterface; | ||
use pagopa\database\sherlock\Transaction; | ||
use pagopa\database\sherlock\TransactionDetails; | ||
use pagopa\database\sherlock\Workflow; | ||
use pagopa\crawler\methods\req\pspInviaCarrelloRPTCarte as Payload; | ||
|
||
class pspInviaCarrelloRPTCarte extends AbstractEvent | ||
{ | ||
|
||
protected Payload $method; | ||
|
||
protected bool $isCart = true; | ||
|
||
|
||
public function __construct(array $eventData) | ||
{ | ||
parent::__construct($eventData); | ||
$this->method = new Payload($this->data['payload']); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPaEmittente(int $index = 0): string|null | ||
{ | ||
return $this->getMethodInterface()->getPaEmittente($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getIuv(int $index = 0): string|null | ||
{ | ||
return $this->getMethodInterface()->getIuv($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCcp(int $index = 0): string|null | ||
{ | ||
return $this->getMethodInterface()->getCcp($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getNoticeNumber(int $index = 0): string|null | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCreditorReferenceId(int $index = 0): string|null | ||
{ | ||
return $this->getMethodInterface()->getIuv($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPaymentToken(int $index = 0): string|null | ||
{ | ||
return $this->getCcp($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getIuvs(): array|null | ||
{ | ||
return $this->getMethodInterface()->getIuvs(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPaEmittenti(): array|null | ||
{ | ||
return $this->getMethodInterface()->getPaEmittenti(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCcps(): array|null | ||
{ | ||
return $this->getMethodInterface()->getCcps(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPsp(): string|null | ||
{ | ||
return $this->getMethodInterface()->getPsp(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getStazione(): string|null | ||
{ | ||
return null; | ||
} | ||
|
||
public function getCanale(): string|null | ||
{ | ||
$canale = $this->getColumn('canale'); | ||
if (empty($canale)) | ||
{ | ||
return $this->getMethodInterface()->getCanale(); | ||
} | ||
return $canale; | ||
} | ||
|
||
public function getBrokerPa(): string|null | ||
{ | ||
return null; | ||
} | ||
|
||
public function getBrokerPsp(): string|null | ||
{ | ||
$broker = $this->getColumn('canale'); | ||
if (empty($broker)) | ||
{ | ||
return $this->getMethodInterface()->getBrokerPsp(); | ||
} | ||
$e = explode('_', $broker, 2); | ||
return $e[0]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function transaction(int $index = 0): Transaction|null | ||
{ | ||
return null; | ||
} | ||
|
||
public function transactionDetails(int $transfer, int $index = 0): TransactionDetails|null | ||
{ | ||
return null; | ||
} | ||
|
||
public function workflowEvent(int $index = 0): Workflow|null | ||
{ | ||
if (($index + 1) > $this->getPaymentsCount()) | ||
{ | ||
return null; | ||
} | ||
|
||
$workflow = new Workflow($this->getInsertedTimestamp()); | ||
$workflow->setNewColumnValue('date_event', $this->getInsertedTimestamp()->format('Y-m-d')); | ||
$workflow->setEventId($this->getUniqueId()); | ||
$workflow->setEventTimestamp($this->getInsertedTimestamp()); | ||
if (!is_null($this->getCanale())) | ||
{ | ||
$workflow->setCanale($this->getCanale()); | ||
} | ||
if (!is_null($this->getPsp())) | ||
{ | ||
$workflow->setPsp($this->getPsp()); | ||
} | ||
$workflow->setFkTipoEvento(MapEvents::getMethodId($this->getTipoEvento(), $this->getSottoTipoEvento())); | ||
return $workflow; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getMethodInterface(): Payload | ||
{ | ||
return $this->method; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getPaymentsCount(): int|null | ||
{ | ||
return $this->getMethodInterface()->getPaymentsCount(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getTransferCount(int $index = 0): int|null | ||
{ | ||
return $this->getMethodInterface()->getTransferCount($index); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCacheKeyPayment(): string | ||
{ | ||
$session = $this->getSessionIdOriginal(); | ||
return base64_encode(sprintf('sessionOriginal_%s', $session)); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCacheKeyAttempt(): string | ||
{ | ||
$session = $this->getSessionIdOriginal(); | ||
return base64_encode(sprintf('sessionOriginal_%s', $session)); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function isFaultEvent(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFaultCode(): string|null | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFaultString(): string|null | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFaultDescription(): string|null | ||
{ | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.