altinn-studio icon indicating copy to clipboard operation
altinn-studio copied to clipboard

Automatically add layoutset when adding a payment task in Studio

Open framitdavid opened this issue 1 year ago • 5 comments

Description

There needs to be a layoutset associated with the payment task, to render the payment step. When adding a payment task to the process in Studio, we should automatically trigger adding the associated layoutset.

In addition, there are some requirements for the content of the payment layout - it needs to contain thePayment component. The payment layoutset should therefore include a default payment layout that contains the Payment component:

{
  "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/layout.schema.v1.json",
  "data": {
    "layout": [
      {
        "id": "test",
        "type": "Payment",
        "renderAsSummary": true
      }
    ]
  }
}

This is technically all that is needed, although we should provide some more components to allow app developers to customize both the payment layout, and payment receipt layout.

Open questions:

  • [x] Which form components should be available to add/edit in the layouts for a payment task? Are there any restrictions?
    • Only text/info components should be available. For simplicity, we should restrict to only text components.
  • [x] Do we always need both a task layout and a receipt layout?
    • No, if no receipt layout is provided then the task layout will be used.
  • [x] How do we specify which layout in the payment layoutset is the task layout, and which is the receipt layout?
    • In the Settings.json file for the layout-set, the receipt layout name should be specified in the pdfLayoutName field.

In scope:

  • Ensure that layoutset with default payment layout is added automatically together with payment task.

Out of scope:

  • Setting a layout in a layoutSet to the pdfLayoutName field in the Settings.json file. This is a general setting that should be available for all layoutsets for tasks of data type as well, so this is something we should solve in general. https://github.com/Altinn/altinn-studio/issues/12829
  • Ensuring that only text components and Payment component are available in layouts for payment task. https://github.com/Altinn/altinn-studio/issues/12830

Acceptance criteria

  • [x] When a payment task is added, a new corresponding layoutset is added
    • [ ] The added layoutset contains a default layout, which is set up with the Payment component as specified above.
  • [x] When a payment task is deleted, the corresponding layoutset is deleted.

framitdavid avatar May 14 '24 22:05 framitdavid

This should be made in a generic way for all tasks. We should include custom handling of the payment task type.

ghost avatar May 15 '24 08:05 ghost

When doing this in a generic way we need to remember implementing it in such a way that we can see and edit the name of the layoutset. All other tasks than data-tasks should also have the possibility to delete the connected layoutset. (or is that inconsistent - UX question to consider?)

standeren avatar May 21 '24 07:05 standeren

I have updated the description and title of this issue. After discussion with Apps, we have found that the layoutset for payment task is always required, there is no default. The layoutset is to contain both the task layout and payment receipt layout. There are some open questions around how this is to work, and I have blocked the issue until those questions are resolved.

nkylstad avatar May 21 '24 12:05 nkylstad

Tested OK in dev! A new layoutset is automatically created when a new payment task is added. Not sure if I should move this issue to Todo or Done as the automatic creation of a layoutset seems to be a subtask 🤔

mlqn avatar May 22 '24 12:05 mlqn

Reviewed this issue, but we need more details in Refinement tomorrow.

Ildest avatar May 28 '24 11:05 Ildest

Tested OK in dev!

mlqn avatar Jul 18 '24 08:07 mlqn