Skip to content

Commit

Permalink
add extra information
Browse files Browse the repository at this point in the history
  • Loading branch information
esposimo committed Apr 10, 2024
1 parent 02cddd1 commit 07a1618
Show file tree
Hide file tree
Showing 8 changed files with 442 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sql/01_2024_create_types_touchpoint.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
create type TOUCHPOINT_TYPE as ENUM ('TOUCHPOINT_PSP','TOUCHPOINT_PSP_OLD', 'CHECKOUT', 'APP_IO', 'TOUCHPOINT_EC', 'TOUCHPOINT_EC_OLD');
create type TOUCHPOINT_TYPE as ENUM ('TOUCHPOINT_PSP','TOUCHPOINT_PSP_OLD', 'CHECKOUT', 'APP_IO', 'TOUCHPOINT_EC', 'TOUCHPOINT_EC_OLD', 'NO_NAV_PSP');
create type PAYMENT_TYPE as ENUM ('CC', 'PPAL', 'BPAY', 'APPL', 'GOOG', 'MYBK', 'RBPR','RBPB', 'RBPP', 'RPIC', 'RBPS');
create type TRANSFER_TYPE as ENUM ('ACTIVATE_PAYMENT_LIST','ACTIVATE_TRANSFER_LIST', 'PA_PAYMENT_LIST', 'PA_TRANSFER_LIST', 'PSP_PAYMENT_LIST','PSP_TRANSFER_LIST');
1 change: 1 addition & 0 deletions src/sql/01_2024_seq.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ create sequence public.transaction_2024_id_seq;
create sequence public.transaction_2024_details_id_seq;
create sequence public.transaction_2024_events_id_seq;
create sequence public.metadata_2024_id_seq;
create sequence public.extra_information_2024_id_seq;


11 changes: 11 additions & 0 deletions src/sql/02_2024_create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ create table if not exists public.metadata_2024 (
)
PARTITION BY RANGE (date_event);


create table if not exists public.extra_info_2024 (
id bigint default nextval('public.extra_information_2024_id_seq'::regclass) not null,
date_event date not null,
fk_payment bigint null,
info_name varchar(20) not null,
info_value varchar(80) not null,
constraint "EXTRA_INFO_2024_pk" primary key (date_event, id)
)
PARTITION BY RANGE (date_event);

create table if not exists public.mapped_events (
tipo_evento varchar(50) not null,
sotto_tipo_evento varchar(15) not null,
Expand Down
389 changes: 388 additions & 1 deletion src/sql/03_2024_create_partitions.sql

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/src/crawler/CacheObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static function createInstance() : self
'transfer_added' => false,
'esito' => false,
'amount_update' => false,
'extra_info' => array(),
'transfer_list' => array(),
'm_payment' => array(),
'm_transfer' => array(),
Expand Down Expand Up @@ -335,6 +336,25 @@ public function setMetadataTransfer(array $transfer_list_metadata) : void
$this->setKey('m_transfer', $transfer_list_metadata);
}

/**
* Restituisce le info extra presenti nell'oggetto in cache
* @return array
*/
public function getExtraInfo() : array
{
return $this->getKey('extra_info');
}

/**
* Configura le extra info aggiunte per il pagamento al fine di salvarle in cache
* @param array $extra_info
* @return void
*/
public function setExtraInfo(array $extra_info) : void
{
$this->setKey('extra_info', $extra_info);
}

public function getCacheData() : array
{
return $this->cache_data;
Expand Down
9 changes: 9 additions & 0 deletions src/src/crawler/PaymentListInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,13 @@ public function createMetadataDetails(CacheObject $cache, int $index = 0): array
* @return array|null
*/
public function updateMetadataDetails(CacheObject $cache, int $index = 0): array|null;


/**
* Esegue il metodo per aggiungere informazioni extra in formato metadata al pagamento
* @param CacheObject $cache
* @param int $index
* @return array|null
*/
public function createExtraInfo(CacheObject $cache, int $index = 0): array|null;
}
11 changes: 11 additions & 0 deletions src/src/crawler/paymentlist/AbstractPaymentList.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ public function runAnalysisSingleEvent() : void
$refresh_cache = $this->updateTransaction(new CacheObject($cache_value), $ck);
$refresh_cache = $this->updateDetails(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->updateMetadataDetails(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->createExtraInfo(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->workflow(new CacheObject($refresh_cache), $ck);
$new_cache_data[] = $refresh_cache;
// add/update details to $cache_value and return new value
Expand All @@ -322,6 +323,7 @@ public function runAnalysisSingleEvent() : void
$refresh_cache = $this->createTransaction($i);
$refresh_cache = $this->detailsTransaction(new CacheObject($refresh_cache), $i);
$refresh_cache = $this->createMetadataDetails(new CacheObject($refresh_cache), $i);
$refresh_cache = $this->createExtraInfo(new CacheObject($refresh_cache), $i);
$refresh_cache = $this->workflow(new CacheObject($refresh_cache), $i);
$this->addValueCache($cache_key,$refresh_cache);
// create transaction and return a new cache value
Expand Down Expand Up @@ -353,6 +355,7 @@ public function runAnalysisSingleEvent() : void
$refresh_cache = $this->updateTransaction(new CacheObject($cache_value), $ck);
$refresh_cache = $this->updateDetails(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->updateMetadataDetails(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->createExtraInfo(new CacheObject($refresh_cache), $ck);
$refresh_cache = $this->workflow(new CacheObject($refresh_cache), $ck);
$new_cache_data[] = $refresh_cache;
// add/update details to $cache_value and return new value
Expand Down Expand Up @@ -519,4 +522,12 @@ public function updateMetadataDetails(CacheObject $cache, int $index = 0): array
{
return $cache->getCacheData();
}


public function createExtraInfo(CacheObject $cache, int $index = 0): array|null
{
return $cache->getCacheData();
}


}
2 changes: 1 addition & 1 deletion src/tests/.phpunit.result.cache

Large diffs are not rendered by default.

0 comments on commit 07a1618

Please sign in to comment.