# Evm Digital Products ```plantuml @startuml Acquiring/Syncing Product List participant "evm-product" as p participant "evm-digital-products" as d participant "third-party" as t participant "cronjob" as c database "product-db" as pdb database "digipro-db" as ddb == Acquiring/Syncing Product List == c -> d: Invoke Product Sync activate d d -> t: Request Product Data activate t t -> d: Return Product Data deactivate t d -> ddb: Store Product Data d --\ p: Product List Updated Event deactivate d activate p p -> pdb: Store Product Data deactivate p @enduml ``` ```plantuml @startuml Fetching Product List participant "frontend" as f participant "evm-product" as p database "product-db" as pdb == Fetching Product List == f -> p: Get Product List activate p p -> pdb: Fetch Product Data pdb -> p: Return Product Data p -> f: Return Product List deactivate p @enduml ``` ```plantuml @startuml Digital Product Transaction participant "frontend" as f participant "evm-order" as o participant "evm-digital-products" as d participant "third-party" as t database "order-db" as odb database "digipro-db" as ddb == Transaction Flow == f -> o: Submit Order activate o o --\ d: Order Processing Event activate d o -> f: Respond deactivate o loop If transaction failed and fallback exists d -> t: Create Transaction activate t t -> d: Respond deactivate t d -> ddb: Store Transaction end d --\ o: Transaction Progression Event note over d, o: Event could be transaction processing, success, or failed. deactivate d activate o o -> odb: Update Order Status deactivate o group Third Party Requires Webhook t -> d: Transaction Update Webhook activate d d -> ddb: Update Transaction Status note over d, t: If transaction failed and fallback exists, create new transaction group Transaction Includes Receipt d -> ddb: Store Transaction Receipt end d --\ o: Transaction Progression Event note over d, o: Event could be transaction success or failed. deactivate d activate o o -> odb: Update Order Status deactivate o end @enduml ``` ```plantuml @startuml Digital Products ERD ' hide the spot hide circle ' avoid problems with angled crows feet skinparam linetype ortho entity "product_v2" { *product_code: varchar(20) <<PK>> *category: varchar(20) <<FK>> *operator: varchar(20) <<FK>> -- *name: varchar(30) *nominal: decimal(12,2) *vendor_price: decimal(12,2) *recommendation_sell_price: decimal(12,2) *status: enum('active','inactive') *created_at: timestamp *updated_at: timestamp } entity "provider_product" { *product_code: varchar(20) <<PK>> *product_provider_code: varchar(20) <<PK>> *provider_code: varchar(20) <<PK>> -- *buy_price: decimal(12,2) *name: varchar(30) *nominal: decimal(12,2) *status: enum('active','inactive','removed') *priority: integer *created_at: timestamp *updated_at: timestamp } entity "provider" { *code: varchar(20) <<unique>> -- *name: varchar(255) } entity "product_category_v2" { *code: varchar(20) <<PK>> <<unique>> -- *name: varchar(255) } entity "operator" { *code: varchar(20) <<PK>> <<unique>> *category : varchar(20) <<FK>> -- *name: varchar(255) *type: enum('mobile','bills') } entity "transaction_v2" { *entity_id: uuid <<PK>> -- *client_code: varchar(20) *user_id: varchar(36) *customer_id: varchar(20) *reference: varchar(36) *provider_transaction_id: varchar(255) *provider_transaction_status: varchar(255) *product_provider_code: varchar(20) *provider_code: varchar(20) *serial_number: varchar(255) *status: enum('new','requestFailed','processing','completed','failed') *ps_product_code: varchar(20) *ps_category: varchar(20) *ps_operator: varchar(20) *ps_name: varchar(255) *ps_nominal: decimal(12,2) *ps_vendor_price: decimal(12,2) *ps_recommendation_sell_price: decimal(12,2) *inquiry: json *receipt: json *created: timestamp } product_v2 ||..|{ provider_product provider_product }|..|| provider product_category_v2 }|..|| product_v2 product_category_v2 }|..|| operator operator }|..|| product_v2 @enduml ``` **product_category_v2** | code | name | | --- | --- | | voice | Pulsa | | electricity | PLN | | data | Kuota Data | | water | PDAM | **operator** | code | category | type | name | | --- | --- | --- | --- | | tsel | voice | mobile | Telkomsel | | pln | electricity | bills | PLN | | pdam | water | bills | PDAM | **provider** | code | name | | --- | --- | | kudo | Grab Pulsa | | awd | AWD | **product_v2** | product_code | category | operator | nominal | vendor_price | status | | --- | --- | --- | --- | --- | --- | | VOICE-TSEL-100 | voice | tsel | 100.000 | 95.000 | active | | VOICE-TSEL-POSTPAID | voice | tsel | null | null | active | | DATA-TSEL-100 | voice | tsel | 100.000 | 95.000 | active | | ELEC-PLN-20 | electricity | pln | 20.000 | 19.500 | active | | ELEC-PLN-POSTPAID | electricity | pln | null | null | active | | WATER-PDAM-50 | water | pdam | 50.000 | 48.000 | active | **provider_product** | provider_code | provider_product_code |product_code | | --- | --- | --- | | kudo | TSV100 | VOICE-TSEL-100 | | awd | SH100 | VOICE-TSEL-100 |