Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
esposimo committed Apr 3, 2024
1 parent b5c5527 commit 058f692
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 408 deletions.
2 changes: 1 addition & 1 deletion src/clean_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
php flush_cache.php ;
php mock_insert.php ;
php mock_crawler.php ;
./vendor/bin/phpunit -c tests/phpunit.xml --testsuite temp_suite
./vendor/bin/phpunit -c tests/phpunit.xml --testsuite crawler
2 changes: 1 addition & 1 deletion src/mock_crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
$a = new \pagopa\crawler\paymentlist\resp\activatePaymentNotice(new \DateTime('2024-03-10'),'activatePaymentNotice', 'RESP', $redis_cache);
$a->run();

die();

$a = new \pagopa\crawler\paymentlist\req\nodoInviaCarrelloRPT(new \DateTime('2024-03-10'),'nodoInviaCarrelloRPT', 'REQ', $redis_cache);
$a->run();
Expand All @@ -76,5 +75,6 @@

$a = new \pagopa\crawler\paymentlist\resp\nodoInviaCarrelloRPT(new \DateTime('2024-03-11'),'nodoInviaCarrelloRPT', 'RESP', $redis_cache);
$a->run();
die();
//$a = new \pagopa\crawler\paymentlist\resp\activatePaymentNotice(new \DateTime('2024-03-10'),'activatePaymentNotice', 'RESP', $memcache);
//$a->run();
6 changes: 2 additions & 4 deletions src/src/crawler/events/req/activatePaymentNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ public function getCacheKeyPayment(): string
$iuv = $this->getIuv(0);
$pa_emittente = $this->getPaEmittente(0);

$cache_key = base64_encode(sprintf('payment_%s_%s', $iuv, $pa_emittente));
return $cache_key;
return base64_encode(sprintf('payment_%s_%s', $iuv, $pa_emittente));

}

Expand All @@ -355,7 +354,6 @@ public function getCacheKeyAttempt(): string
$pa_emittente = $this->getPaEmittente(0);
$token = $this->getPaymentToken(0);

$cache_key = base64_encode(sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token));
return $cache_key;
return base64_encode(sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token));
}
}
30 changes: 0 additions & 30 deletions src/src/crawler/events/resp/activatePaymentNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public function getPaEmittente(int $index = 0): string|null
{
$pa = $this->getColumn('iddominio');
return (empty($pa)) ? null : $pa;
if (empty($this->getColumn('iddominio')))
{
// se la colonna iddominio è vuota, provo a recuperare dal payload
return $this->getMethodInterface()->getPaEmittente(0);
}
return $this->getColumn('iddominio');
}

/**
Expand All @@ -42,12 +36,6 @@ public function getIuv(int $index = 0): string|null
{
$iuv = $this->getColumn('iuv');
return (empty($iuv)) ? null : $iuv;
if (empty($this->getColumn('iuv')))
{
// se la colonna iuv è vuota, provo a recuperare dal payload visto che nella response dell'activatePaymentNotice il valore c'è (se non c'è fault)
return $this->getMethodInterface()->getIuv(0);
}
return $this->getColumn('iuv');
}

/**
Expand All @@ -57,12 +45,6 @@ public function getCcp(int $index = 0): string|null
{
$ccp = $this->getColumn('ccp');
return (empty($ccp)) ? null : $ccp;
if (empty($this->getColumn('ccp')))
{
// se la colonna iddominio è vuota, provo a recuperare dal payload
return $this->getMethodInterface()->getCcp(0);
}
return $this->getColumn('ccp');
}

/**
Expand All @@ -80,12 +62,6 @@ public function getCreditorReferenceId(int $index = 0): string|null
{
$iuv = $this->getColumn('creditorreferenceid');
return (empty($iuv)) ? null : $iuv;
if (empty($this->getColumn('creditorreferenceid')))
{
// se la colonna iuv è vuota, provo a recuperare dal payload visto che nella response dell'activatePaymentNotice il valore c'è (se non c'è fault)
return $this->getMethodInterface()->getIuv(0);
}
return $this->getColumn('creditorreferenceid');
}

/**
Expand All @@ -95,12 +71,6 @@ public function getPaymentToken(int $index = 0): string|null
{
$token = $this->getColumn('paymenttoken');
return (empty($token)) ? null : $token;
if (empty($this->getColumn('paymenttoken')))
{
// se la colonna iuv è vuota, provo a recuperare dal payload visto che nella response dell'activatePaymentNotice il valore c'è (se non c'è fault)
return $this->getMethodInterface()->getToken(0);
}
return $this->getColumn('paymenttoken');
}

/**
Expand Down
11 changes: 0 additions & 11 deletions src/src/crawler/paymentlist/AbstractPaymentList.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,6 @@ public function runAnalysisSingleEvent() : void
$this->runCreateAttempt();
}
}
else
{
if ($this->isPaymentInCache())
{
$this->runPaymentAlreadyEvaluated();
}
else
{
$this->runCreatePayment();
}
}
$rowid = $this->getEvent()->getEventRowInstance()->loaded()->update();
DB::statement($rowid->getQuery(), $rowid->getBindParams());
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/crawler/paymentlist/req/activatePaymentNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function runCompleteEvent(string $message = null): TransactionRe
return $this->getEvent()->getEventRowInstance()->loaded($message)->update();
}

public function runAnalysisSingleEvent() : void
public function runAnalysisSingleEventaa() : void
{
try {
// aggiustare l'update dell'evento , capire se mettere il ciclo dentro o fuori la validazione
Expand Down
Loading

0 comments on commit 058f692

Please sign in to comment.