wultra / enrollment-server

Base implementation of the enrollment server, usable as the stub for project bootstrapping.
GNU Affero General Public License v3.0
4 stars 1 forks source link

Add ui.templates to Operation Detail #1073

Closed banterCZ closed 2 months ago

banterCZ commented 2 months ago

Add an option to define templates attribute in es_operation_template.ui. There is no need to model that on the Java side extensively.

It should return a similar example in the operation detail.

{
    "status": "OK",
    "currentTimestamp": "2023-02-10T12:30:42+0000",
    "responseObject": [
        {
            "id": "930febe7-f350-419a-8bc0-c8883e7f71e3",
            "name": "authorize_payment",
            "data": "A1*A100CZK*Q238400856/0300**D20170629*NUtility Bill Payment - 05/2017",
            "operationCreated": "2018-08-08T12:30:42+0000",
            "operationExpires": "2018-08-08T12:35:43+0000",
            "allowedSignatureType": {
                "type": "2FA",
                "variants": [
                    "possession_knowledge",
                    "possession_biometry"
                ]
            },
            "formData": {
                "title": "Potvrzení platby",
                "message": "Dobrý den,prosíme o potvrzení následující platby:",
                "attributes": [
                    {
                        "type": "AMOUNT",
                        "id": "operation.amount",
                        "label": "Částka",
                        "amount": 965165234082.23,
                        "currency": "CZK"
                    },
                    {
                        "type": "AMOUNT_CONVERSION",
                        "id": "operation.conversion",
                        "label": "Conversion",
                        "dynamic": true,
                        "sourceAmount": 1.26,
                        "sourceCurrency": "ETC",
                        "targetAmount": 1710.98,
                        "targetCurrency": "USD"
                    }
                ]
            },
            "ui": {
                "flipButtons": false,
                "blockApprovalOnCall": true,
                "templates": {
                    "list": {
                        "title": null,
                        "message": "operation.amount",
                        "image": null,
                        "style": "POSITIVE"
                    },
                    "history": null,
                    "detail": {
                        "style": null,
                        "headerSection": false,
                        "sections": [
                            {
                                "style": "MONEY",
                                "cells": [
                                    {
                                        "name": "operation.amount",
                                        "visibleTitle": false,
                                        "style": null,
                                        "canCopy": true,
                                        "collapsable": "NO"
                                    },
                                    {
                                        "name": "operation.conversion",
                                        "style": null,
                                        "canCopy": true,
                                        "collapsable": "NO"
                                    },
                                    {
                                        "name": "operation.conversion2",
                                        "visibleTitle": true,
                                        "style": null,
                                        "canCopy": false,
                                        "collapsable": "COLLAPSED"
                                    }
                                ]
                            }
                        ]
                    }
                }
            }
        }
    ]
}