Skip to content

Commit

Permalink
add pspInviaCarrelloRPTCarte
Browse files Browse the repository at this point in the history
  • Loading branch information
esposimo committed Apr 11, 2024
1 parent 51643b0 commit 986b586
Show file tree
Hide file tree
Showing 27 changed files with 3,195 additions and 46 deletions.
6 changes: 6 additions & 0 deletions src/mock_crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
$a->run();


$a = new \pagopa\crawler\paymentlist\req\pspInviaCarrelloRPTCarte(new DateTime('2024-03-10'), 'pspInviaCarrelloRPTCarte', 'REQ', $redis_cache);
$a->run();

$a = new \pagopa\crawler\paymentlist\resp\pspInviaCarrelloRPTCarte(new DateTime('2024-03-10'), 'pspInviaCarrelloRPTCarte', 'RESP', $redis_cache);
$a->run();


die();
//$a = new \pagopa\crawler\paymentlist\resp\activatePaymentNotice(new \DateTime('2024-03-10'),'activatePaymentNotice', 'RESP', $memcache);
Expand Down
99 changes: 98 additions & 1 deletion src/mock_insert.php

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions src/sql/05_2024_insert_data.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
INSERT INTO mapped_events(tipo_evento,sotto_tipo_evento ,fk_event) values
('activatePaymentNotice' , 'REQ' , 1),
('activatePaymentNotice' , 'RESP', 2),
('nodoInviaCarrelloRPT' , 'REQ' , 3),
('nodoInviaCarrelloRPT' , 'RESP', 4),
('sendPaymentOutcome' , 'REQ' , 5),
('sendPaymentOutcome' , 'RESP', 6),
('pspInviaCarrelloRPT' , 'REQ' , 7),
('pspInviaCarrelloRPT' , 'RESP', 8);
('activatePaymentNotice' , 'REQ' , 1),
('activatePaymentNotice' , 'RESP', 2),
('nodoInviaCarrelloRPT' , 'REQ' , 3),
('nodoInviaCarrelloRPT' , 'RESP', 4),
('sendPaymentOutcome' , 'REQ' , 5),
('sendPaymentOutcome' , 'RESP', 6),
('pspInviaCarrelloRPT' , 'REQ' , 7),
('pspInviaCarrelloRPT' , 'RESP', 8),
('pspInviaCarrelloRPTCarte' , 'REQ' , 9),
('pspInviaCarrelloRPTCarte' , 'RESP', 10);

insert into mapped_payment_methods (tipoversamento, descrizione) values
('CC', 'Carta di Credito'),
Expand Down
250 changes: 250 additions & 0 deletions src/src/crawler/events/req/pspInviaCarrelloRPTCarte.php
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;
}
}
3 changes: 1 addition & 2 deletions src/src/crawler/events/resp/pspInviaCarrelloRPT.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ public function getCacheKeyPayment(): string
{
$session = $this->getSessionIdOriginal();
return base64_encode(sprintf('sessionOriginal_%s', $session));

}

/**
Expand Down Expand Up @@ -253,6 +252,6 @@ public function getFaultString(): string|null
*/
public function getFaultDescription(): string|null
{
return $this->getMethodInterface()->getFaultString();
return $this->getMethodInterface()->getFaultDescription();
}
}
Loading

0 comments on commit 986b586

Please sign in to comment.