diff --git a/src/mock_crawler.php b/src/mock_crawler.php index 475462cf..dbafb7e3 100644 --- a/src/mock_crawler.php +++ b/src/mock_crawler.php @@ -43,5 +43,9 @@ $a->run(); +$a = new \pagopa\crawler\paymentlist\resp\activatePaymentNotice(new \DateTime('2024-03-10'),'activatePaymentNotice', 'RESP', $memcache); +$a->run(); + + //$a = new \pagopa\crawler\paymentlist\resp\activatePaymentNotice(new \DateTime('2024-03-10'),'activatePaymentNotice', 'RESP', $memcache); //$a->run(); \ No newline at end of file diff --git a/src/src/crawler/methods/MethodInterface.php b/src/src/crawler/methods/MethodInterface.php index 1cb8a50b..b35270d5 100644 --- a/src/src/crawler/methods/MethodInterface.php +++ b/src/src/crawler/methods/MethodInterface.php @@ -133,6 +133,16 @@ public function getTransferPa(int $transfer = 0, int $index = 0) : string|null; public function getTransferIban(int $transfer = 0, int $index = 0) : string|null; + /** + * Restituisce l'id transfer alla posizione $transfer del pagamento alla posizione $index + * del carrello. Se l'evento non gestisce un carrello, $index viene ignorato + * @param int $transfer + * @param int $index + * @return string|null + */ + public function getTransferId(int $transfer = 0, int $index = 0) : string|null; + + /** * Restituiscei il numero di transfer dell'iesimo pagamento gestito dal metodo * @param int $index diff --git a/src/src/crawler/methods/req/activatePaymentNotice.php b/src/src/crawler/methods/req/activatePaymentNotice.php index 98b3648d..12413baa 100644 --- a/src/src/crawler/methods/req/activatePaymentNotice.php +++ b/src/src/crawler/methods/req/activatePaymentNotice.php @@ -286,4 +286,14 @@ public function getTransferCount(int $index = 0): int|null { return null; } + + /** + * @param int $transfer + * @param int $index + * @return string|null + */ + public function getTransferId(int $transfer = 0, int $index = 0): string|null + { + return null; + } } \ No newline at end of file diff --git a/src/src/crawler/methods/resp/activatePaymentNotice.php b/src/src/crawler/methods/resp/activatePaymentNotice.php index 9caf17af..a82e2560 100644 --- a/src/src/crawler/methods/resp/activatePaymentNotice.php +++ b/src/src/crawler/methods/resp/activatePaymentNotice.php @@ -244,6 +244,31 @@ public function getTransferIban(int $transfer = 0, int $index = 0): string|null return null; } + /** + * @param int $transfer + * @param int $index + * @return string|null + */ + public function getTransferId(int $transfer = 0, int $index = 0): string|null + { + $transferBlock = $this->getTransferNumber($transfer); + if (!is_null($transferBlock)) + { + $xml = new XMLReader(); + $xml->XML($transferBlock); + $count = 0; + while($xml->read()) + { + if (($xml->nodeType == XMLReader::ELEMENT) && ($xml->localName == "idTransfer")) + { + return $xml->readString(); + } + } + return null; + } + return null; + } + /** * La activatePaymentNotice non gestisce bollo */ @@ -284,6 +309,7 @@ public function getBrokerPa(): string|null return null; } + /** * Nel payload non esiste la stazione */ @@ -292,7 +318,6 @@ public function getStazione(): string|null return null; } - /** * Recupera il blocco di XML del campo transferList * @return string|null diff --git a/src/src/crawler/paymentlist/resp/activatePaymentNotice.php b/src/src/crawler/paymentlist/resp/activatePaymentNotice.php index d62392ee..4e1fe836 100644 --- a/src/src/crawler/paymentlist/resp/activatePaymentNotice.php +++ b/src/src/crawler/paymentlist/resp/activatePaymentNotice.php @@ -252,6 +252,7 @@ public function runCreateAttempt(int $index = 0): array $transaction_details->setPaTransfer($this->getEvent()->getMethodInterface()->getTransferPa($i, 0)); $transaction_details->setAmountTransfer($this->getEvent()->getMethodInterface()->getTransferAmount($i, 0)); $transaction_details->setTransferIban($this->getEvent()->getMethodInterface()->getTransferAmount($i, 0)); + $transaction_details->setIdTransfer($this->getEvent()->getMethodInterface()->getTransferId($i, 0)); $transaction_details->insert(); DB::statement($transaction_details->getQuery(), $transaction_details->getBindParams()); } @@ -358,6 +359,7 @@ public function runAttemptAlreadyEvaluated(int $index = 0): void $transaction_details->setPaTransfer($this->getEvent()->getMethodInterface()->getTransferPa($i, 0)); $transaction_details->setAmountTransfer($this->getEvent()->getMethodInterface()->getTransferAmount($i, 0)); $transaction_details->setTransferIban($this->getEvent()->getMethodInterface()->getTransferIban($i, 0)); + $transaction_details->setIdTransfer($this->getEvent()->getMethodInterface()->getTransferId($i, 0)); $transaction_details->insert(); DB::statement($transaction_details->getQuery(), $transaction_details->getBindParams()); } diff --git a/src/tests/.phpunit.result.cache b/src/tests/.phpunit.result.cache new file mode 100644 index 00000000..363b8c2a --- /dev/null +++ b/src/tests/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"pagopa\\process\\normal\\T0011::testCorrectDateEvent":7,"pagopa\\process\\normal\\T0011::testCorrectWorkflowDateEvent":7,"pagopa\\process\\normal\\T0011::testCorrectReEvent":7},"times":{"pagopa\\database\\SingleRowTest::testGetTable":0.071,"pagopa\\database\\SingleRowTest::testGetColumnValue":0.003,"pagopa\\database\\SingleRowTest::testGetReadyColumnValue":0,"pagopa\\database\\SingleRowTest::testGetRow":0,"pagopa\\database\\SingleRowTest::testGetNeedPrimaryKeys":0,"pagopa\\database\\SingleRowTest::testGetPrimaryKeys":0,"pagopa\\database\\SingleRowTest::testInsert":0,"pagopa\\database\\SingleRowTest::testUpdate":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetPaymentsCount":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetTipoEvento":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetSottoTipoEvento":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetPaEmittenti":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetIuvs":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetCcps":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetPaEmittente":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetIuv":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetCreditorReferenceId":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetCcp":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetPaymentToken":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetNoticeNumber":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetPsp":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetCanale":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetBrokerPsp":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetStazione":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetBrokerPa":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testIsValid":0.004,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetKey":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testTransaction":0,"pagopa\\crawler\\events\\req\\activatePaymentNoticeTest::testGetMethodInterface":0.003,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetPaymentsCount":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetTipoEvento":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetSottoTipoEvento":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetPaEmittenti":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetIuvs":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetCcps":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetPaEmittente":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetIuv":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetCreditorReferenceId":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetCcp":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetPaymentToken":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetNoticeNumber":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetPsp":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetCanale":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetBrokerPsp":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetStazione":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetBrokerPa":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testIsValid":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetKey":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testTransaction":0,"pagopa\\crawler\\events\\resp\\activatePaymentNoticeTest::testGetMethodInterface":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetAllNoticesNumbers":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetPaEmittenti":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetIuvs":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetCcps":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetAllTokens":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetNoticeNumber":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetPaEmittente":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetIuv":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetCcp":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetToken":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetCanale":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetBrokerPsp":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetPsp":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetStazione":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetBrokerPa":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetImportoTotale":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetImporto":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetTransferPa":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetTransferAmount":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testGetTransferIban":0,"pagopa\\crawler\\methods\\req\\activatePaymentNoticeTest::testIsBollo":0.003,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetAllNoticesNumbers":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetPaEmittenti":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetIuvs":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetCcps":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetAllTokens":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetNoticeNumber":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetPaEmittente":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetIuv":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetCcp":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetToken":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetCanale":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetBrokerPsp":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetPsp":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetStazione":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetBrokerPa":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetImportoTotale":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetImporto":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetTransferPa":0.001,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetTransferAmount":0.001,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetTransferIban":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testIsBollo":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testIsFaultEvent":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetFaultCode":0,"pagopa\\crawler\\methods\\resp\\activatePaymentNoticeTest::testGetFaultString":0,"pagopa\\process\\normal\\T0001::testCorrectInfoTransaction":0.05,"pagopa\\process\\normal\\T0001::testCorrectWorkflow":0,"pagopa\\process\\normal\\T0001::testCorrectReEvent":0,"pagopa\\process\\normal\\T0002::testCorrectInfoTransaction":0,"pagopa\\process\\normal\\T0002::testCorrectWorkflow":0,"pagopa\\process\\normal\\T0002::testCorrectReEvent":0,"pagopa\\process\\normal\\T0003::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0003::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0003::testCorrectReEvent":0,"pagopa\\process\\normal\\T0004::testCorrectDateEvent":0.003,"pagopa\\process\\normal\\T0004::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0004::testCorrectReEvent":0,"pagopa\\process\\normal\\T0005::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0005::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0005::testCorrectReEvent":0,"pagopa\\process\\normal\\T0006::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0006::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0006::testCorrectReEvent":0,"pagopa\\process\\normal\\T0007::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0007::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0007::testCorrectReEvent":0,"pagopa\\process\\normal\\T0008::testCorrectDateEvent":0.001,"pagopa\\process\\normal\\T0008::testCorrectReEvent":0,"pagopa\\process\\normal\\T0009::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0009::testCorrectWorkflowDateEvent":0.001,"pagopa\\process\\normal\\T0009::testCorrectReEvent":0,"pagopa\\process\\normal\\T0010::testCorrectDateEvent":0,"pagopa\\process\\normal\\T0010::testCorrectWorkflowDateEvent":0,"pagopa\\process\\normal\\T0010::testCorrectReEvent":0,"pagopa\\process\\normal\\T0011::testCorrectDateEvent":0.009,"pagopa\\process\\normal\\T0011::testCorrectWorkflowDateEvent":0.001,"pagopa\\process\\normal\\T0011::testCorrectReEvent":0.001,"pagopa\\process\\normal\\T0011::testCorrectDetails":0.002}} \ No newline at end of file diff --git a/src/tests/mock_data.sql b/src/tests/mock_data.sql index 9ebe0ce4..ba2d6899 100644 --- a/src/tests/mock_data.sql +++ b/src/tests/mock_data.sql @@ -73,6 +73,22 @@ values (10, '2024-03-10', '2024-03-10 09:10:30.232010', 'activatePaymentNotice', 'TO_LOAD',''); + + +insert into transaction_re_2024 (id, date_event, insertedtimestamp, tipoevento, sottotipoevento, iddominio, iuv, ccp, noticenumber, creditorreferenceid, paymenttoken, psp, stazione, canale, sessionid, sessionidoriginal, uniqueid, payload, state, message) +values (11, '2024-03-10', '2024-03-10 09:11:10.232010', 'activatePaymentNotice', 'REQ', '77777777777', '01000000000000010', 't0000000000000000000000000000010', '301000000000000010', + '01000000000000010', 't0000000000000000000000000000010', 'PSP_01', '77777777777_01', '88888888888_01', 'sessid_000001', '', 'T000010', + 'PHNvYXBlbnY6RW52ZWxvcGUgeG1sbnM6bm9kPSJodHRwOi8vcGFnb3BhLWFwaS5wYWdvcGEuZ292Lml0L25vZGUvbm9kZUZvclBzcC54c2QiIHhtbG5zOnNvYXBlbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KCTxzb2FwZW52OkhlYWRlci8+Cgk8c29hcGVudjpCb2R5PgoJCTxub2Q6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVxPgoJCQk8aWRQU1A+UFNQXzAxPC9pZFBTUD4KCQkJPGlkQnJva2VyUFNQPjg4ODg4ODg4ODg4PC9pZEJyb2tlclBTUD4KCQkJPGlkQ2hhbm5lbD44ODg4ODg4ODg4OF8wMTwvaWRDaGFubmVsPgoJCQk8cGFzc3dvcmQ+KioqKio8L3Bhc3N3b3JkPgoJCQk8cXJDb2RlPgoJCQkJPGZpc2NhbENvZGU+Nzc3Nzc3Nzc3Nzc8L2Zpc2NhbENvZGU+CgkJCQk8bm90aWNlTnVtYmVyPjMwMTAwMDAwMDAwMDAwMDAxMDwvbm90aWNlTnVtYmVyPgoJCQk8L3FyQ29kZT4KCQkJPGFtb3VudD4wLjAwPC9hbW91bnQ+CgkJPC9ub2Q6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVxPgoJPC9zb2FwZW52OkJvZHk+Cjwvc29hcGVudjpFbnZlbG9wZT4=', + 'TO_LOAD',''); + + +insert into transaction_re_2024 (id, date_event, insertedtimestamp, tipoevento, sottotipoevento, iddominio, iuv, ccp, noticenumber, creditorreferenceid, paymenttoken, psp, stazione, canale, sessionid, sessionidoriginal, uniqueid, payload, state, message) +values (12, '2024-03-10', '2024-03-10 09:12:10.232010', 'activatePaymentNotice', 'RESP', '77777777777', '01000000000000010', 't0000000000000000000000000000010', '301000000000000010', + '01000000000000010', 't0000000000000000000000000000010', 'PSP_01', '77777777777_01', '88888888888_01', 'sessid_000001', '', 'T000010', + 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8c29hcGVudjpFbnZlbG9wZSB4bWxuczpjb21tb249Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQveHNkL2NvbW1vbi10eXBlcy92MS4wLjAvIiB4bWxuczpuZnA9Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQvbm9kZS9ub2RlRm9yUHNwLnhzZCIgeG1sbnM6c29hcGVudj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSI+Cgk8c29hcGVudjpCb2R5PgoJCTxuZnA6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVzPgoJCQk8b3V0Y29tZT5PSzwvb3V0Y29tZT4KCQkJPHRvdGFsQW1vdW50PjE4MC4wMDwvdG90YWxBbW91bnQ+CgkJCTxwYXltZW50RGVzY3JpcHRpb24+RU5FTCBFTkVSR0lBL05VTURPQz00MzU1NDI1ODYzL0RBVEFET0M9MDguMDguMjAyMy9BVlZJU089MzA0MTAwNDM1NTQyNTg2Mzg5L0lNUE9SVE89MTgzLDg1LzwvcGF5bWVudERlc2NyaXB0aW9uPgoJCQk8ZmlzY2FsQ29kZVBBPjc3Nzc3Nzc3Nzc3PC9maXNjYWxDb2RlUEE+CgkJCTxjb21wYW55TmFtZT5wYWdvUEEgUy5wLkEuPC9jb21wYW55TmFtZT4KCQkJPHBheW1lbnRUb2tlbj50MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDwvcGF5bWVudFRva2VuPgoJCQk8dHJhbnNmZXJMaXN0PgoJCQkJPHRyYW5zZmVyPgoJCQkJCTxpZFRyYW5zZmVyPjE8L2lkVHJhbnNmZXI+CgkJCQkJPHRyYW5zZmVyQW1vdW50PjE4MC4wMDwvdHJhbnNmZXJBbW91bnQ+CgkJCQkJPGZpc2NhbENvZGVQQT43Nzc3Nzc3Nzc3NzwvZmlzY2FsQ29kZVBBPgoJCQkJCTxJQkFOPklUMThVMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTwvSUJBTj4KCQkJCQk8cmVtaXR0YW5jZUluZm9ybWF0aW9uPi9SRkIvMDQxMDA0MzU1NDI1ODYzODkvVFhUL0VORUwgRU5FUkdJQS9OVU1ET0M9NDM1NTQyNTg2My9EQVRBRE9DPTA4LjA4LjIwMjMvQVZWSVNPPTMwNDEwMDQzNTU0MjU4NjM4OS9JTVBPUlRPPTE4Myw4NS88L3JlbWl0dGFuY2VJbmZvcm1hdGlvbj4KCQkJCTwvdHJhbnNmZXI+CgkJCTwvdHJhbnNmZXJMaXN0PgoJCQk8Y3JlZGl0b3JSZWZlcmVuY2VJZD4wMTAwMDAwMDAwMDAwMDAxMDwvY3JlZGl0b3JSZWZlcmVuY2VJZD4KCQk8L25mcDphY3RpdmF0ZVBheW1lbnROb3RpY2VSZXM+Cgk8L3NvYXBlbnY6Qm9keT4KPC9zb2FwZW52OkVudmVsb3BlPg==', + 'TO_LOAD',''); + + /* insert into transaction_re_2024 (id, date_event, insertedtimestamp, tipoevento, sottotipoevento, iddominio, iuv, ccp, noticenumber, creditorreferenceid, paymenttoken, psp, stazione, canale, sessionid, sessionidoriginal, uniqueid, payload, state, message) values (2, '2024-03-10', '2024-03-10 09:10:11.232010', 'activatePaymentNotice', 'REQ', '77777777777', '01000000000000002', 't0000000000000000000000000000002', '301000000000000002', diff --git a/src/tests/phpunit.xml b/src/tests/phpunit.xml index d335d6a3..dcb403d7 100644 --- a/src/tests/phpunit.xml +++ b/src/tests/phpunit.xml @@ -35,6 +35,7 @@ process/normal/T0008.php process/normal/T0009.php process/normal/T0010.php + process/normal/T0011.php diff --git a/src/tests/process/normal/T0011.php b/src/tests/process/normal/T0011.php new file mode 100644 index 00000000..11ee1494 --- /dev/null +++ b/src/tests/process/normal/T0011.php @@ -0,0 +1,181 @@ +addConnection([ + 'driver' => 'pgsql', + 'host' => DB_HOST, + 'port' => DB_PORT, + 'database' => DB_DATABASE, + 'username' => DB_USERNAME, + 'password' => DB_PASSWORD, + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci' + ]); + + $capsule->setAsGlobal(); + $capsule->bootEloquent(); + + + self::$db = $capsule; + + + + } + + #[TestDox('[TRANSACTION] Verifica correttezza campi')] + public function testCorrectDateEvent() + { + $result = Capsule::table('transaction_2024') + ->where('iuv', '=', '01000000000000010') + ->where('token_ccp', '=', 't0000000000000000000000000000010') + ->get(); + + + $transaction = new Transaction(new \DateTime('2024-03-10'), (array) $result->get(0)); + + + $this->assertEquals('2024-03-10',$transaction->getColumnValue('date_event')); + $this->assertEquals('2024-03-10 09:11:10.232',$transaction->getColumnValue('inserted_timestamp')); + $this->assertEquals('01000000000000010',$transaction->getColumnValue('iuv')); + $this->assertEquals('77777777777',$transaction->getColumnValue('pa_emittente')); + $this->assertEquals('301000000000000010',$transaction->getColumnValue('notice_id')); + $this->assertNull($transaction->getColumnValue('id_carrello')); + $this->assertEquals('t0000000000000000000000000000010', $transaction->getColumnValue('token_ccp')); + $this->assertEquals('77777777777', $transaction->getColumnValue('id_broker_pa')); + $this->assertEquals('88888888888',$transaction->getColumnValue('id_broker_psp')); + $this->assertEquals('PSP_01',$transaction->getColumnValue('id_psp')); + $this->assertEquals('77777777777_01',$transaction->getColumnValue('stazione')); + $this->assertEquals('88888888888_01',$transaction->getColumnValue('canale')); + $this->assertEquals('180.00',$transaction->getColumnValue('importo')); + $this->assertNull($transaction->getColumnValue('esito')); + } + + + #[TestDox('[WORKFLOW] Verifica correttezza campi')] + public function testCorrectWorkflowDateEvent() + { + + $result = Capsule::table('transaction_2024') + ->where('iuv', '=', '01000000000000010') + ->where('token_ccp', '=', 't0000000000000000000000000000010') + ->get(); + + + $transaction = new Transaction(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $id = $transaction->getColumnValue('id'); + + + $result = Capsule::table('transaction_events_2024') + ->where('fk_payment', '=', $id) + ->where('fk_tipoevento' , '=', 1) + ->get(); + + $req = new Workflow(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $result = Capsule::table('transaction_events_2024') + ->where('fk_payment', '=', $id) + ->where('fk_tipoevento' , '=', 2) + ->get(); + + $resp = new Workflow(new \DateTime('2024-03-10'), (array) $result->get(0)); + + + $this->assertEquals('2024-03-10', $req->getColumnValue('date_event')); + $this->assertEquals('2024-03-10 09:11:10.232', $req->getColumnValue('event_timestamp')); + $this->assertEquals(1, $req->getColumnValue('fk_tipoevento')); + $this->assertEquals('T000010', $req->getColumnValue('event_id')); + + $this->assertEquals('2024-03-10', $resp->getColumnValue('date_event')); + $this->assertEquals('2024-03-10 09:12:10.232', $resp->getColumnValue('event_timestamp')); + $this->assertEquals(2, $resp->getColumnValue('fk_tipoevento')); + $this->assertEquals('T000010', $resp->getColumnValue('event_id')); + + + $result = Capsule::table('transaction_events_2024') + ->where('fk_payment', '=', $id) + ->get(); + + $this->assertEquals(2, $result->count()); + + } + + #[TestDox('[RE] Verifica della modifica in LOADED dell\'evento analizzato')] + public function testCorrectReEvent() + { + + $result = Capsule::table('transaction_re_2024') + ->where('id', '=', '11') + ->get(); + + $event = new TransactionRe(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $result = Capsule::table('transaction_re_2024') + ->where('id', '=', '12') + ->get(); + + $event = new TransactionRe(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + + } + + #[TestDox('[DETAILS] Verifica corretto inserimento transfer')] + public function testCorrectDetails() + { + $result = Capsule::table('transaction_2024') + ->where('iuv', '=', '01000000000000010') + ->where('token_ccp', '=', 't0000000000000000000000000000010') + ->get(); + + + $transaction = new Transaction(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $id = $transaction->getColumnValue('id'); + + $result = Capsule::table('transaction_details_2024') + ->where('fk_payment', '=', $id) + ->get(); + + $details = new TransactionDetails(new \DateTime('2024-03-10'), (array) $result->get(0)); + + $this->assertEquals(1, $result->count()); + $this->assertEquals('180.00', $details->getColumnValue('amount_transfer')); + $this->assertEquals('IT18U0000000000000000000001', $details->getColumnValue('iban_transfer')); + $this->assertEquals('77777777777', $details->getColumnValue('pa_transfer')); + $this->assertEquals('1', $details->getColumnValue('id_transfer')); + + } +} \ No newline at end of file