From 65a00735ee51141a288fc8a049f066717c93bf3b Mon Sep 17 00:00:00 2001 From: esposimo Date: Thu, 2 May 2024 18:05:54 +0200 Subject: [PATCH] add closePayment-v1 to the crawler --- src/mock_crawler.php | 6 + src/mock_insert.php | 209 ++++++++++++++++++ .../events/req/activatePaymentNotice.php | 1 - src/src/crawler/events/req/closePaymentV1.php | 89 ++++++-- .../crawler/events/resp/closePaymentV1.php | 197 +++++++++++++++++ .../paymentlist/req/closePaymentV1.php | 34 +++ .../paymentlist/resp/closePaymentV1.php | 34 +++ .../pagopa/events/req/closePaymentV1Test.php | 131 +++++++++++ .../pagopa/events/resp/closePaymentV1Test.php | 127 +++++++++++ src/tests/phpunit.xml | 5 +- .../T00062_WorkFlowWithClosePaymentV1.php | 172 ++++++++++++++ 11 files changed, 986 insertions(+), 19 deletions(-) create mode 100644 src/src/crawler/events/resp/closePaymentV1.php create mode 100644 src/src/crawler/paymentlist/req/closePaymentV1.php create mode 100644 src/src/crawler/paymentlist/resp/closePaymentV1.php create mode 100644 src/tests/pagopa/events/req/closePaymentV1Test.php create mode 100644 src/tests/pagopa/events/resp/closePaymentV1Test.php create mode 100644 src/tests/process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php diff --git a/src/mock_crawler.php b/src/mock_crawler.php index c7ea36c2..1c3b0fae 100644 --- a/src/mock_crawler.php +++ b/src/mock_crawler.php @@ -147,6 +147,12 @@ $a->run(); +$a = new \pagopa\crawler\paymentlist\req\closePaymentV1(new DateTime('2024-03-10'), 'closePayment-v1', 'REQ', $redis_cache); +$a->run(); + +$a = new \pagopa\crawler\paymentlist\resp\closePaymentV1(new DateTime('2024-03-10'), 'closePayment-v1', 'RESP', $redis_cache); +$a->run(); + $a = new \pagopa\crawler\paymentlist\req\pspNotifyPayment(new \DateTime('2024-03-10'), 'pspNotifyPayment', 'REQ', $redis_cache); $a->run(); diff --git a/src/mock_insert.php b/src/mock_insert.php index c7a4237d..460634b7 100644 --- a/src/mock_insert.php +++ b/src/mock_insert.php @@ -4869,3 +4869,212 @@ + + + + + + + + +$data_req = [ + ':id' => 206, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:38:00.197', + ':tipoevento' => 'activatePaymentNotice', + ':sottotipoevento' => 'REQ', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100192', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000206', + ':payload' => 'PHNvYXBlbnY6RW52ZWxvcGUgeG1sbnM6bm9kPSJodHRwOi8vcGFnb3BhLWFwaS5wYWdvcGEuZ292Lml0L25vZGUvbm9kZUZvclBzcC54c2QiIHhtbG5zOnNvYXBlbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KICA8c29hcGVudjpIZWFkZXIvPgogIDxzb2FwZW52OkJvZHk+CiAgICA8bm9kOmFjdGl2YXRlUGF5bWVudE5vdGljZVJlcT4KICAgICAgPGlkUFNQPkFHSURfMDE8L2lkUFNQPgogICAgICA8aWRCcm9rZXJQU1A+ODg4ODg4ODg4ODg8L2lkQnJva2VyUFNQPgogICAgICA8aWRDaGFubmVsPjg4ODg4ODg4ODg4XzAxPC9pZENoYW5uZWw+CiAgICAgIDxwYXNzd29yZD4qKioqKjwvcGFzc3dvcmQ+CiAgICAgIDxxckNvZGU+CiAgICAgICAgPGZpc2NhbENvZGU+Nzc3Nzc3Nzc3Nzc8L2Zpc2NhbENvZGU+CiAgICAgICAgPG5vdGljZU51bWJlcj4zMDEwMDAwMDAwMDAwMDAxODM8L25vdGljZU51bWJlcj4KICAgICAgPC9xckNvZGU+CiAgICAgIDxhbW91bnQ+MC4wMDwvYW1vdW50PgogICAgPC9ub2Q6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVxPgogIDwvc29hcGVudjpCb2R5Pgo8L3NvYXBlbnY6RW52ZWxvcGU+', +]; + +$data_resp = [ + ':id' => 207, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:38:01.197', + ':tipoevento' => 'activatePaymentNotice', + ':sottotipoevento' => 'RESP', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100192', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000207', + ':payload' => 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8c29hcGVudjpFbnZlbG9wZSB4bWxuczpjb21tb249Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQveHNkL2NvbW1vbi10eXBlcy92MS4wLjAvIiB4bWxuczpuZnA9Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQvbm9kZS9ub2RlRm9yUHNwLnhzZCIgeG1sbnM6c29hcGVudj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSI+Cgk8c29hcGVudjpCb2R5PgoJCTxuZnA6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVzPgoJCQk8b3V0Y29tZT5PSzwvb3V0Y29tZT4KCQkJPHRvdGFsQW1vdW50PjgwLjAwPC90b3RhbEFtb3VudD4KCQkJPHBheW1lbnREZXNjcmlwdGlvbj54eHh4eHh4PC9wYXltZW50RGVzY3JpcHRpb24+CgkJCTxmaXNjYWxDb2RlUEE+Nzc3Nzc3Nzc3Nzc8L2Zpc2NhbENvZGVQQT4KCQkJPGNvbXBhbnlOYW1lPnh4eHh4eHg8L2NvbXBhbnlOYW1lPgoJCQk8cGF5bWVudFRva2VuPnQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTgzPC9wYXltZW50VG9rZW4+CgkJCTx0cmFuc2Zlckxpc3Q+CgkJCQk8dHJhbnNmZXI+CgkJCQkJPGlkVHJhbnNmZXI+MTwvaWRUcmFuc2Zlcj4KCQkJCQk8dHJhbnNmZXJBbW91bnQ+ODAuMDA8L3RyYW5zZmVyQW1vdW50PgoJCQkJCTxmaXNjYWxDb2RlUEE+Nzc3Nzc3Nzc3Nzc8L2Zpc2NhbENvZGVQQT4KCQkJCQk8SUJBTj5JVDE4VTAwMDAwMDAwMDAwMDAwMDAwMDAwMDE8L0lCQU4+CgkJCQkJPHJlbWl0dGFuY2VJbmZvcm1hdGlvbj54eHh4PC9yZW1pdHRhbmNlSW5mb3JtYXRpb24+CgkJCQk8L3RyYW5zZmVyPgoJCQk8L3RyYW5zZmVyTGlzdD4KCQkJPGNyZWRpdG9yUmVmZXJlbmNlSWQ+MDEwMDAwMDAwMDAwMDAxODM8L2NyZWRpdG9yUmVmZXJlbmNlSWQ+CgkJPC9uZnA6YWN0aXZhdGVQYXltZW50Tm90aWNlUmVzPgoJPC9zb2FwZW52OkJvZHk+Cjwvc29hcGVudjpFbnZlbG9wZT4=', +]; + + +Capsule::statement($render_query, $data_req); +Capsule::statement($render_query, $data_resp); + + + + + + +$data_req = [ + ':id' => 208, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:39:00.197', + ':tipoevento' => 'closePayment-v1', + ':sottotipoevento' => 'REQ', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100193', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000208', + ':payload' => 'ewogICAgImFkZGl0aW9uYWxQYXltZW50SW5mb3JtYXRpb25zIjogewogICAgICAgICJhdXRob3JpemF0aW9uQ29kZSI6ICIwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMCIsCiAgICAgICAgIm91dGNvbWVQYXltZW50R2F0ZXdheSI6ICIwIiwKICAgICAgICAidHJhbnNhY3Rpb25JZCI6ICIxMTExMTExMTIiCiAgICB9LAogICAgImZlZSI6IDAuNSwKICAgICJpZGVudGlmaWNhdGl2b0NhbmFsZSI6ICI4ODg4ODg4ODg4OF8wMSIsCiAgICAiaWRlbnRpZmljYXRpdm9JbnRlcm1lZGlhcmlvIjogIjg4ODg4ODg4ODg4IiwKICAgICJpZGVudGlmaWNhdGl2b1BzcCI6ICJBR0lEXzAxIiwKICAgICJvdXRjb21lIjogIk9LIiwKICAgICJwYXltZW50VG9rZW5zIjogWwogICAgICAgICJ0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE4MyIKICAgIF0sCiAgICAicHNwVHJhbnNhY3Rpb25JZCI6ICIxMTExMTExMTIiLAogICAgInRpbWVzdGFtcE9wZXJhdGlvbiI6ICIyMDI0LTA0LTMwVDIxOjE4OjAwLjM3OVoiLAogICAgInRpcG9WZXJzYW1lbnRvIjogIkJQQVkiLAogICAgInRvdGFsQW1vdW50IjogODAuMAp9', +]; + +$data_resp = [ + ':id' => 209, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:39:01.197', + ':tipoevento' => 'closePayment-v1', + ':sottotipoevento' => 'RESP', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100193', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000209', + ':payload' => 'eyJlc2l0byI6Ik9LIn0=', +]; + +Capsule::statement($render_query, $data_req); +Capsule::statement($render_query, $data_resp); + + + + + +$data_req = [ + ':id' => 210, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:40:00.197', + ':tipoevento' => 'pspNotifyPayment', + ':sottotipoevento' => 'REQ', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100194', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000210', + ':payload' => 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8c29hcGVudjpFbnZlbG9wZSB4bWxuczpjb21tb249Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQveHNkL2NvbW1vbi10eXBlcy92MS4wLjAvIiB4bWxuczpwZm49Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQvcHNwL3BzcEZvck5vZGUueHNkIiB4bWxuczpzb2FwZW52PSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VudmVsb3BlLyIgeG1sbnM6eHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIj4KCTxzb2FwZW52OkJvZHk+CgkJPHBmbjpwc3BOb3RpZnlQYXltZW50UmVxPgoJCQk8aWRQU1A+QUdJRF8wMTwvaWRQU1A+CgkJCTxpZEJyb2tlclBTUD44ODg4ODg4ODg4ODwvaWRCcm9rZXJQU1A+CgkJCTxpZENoYW5uZWw+ODg4ODg4ODg4ODhfMDE8L2lkQ2hhbm5lbD4KCQkJPHBheW1lbnRUb2tlbj50MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE4MzwvcGF5bWVudFRva2VuPgoJCQk8cGF5bWVudERlc2NyaXB0aW9uPnBhZ2FtZW50byBtdWx0aWJlbmVmaWNpYXJpbzwvcGF5bWVudERlc2NyaXB0aW9uPgoJCQk8ZmlzY2FsQ29kZVBBPjc3Nzc3Nzc3Nzc3PC9maXNjYWxDb2RlUEE+CgkJCTxjb21wYW55TmFtZT54eHh4eHh4PC9jb21wYW55TmFtZT4KCQkJPGNyZWRpdG9yUmVmZXJlbmNlSWQ+MDEwMDAwMDAwMDAwMDAxODM8L2NyZWRpdG9yUmVmZXJlbmNlSWQ+CgkJCTxkZWJ0QW1vdW50PjE1MC4wMDwvZGVidEFtb3VudD4KCQkJPHRyYW5zZmVyTGlzdD4KCQkJCTx0cmFuc2Zlcj4KCQkJCQk8aWRUcmFuc2Zlcj4xPC9pZFRyYW5zZmVyPgoJCQkJCTx0cmFuc2ZlckFtb3VudD44MC4wMDwvdHJhbnNmZXJBbW91bnQ+CgkJCQkJPGZpc2NhbENvZGVQQT43Nzc3Nzc3Nzc3NzwvZmlzY2FsQ29kZVBBPgoJCQkJCTxJQkFOPklUMThVMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTwvSUJBTj4KCQkJCQk8cmVtaXR0YW5jZUluZm9ybWF0aW9uPnh4eHg8L3JlbWl0dGFuY2VJbmZvcm1hdGlvbj4KCQkJCTwvdHJhbnNmZXI+CgkJCTwvdHJhbnNmZXJMaXN0PgoJCQk8Y3JlZGl0Q2FyZFBheW1lbnQ+CgkJCQk8cnJuPjExMTExMTExMTExMTwvcnJuPgoJCQkJPG91dGNvbWVQYXltZW50R2F0ZXdheT5PSzwvb3V0Y29tZVBheW1lbnRHYXRld2F5PgoJCQkJPHRvdGFsQW1vdW50PjgxLjMwPC90b3RhbEFtb3VudD4KCQkJCTxmZWU+MS4zMDwvZmVlPgoJCQkJPHRpbWVzdGFtcE9wZXJhdGlvbj4yMDI0LTA0LTEwVDIxOjE0OjQ3PC90aW1lc3RhbXBPcGVyYXRpb24+CgkJCQk8YXV0aG9yaXphdGlvbkNvZGU+MTExMTE1PC9hdXRob3JpemF0aW9uQ29kZT4KCQkJPC9jcmVkaXRDYXJkUGF5bWVudD4KCQk8L3Bmbjpwc3BOb3RpZnlQYXltZW50UmVxPgoJPC9zb2FwZW52OkJvZHk+Cjwvc29hcGVudjpFbnZlbG9wZT4=', +]; + +$data_resp = [ + ':id' => 211, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:40:01.197', + ':tipoevento' => 'pspNotifyPayment', + ':sottotipoevento' => 'RESP', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100194', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000211', + ':payload' => 'PFNPQVAtRU5WOkVudmVsb3BlIHhtbG5zOlNPQVAtRU5WPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VudmVsb3BlLyI+PFNPQVAtRU5WOkhlYWRlci8+PFNPQVAtRU5WOkJvZHk+PG5zMzpwc3BOb3RpZnlQYXltZW50UmVzIHhtbG5zOm5zMz0iaHR0cDovL3BhZ29wYS1hcGkucGFnb3BhLmdvdi5pdC9wc3AvcHNwRm9yTm9kZS54c2QiPjxvdXRjb21lPk9LPC9vdXRjb21lPjwvbnMzOnBzcE5vdGlmeVBheW1lbnRSZXM+PC9TT0FQLUVOVjpCb2R5PjwvU09BUC1FTlY6RW52ZWxvcGU+', +]; + + +Capsule::statement($render_query, $data_req); +Capsule::statement($render_query, $data_resp); + + + + + + +$data_req = [ + ':id' => 212, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:41:00.197', + ':tipoevento' => 'sendPaymentOutcome', + ':sottotipoevento' => 'REQ', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100195', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000212', + ':payload' => 'PHNvYXA6RW52ZWxvcGUgeG1sbnM6c29hcD0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iPgoJPHNvYXA6Qm9keT4KCQk8bnMyOnNlbmRQYXltZW50T3V0Y29tZVJlcSB4bWxuczpuczI9Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQvbm9kZS9ub2RlRm9yUHNwLnhzZCIgeG1sbnM6bnMzPSJodHRwOi8vd3MucGFnYW1lbnRpLnRlbGVtYXRpY2kuZ292LyI+CgkJCTxpZFBTUD5BR0lEXzAxPC9pZFBTUD4KCQkJPGlkQnJva2VyUFNQPjg4ODg4ODg4ODg4PC9pZEJyb2tlclBTUD4KCQkJPGlkQ2hhbm5lbD44ODg4ODg4ODg4OF8wMTwvaWRDaGFubmVsPgoJCQk8cGFzc3dvcmQ+eHh4eHh4eHg8L3Bhc3N3b3JkPgoJCQk8cGF5bWVudFRva2VuPnQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTgzPC9wYXltZW50VG9rZW4+CgkJCTxvdXRjb21lPk9LPC9vdXRjb21lPgoJCQk8ZGV0YWlscz4KCQkJCTxwYXltZW50TWV0aG9kPm90aGVyPC9wYXltZW50TWV0aG9kPgoJCQkJPGZlZT4xLjAwPC9mZWU+CgkJCQk8YXBwbGljYXRpb25EYXRlPjIwMjQtMDQtMDI8L2FwcGxpY2F0aW9uRGF0ZT4KCQkJCTx0cmFuc2ZlckRhdGU+MjAyNC0wNC0wMzwvdHJhbnNmZXJEYXRlPgoJCQk8L2RldGFpbHM+CgkJPC9uczI6c2VuZFBheW1lbnRPdXRjb21lUmVxPgoJPC9zb2FwOkJvZHk+Cjwvc29hcDpFbnZlbG9wZT4=', +]; + +$data_resp = [ + ':id' => 213, + ':date_event' => '2024-03-10', + ':inserted_timestamp' => '2024-03-10 13:41:01.197', + ':tipoevento' => 'sendPaymentOutcome', + ':sottotipoevento' => 'RESP', + ':iddominio' => '77777777777', + ':iuv' => '01000000000000183', + ':ccp' => 't0000000000000000000000000000183', + ':noticenumber' => '301000000000000183', + ':creditorreferenceid' => '01000000000000183', + ':paymenttoken' => 't0000000000000000000000000000183', + ':psp' => 'AGID_01', + ':stazione' => '77777777777_01', + ':canale' => '88888888888_01', + ':sessionid' => 'sessid_100195', + ':sessionidoriginal' => '', + ':uniqueid' => 'T000213', + ':payload' => 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8c29hcGVudjpFbnZlbG9wZSB4bWxuczpjb21tb249Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQveHNkL2NvbW1vbi10eXBlcy92MS4wLjAvIiB4bWxuczpuZnA9Imh0dHA6Ly9wYWdvcGEtYXBpLnBhZ29wYS5nb3YuaXQvbm9kZS9ub2RlRm9yUHNwLnhzZCIgeG1sbnM6c29hcGVudj0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSI+Cgk8c29hcGVudjpCb2R5PgoJCTxuZnA6c2VuZFBheW1lbnRPdXRjb21lUmVzPgoJCQk8b3V0Y29tZT5PSzwvb3V0Y29tZT4KCQk8L25mcDpzZW5kUGF5bWVudE91dGNvbWVSZXM+Cgk8L3NvYXBlbnY6Qm9keT4KPC9zb2FwZW52OkVudmVsb3BlPg==', +]; + + +Capsule::statement($render_query, $data_req); +Capsule::statement($render_query, $data_resp); + + + + + diff --git a/src/src/crawler/events/req/activatePaymentNotice.php b/src/src/crawler/events/req/activatePaymentNotice.php index 0ff49fc4..bede3d37 100644 --- a/src/src/crawler/events/req/activatePaymentNotice.php +++ b/src/src/crawler/events/req/activatePaymentNotice.php @@ -173,7 +173,6 @@ public function getCacheKeyPayment(int $index = 0): string|null $pa_emittente = $this->getPaEmittente(); return sprintf('payment_%s_%s', $iuv, $pa_emittente); - } /** diff --git a/src/src/crawler/events/req/closePaymentV1.php b/src/src/crawler/events/req/closePaymentV1.php index b5eb600b..dc074660 100644 --- a/src/src/crawler/events/req/closePaymentV1.php +++ b/src/src/crawler/events/req/closePaymentV1.php @@ -3,20 +3,31 @@ namespace pagopa\crawler\events\req; use pagopa\crawler\events\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\closePaymentV1 as Payload; class closePaymentV1 extends AbstractEvent { + protected Payload $method; + + + public function __construct(array $eventData) + { + parent::__construct($eventData); + $this->method = new Payload($this->data['payload']); + } /** * @inheritDoc */ public function getIuvs(): array|null { - // TODO: Implement getIuvs() method. + $value = $this->getIuv(); + return (is_null($value)) ? $this->getMethodInterface()->getIuvs() : array($value); } /** @@ -24,7 +35,8 @@ public function getIuvs(): array|null */ public function getPaEmittenti(): array|null { - // TODO: Implement getPaEmittenti() method. + $value = $this->getPaEmittente(); + return (is_null($value)) ? $this->getMethodInterface()->getPaEmittenti() : array($value); } /** @@ -32,7 +44,8 @@ public function getPaEmittenti(): array|null */ public function getCcps(): array|null { - // TODO: Implement getCcps() method. + $value = $this->getCcp(); + return (is_null($value)) ? $this->getMethodInterface()->getCcps() : array($value); } /** @@ -40,25 +53,48 @@ public function getCcps(): array|null */ public function transaction(int $index = 0): Transaction|null { - // TODO: Implement transaction() method. + return null; } public function transactionDetails(int $transfer, int $index = 0): TransactionDetails|null { - // TODO: Implement transactionDetails() method. + return null; } public function workflowEvent(int $index = 0): Workflow|null { - // TODO: Implement workflowEvent() method. + $workflow = new Workflow($this->getInsertedTimestamp()); + $workflow->setNewColumnValue('date_event', $this->getInsertedTimestamp()->format('Y-m-d')); + $workflow->setEventTimestamp($this->getInsertedTimestamp()); + $workflow->setEventId($this->getUniqueId()); + $workflow->setFkTipoEvento(MapEvents::getMethodId($this->getTipoEvento(), $this->getSottoTipoEvento())); + + $id_psp = $this->getPsp(); + $stazione = $this->getStazione(); + $canale = $this->getCanale(); + + if (!is_null($id_psp)) + { + $workflow->setPsp($id_psp); + } + if (!is_null($stazione)) + { + $workflow->setStazione($stazione); + } + if (!is_null($canale)) + { + $workflow->setCanale($canale); + } + + return $workflow; } /** * @inheritDoc */ - public function getMethodInterface(): MethodInterface + public function getMethodInterface(): Payload { - // TODO: Implement getMethodInterface() method. + return $this->method; } /** @@ -66,7 +102,7 @@ public function getMethodInterface(): MethodInterface */ public function getPaymentsCount(): int|null { - // TODO: Implement getPaymentsCount() method. + return 1; } /** @@ -74,7 +110,7 @@ public function getPaymentsCount(): int|null */ public function getTransferCount(int $index = 0): int|null { - // TODO: Implement getTransferCount() method. + return null; } /** @@ -82,7 +118,11 @@ public function getTransferCount(int $index = 0): int|null */ public function getCacheKeyPayment(int $index = 0): string|null { - // TODO: Implement getCacheKeyPayment() method. + $iuv = $this->getIuv(); + $pa_emittente = $this->getPaEmittente(); + $token = $this->getPaymentToken(); + + return sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token); } /** @@ -90,7 +130,11 @@ public function getCacheKeyPayment(int $index = 0): string|null */ public function getCacheKeyAttempt(int $index = 0): string|null { - // TODO: Implement getCacheKeyAttempt() method. + $iuv = $this->getIuv(); + $pa_emittente = $this->getPaEmittente(); + $token = $this->getPaymentToken(); + + return sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token); } /** @@ -98,7 +142,18 @@ public function getCacheKeyAttempt(int $index = 0): string|null */ public function getCacheKeyList(): array { - // TODO: Implement getCacheKeyList() method. + $return = array(); + if (!is_null($this->getPaymentToken())) + { + $key = sprintf('token_%s', $this->getPaymentToken()); + $return[] = $key; + } + if (!is_null($this->getSessionIdOriginal())) + { + $key = sprintf('sessionOriginal_%s', $this->getSessionIdOriginal()); + $return[] = $key; + } + return $return; } /** @@ -106,7 +161,7 @@ public function getCacheKeyList(): array */ public function isFaultEvent(): bool { - // TODO: Implement isFaultEvent() method. + return false; } /** @@ -114,7 +169,7 @@ public function isFaultEvent(): bool */ public function getFaultCode(): string|null { - // TODO: Implement getFaultCode() method. + return null; } /** @@ -122,7 +177,7 @@ public function getFaultCode(): string|null */ public function getFaultString(): string|null { - // TODO: Implement getFaultString() method. + return null; } /** @@ -130,6 +185,6 @@ public function getFaultString(): string|null */ public function getFaultDescription(): string|null { - // TODO: Implement getFaultDescription() method. + return null; } } \ No newline at end of file diff --git a/src/src/crawler/events/resp/closePaymentV1.php b/src/src/crawler/events/resp/closePaymentV1.php new file mode 100644 index 00000000..add6cea8 --- /dev/null +++ b/src/src/crawler/events/resp/closePaymentV1.php @@ -0,0 +1,197 @@ +method = new Payload($this->data['payload']); + } + + /** + * @inheritDoc + */ + public function getIuvs(): array|null + { + $value = $this->getIuv(); + return (is_null($value)) ? $this->getMethodInterface()->getIuvs() : array($value); + } + + /** + * @inheritDoc + */ + public function getPaEmittenti(): array|null + { + $value = $this->getPaEmittente(); + return (is_null($value)) ? $this->getMethodInterface()->getPaEmittenti() : array($value); + } + + /** + * @inheritDoc + */ + public function getCcps(): array|null + { + $value = $this->getCcp(); + return (is_null($value)) ? $this->getMethodInterface()->getCcps() : array($value); + } + + /** + * @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 + { + $workflow = new Workflow($this->getInsertedTimestamp()); + $workflow->setNewColumnValue('date_event', $this->getInsertedTimestamp()->format('Y-m-d')); + $workflow->setEventTimestamp($this->getInsertedTimestamp()); + $workflow->setEventId($this->getUniqueId()); + $workflow->setFkTipoEvento(MapEvents::getMethodId($this->getTipoEvento(), $this->getSottoTipoEvento())); + + $id_psp = $this->getPsp(); + $stazione = $this->getStazione(); + $canale = $this->getCanale(); + $outcome = $this->getMethodInterface()->outcome(); + + if (!is_null($id_psp)) + { + $workflow->setPsp($id_psp); + } + if (!is_null($stazione)) + { + $workflow->setStazione($stazione); + } + if (!is_null($canale)) + { + $workflow->setCanale($canale); + } + if (!is_null($outcome)) + { + $workflow->setOutcomeEvent($outcome); + } + + return $workflow; + } + + /** + * @inheritDoc + */ + public function getMethodInterface(): Payload + { + return $this->method; + } + + /** + * @inheritDoc + */ + public function getPaymentsCount(): int|null + { + return 1; + } + + /** + * @inheritDoc + */ + public function getTransferCount(int $index = 0): int|null + { + return null; + } + + /** + * @inheritDoc + */ + public function getCacheKeyPayment(int $index = 0): string|null + { + $iuv = $this->getIuv(); + $pa_emittente = $this->getPaEmittente(); + $token = $this->getPaymentToken(); + + return sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token); + } + + /** + * @inheritDoc + */ + public function getCacheKeyAttempt(int $index = 0): string|null + { + $iuv = $this->getIuv(); + $pa_emittente = $this->getPaEmittente(); + $token = $this->getPaymentToken(); + + return sprintf('attempt_%s_%s_%s', $iuv, $pa_emittente, $token); + } + + /** + * @inheritDoc + */ + public function getCacheKeyList(): array + { + $return = array(); + if (!is_null($this->getSessionIdOriginal())) + { + $key = sprintf('sessionOriginal_%s', $this->getSessionIdOriginal()); + $return[] = $key; + } + if (!is_null($this->getPaymentToken())) + { + $key = sprintf('token_%s', $this->getPaymentToken()); + $return[] = $key; + } + return $return; + } + + /** + * @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; + } +} \ No newline at end of file diff --git a/src/src/crawler/paymentlist/req/closePaymentV1.php b/src/src/crawler/paymentlist/req/closePaymentV1.php new file mode 100644 index 00000000..28a2f8c0 --- /dev/null +++ b/src/src/crawler/paymentlist/req/closePaymentV1.php @@ -0,0 +1,34 @@ +setEvent($event); + } + + /** + * @inheritDoc + */ + public function isValidPayment(int $index = 0): bool + { + return ($this->getEvent()->getIuv(0) && $this->getEvent()->getPaEmittente(0)); + } + + /** + * @inheritDoc + */ + public function isAttempt(int $index = 0): bool + { + return ($this->getEvent()->getIuv(0) && $this->getEvent()->getPaEmittente(0) && $this->getEvent()->getPaymentToken(0)); + } +} \ No newline at end of file diff --git a/src/src/crawler/paymentlist/resp/closePaymentV1.php b/src/src/crawler/paymentlist/resp/closePaymentV1.php new file mode 100644 index 00000000..07ce0bf5 --- /dev/null +++ b/src/src/crawler/paymentlist/resp/closePaymentV1.php @@ -0,0 +1,34 @@ +setEvent($event); + } + + /** + * @inheritDoc + */ + public function isValidPayment(int $index = 0): bool + { + return ($this->getEvent()->getIuv(0) && $this->getEvent()->getPaEmittente(0)); + } + + /** + * @inheritDoc + */ + public function isAttempt(int $index = 0): bool + { + return ($this->getEvent()->getIuv(0) && $this->getEvent()->getPaEmittente(0) && $this->getEvent()->getPaymentToken(0)); + } +} \ No newline at end of file diff --git a/src/tests/pagopa/events/req/closePaymentV1Test.php b/src/tests/pagopa/events/req/closePaymentV1Test.php new file mode 100644 index 00000000..1f25be35 --- /dev/null +++ b/src/tests/pagopa/events/req/closePaymentV1Test.php @@ -0,0 +1,131 @@ +event = new closePaymentV1( + [ + 'date_event' => '2024-03-10', + 'inserted_timestamp' => '2024-03-10 10:27:00.197', + 'tipoevento' => 'closePayment-v1', + 'sottotipoevento' => 'REQ', + 'iddominio' => '77777777777', + 'iuv' => '01000000000000176', + 'ccp' => 't0000000000000000000000000000176', + 'noticenumber' => '301000000000000176', + 'creditorreferenceid' => '01000000000000176', + 'paymenttoken' => 't0000000000000000000000000000176', + 'psp' => 'PSP_V1', + 'stazione' => '77777777777_01', + 'canale' => '88888888888_01', + 'sessionid' => 'sessid_100176', + 'sessionidoriginal' => 'sessidoriginal_closepayment_v2', + 'uniqueid' => 'T000178', + 'payload' => 'ewogICAgImFkZGl0aW9uYWxQYXltZW50SW5mb3JtYXRpb25zIjogewogICAgICAgICJhdXRob3JpemF0aW9uQ29kZSI6ICJQMDAwMDAwMDAwMDAwMDAwMDAwMDAwMSIsCiAgICAgICAgIm91dGNvbWVQYXltZW50R2F0ZXdheSI6ICIwIiwKICAgICAgICAidHJhbnNhY3Rpb25JZCI6ICIxMDAwMDAwMDEiCiAgICB9LAogICAgImZlZSI6IDAuNSwKICAgICJpZGVudGlmaWNhdGl2b0NhbmFsZSI6ICI4ODg4ODg4ODg4OF8wMSIsCiAgICAiaWRlbnRpZmljYXRpdm9JbnRlcm1lZGlhcmlvIjogIjg4ODg4ODg4ODg4IiwKICAgICJpZGVudGlmaWNhdGl2b1BzcCI6ICJBR0lEXzAxIiwKICAgICJvdXRjb21lIjogIk9LIiwKICAgICJwYXltZW50VG9rZW5zIjogWwogICAgICAgICJ0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE3NiIKICAgIF0sCiAgICAicHNwVHJhbnNhY3Rpb25JZCI6ICIyMjIyMjIyMjIiLAogICAgInRpbWVzdGFtcE9wZXJhdGlvbiI6ICIyMDI0LTA1LTAyVDE1OjIxOjIwLjQ5OVoiLAogICAgInRpcG9WZXJzYW1lbnRvIjogIkJQQVkiLAogICAgInRvdGFsQW1vdW50IjogMjA4LjAwCn0=', + ] + ); + } + + #[TestDox('getPaymentsCount()')] + public function testGetPaymentsCount() + { + $this->assertEquals(1, $this->event->getPaymentsCount()); + } + + #[TestDox('getFaultString()')] + public function testGetFaultString() + { + $this->assertNull($this->event->getFaultString()); + } + + #[TestDox('getPaEmittenti()')] + public function testGetPaEmittenti() + { + $value = ['77777777777']; + $this->assertEquals($value, $this->event->getPaEmittenti()); + } + + #[TestDox('getCcps()')] + public function testGetCcps() + { + $value = ['t0000000000000000000000000000176']; + $this->assertEquals($value, $this->event->getCcps()); + } + + #[TestDox('transaction()')] + public function testTransaction() + { + $this->assertNull($this->event->transaction()); + } + + #[TestDox('getTransferCount()')] + public function testGetTransferCount() + { + $this->assertNull($this->event->getTransferCount()); + } + + #[TestDox('isFaultEvent()')] + public function testIsFaultEvent() + { + $this->assertFalse($this->event->isFaultEvent()); + } + + #[TestDox('getFaultCode()')] + public function testGetFaultCode() + { + $this->assertNull($this->event->getFaultCode()); + } + + #[TestDox('getIuvs()')] + public function testGetIuvs() + { + $value = ['01000000000000176']; + $this->assertEquals($value, $this->event->getIuvs()); + } + + #[TestDox('transactionDetails()')] + public function testTransactionDetails() + { + $this->assertNull($this->event->transactionDetails(0)); + } + + #[TestDox('getMethodInterface()')] + public function testGetMethodInterface() + { + $this->assertInstanceOf(\pagopa\crawler\methods\req\closePaymentV1::class, $this->event->getMethodInterface()); + } + + #[TestDox('workflowEvent()')] + public function testWorkflowEvent() + { + $workflow = $this->event->workflowEvent(); + $this->assertEquals('29', $workflow->getReadyColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 10:27:00.197', $workflow->getReadyColumnValue('event_timestamp')); + $this->assertEquals('T000178', $workflow->getReadyColumnValue('event_id')); + $this->assertEquals('PSP_V1', $workflow->getReadyColumnValue('id_psp')); + $this->assertEquals('77777777777_01', $workflow->getReadyColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getReadyColumnValue('canale')); + $this->assertNull($workflow->getReadyColumnValue('outcome')); + $this->assertNull($workflow->getReadyColumnValue('faultcode')); + + + } + + #[TestDox('getFaultDescription()')] + public function testGetFaultDescription() + { + $this->assertNull($this->event->getFaultDescription()); + } +} diff --git a/src/tests/pagopa/events/resp/closePaymentV1Test.php b/src/tests/pagopa/events/resp/closePaymentV1Test.php new file mode 100644 index 00000000..f37afc6c --- /dev/null +++ b/src/tests/pagopa/events/resp/closePaymentV1Test.php @@ -0,0 +1,127 @@ +event = new closePaymentV1( + [ + 'date_event' => '2024-03-10', + 'inserted_timestamp' => '2024-03-10 10:27:00.197', + 'tipoevento' => 'closePayment-v1', + 'sottotipoevento' => 'RESP', + 'iddominio' => '77777777777', + 'iuv' => '01000000000000176', + 'ccp' => 't0000000000000000000000000000176', + 'noticenumber' => '301000000000000176', + 'creditorreferenceid' => '01000000000000176', + 'paymenttoken' => 't0000000000000000000000000000176', + 'psp' => 'PSP_V1', + 'stazione' => '77777777777_01', + 'canale' => '88888888888_01', + 'sessionid' => 'sessid_100176', + 'sessionidoriginal' => 'sessidoriginal_closepayment_v1', + 'uniqueid' => 'T000178', + 'payload' => 'eyJlc2l0byI6Ik9LIn0=', + ] + ); + } + + #[TestDox('getTransferCount()')] + public function testGetTransferCount() + { + $this->assertNull($this->event->getTransferCount()); + } + + #[TestDox('transaction()')] + public function testTransaction() + { + $this->assertNull($this->event->transaction()); + } + + #[TestDox('getPaEmittenti()')] + public function testGetPaEmittenti() + { + $value = ['77777777777']; + $this->assertEquals($value, $this->event->getPaEmittenti()); + } + + #[TestDox('getMethodInterface()')] + public function testGetMethodInterface() + { + $this->assertInstanceOf(\pagopa\crawler\methods\resp\closePaymentV1::class, $this->event->getMethodInterface()); + } + + #[TestDox('getFaultDescription()')] + public function testGetFaultDescription() + { + $this->assertNull($this->event->getFaultDescription()); + } + + #[TestDox('getPaymentsCount()')] + public function testGetPaymentsCount() + { + $this->assertEquals(1, $this->event->getPaymentsCount()); + } + + #[TestDox('transactionDetails()')] + public function testTransactionDetails() + { + $this->assertNull($this->event->transactionDetails(0)); + } + + #[TestDox('getFaultCode()')] + public function testGetFaultCode() + { + $this->assertNull($this->event->getFaultCode()); + } + + #[TestDox('getFaultString()')] + public function testGetFaultString() + { + $this->assertNull($this->event->getFaultString()); + } + + #[TestDox('getCcps()')] + public function testGetCcps() + { + $value = ['t0000000000000000000000000000176']; + $this->assertEquals($value, $this->event->getCcps()); + } + + #[TestDox('workflowEvent()')] + public function testWorkflowEvent() + { + $workflow = $this->event->workflowEvent(); + $this->assertEquals('30', $workflow->getReadyColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 10:27:00.197', $workflow->getReadyColumnValue('event_timestamp')); + $this->assertEquals('T000178', $workflow->getReadyColumnValue('event_id')); + $this->assertEquals('PSP_V1', $workflow->getReadyColumnValue('id_psp')); + $this->assertEquals('77777777777_01', $workflow->getReadyColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getReadyColumnValue('canale')); + $this->assertEquals('OK', $workflow->getReadyColumnValue('outcome')); + } + + #[TestDox('isFaultEvent()')] + public function testIsFaultEvent() + { + $this->assertFalse($this->event->isFaultEvent()); + } + + #[TestDox('getIuvs()')] + public function testGetIuvs() + { + $value = ['01000000000000176']; + $this->assertEquals($value, $this->event->getIuvs()); + } +} diff --git a/src/tests/phpunit.xml b/src/tests/phpunit.xml index a82bc6e2..14304a56 100644 --- a/src/tests/phpunit.xml +++ b/src/tests/phpunit.xml @@ -26,7 +26,7 @@ - process/crawler/nodoChiediAvanzamentoPagamento/T00061_WorkFlowWithNodoChiediAvanzamentoPagamento.php + process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php process/crawler/activatePaymentNotice/SingleEvent/T00001_CreateAttemptAllInfoInEvent.php @@ -81,6 +81,7 @@ process/crawler/nodoChiediInformazioniPagamento/T00059_WorkFlowWithNodoChiediInformazioniPagamento.php process/crawler/nodoInoltraEsitoPagamentoCarta/T00060_WorkFlowWithNodoInoltraEsitoPagamento.php process/crawler/nodoChiediAvanzamentoPagamento/T00061_WorkFlowWithNodoChiediAvanzamentoPagamento.php + process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php @@ -143,6 +144,7 @@ pagopa/events/req/activatePaymentNoticeV2Test.php pagopa/events/req/pspNotifyPaymentV2Test.php pagopa/events/req/closePaymentV2Test.php + pagopa/events/req/closePaymentV1Test.php pagopa/events/req/nodoChiediInformazioniPagamentoTest.php pagopa/events/req/nodoInoltraEsitoPagamentoCartaTest.php pagopa/events/req/nodoChiediAvanzamentoPagamentoTest.php @@ -161,6 +163,7 @@ pagopa/events/resp/activateIOPaymentTest.php pagopa/events/resp/pspNotifyPaymentV2Test.php pagopa/events/resp/closePaymentV2Test.php + pagopa/events/resp/closePaymentV1Test.php pagopa/events/resp/nodoChiediInformazioniPagamentoTest.php pagopa/events/resp/nodoInoltraEsitoPagamentoCartaTest.php pagopa/events/resp/nodoChiediAvanzamentoPagamentoTest.php diff --git a/src/tests/process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php b/src/tests/process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php new file mode 100644 index 00000000..f03e2989 --- /dev/null +++ b/src/tests/process/crawler/closePaymentV1/T00062_WorkFlowWithClosePaymentV1.php @@ -0,0 +1,172 @@ +getTransaction(new \DateTime('2024-03-10'), '01000000000000183'); + $this->assertEquals('2024-03-10 13:38:00.197', $transaction->getColumnValue('inserted_timestamp')); + $this->assertEquals('01000000000000183', $transaction->getColumnValue('iuv')); + $this->assertEquals('77777777777', $transaction->getColumnValue('pa_emittente')); + $this->assertEquals('t0000000000000000000000000000183', $transaction->getColumnValue('token_ccp')); + $this->assertEquals('80.00', $transaction->getColumnValue('importo')); + $this->assertEquals('77777777777_01', $transaction->getColumnValue('stazione')); + $this->assertEquals('AGID_01', $transaction->getColumnValue('id_psp')); + $this->assertEquals('88888888888_01', $transaction->getColumnValue('canale')); + $this->assertEquals('CHECKOUT', $transaction->getColumnValue('touchpoint')); + $this->assertEquals('OK', $transaction->getColumnValue('esito')); + $this->assertNull($transaction->getReadyColumnValue('payment_type')); + $this->assertNull($transaction->getReadyColumnValue('id_carrello')); + + } + + + #[TestDox('[DETAILS] Verifica assenza dettagli')] + public function testTransactionDetails() + { + $transaction = self::$db->getTransaction(new \DateTime('2024-03-10'), '01000000000000183' ); + + $details = self::$db->getTransactionDetails($transaction, 0); + $this->assertEquals(1, $details->getColumnValue('id_transfer')); + $this->assertEquals('77777777777', $details->getColumnValue('pa_transfer')); + $this->assertEquals('IT18U0000000000000000000001', $details->getColumnValue('iban_transfer')); + $this->assertEquals('80.00', $details->getColumnValue('amount_transfer')); + $this->assertNull($details->getColumnValue('iur')); + $this->assertFalse($details->getColumnValue('is_bollo')); + + } + + #[TestDox('[WORKFLOW] Verifica presenza eventi Workflow')] + public function testWorkFlow() + { + $transaction = self::$db->getTransaction(new \DateTime('2024-03-10'), '01000000000000183'); + + $workflow = self::$db->getWorkFlow($transaction, 0); + $this->assertEquals('1', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:38:00.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000206', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertNull($workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 1); + $this->assertEquals('2', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:38:01.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000207', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertEquals('OK', $workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 2); + $this->assertEquals('29', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:39:00.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000208', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertNull($workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 3); + $this->assertEquals('30', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:39:01.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000209', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertEquals('OK', $workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 4); + $this->assertEquals('15', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:40:00.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000210', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertNull($workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 5); + $this->assertEquals('16', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:40:01.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000211', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertEquals('OK', $workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 6); + $this->assertEquals('5', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:41:00.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000212', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertEquals('OK', $workflow->getColumnValue('outcome')); + + $workflow = self::$db->getWorkFlow($transaction, 7); + $this->assertEquals('6', $workflow->getColumnValue('fk_tipoevento')); + $this->assertEquals('2024-03-10 13:41:01.197', $workflow->getColumnValue('event_timestamp')); + $this->assertEquals('T000213', $workflow->getColumnValue('event_id')); + $this->assertEquals('77777777777_01', $workflow->getColumnValue('stazione')); + $this->assertEquals('88888888888_01', $workflow->getColumnValue('canale')); + $this->assertEquals('AGID_01', $workflow->getColumnValue('id_psp')); + $this->assertEquals('OK', $workflow->getColumnValue('outcome')); + + } + + #[TestDox('[EXTRA INFO] Verifica delle informazioni extra')] + public function testExtraInfo() + { + $transaction = self::$db->getTransaction(new \DateTime('2024-03-10'), '01000000000000183'); + $extra_info_rrn = self::$db->getExtraInfo($transaction, 'rrn'); + $this->assertEquals('111111111111', $extra_info_rrn->getColumnValue('info_value')); + $extra_info_rrn = self::$db->getExtraInfo($transaction, 'authcode'); + $this->assertEquals('111115', $extra_info_rrn->getColumnValue('info_value')); + } + #[TestDox('[ReEvent] Verifica stato evento')] + public function testEvent() + { + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 206); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 207); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 208); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 209); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 210); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 211); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 212); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + $event = self::$db->getReEvent(new \DateTime('2024-03-10'), 213); + $this->assertEquals('LOADED', $event->getColumnValue('state')); + + } + +}