Automatically add layoutset when adding a payment task in Studio
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.jsonfile for the layout-set, the receipt layout name should be specified in thepdfLayoutNamefield.
- In the
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
pdfLayoutNamefield in theSettings.jsonfile. This is a general setting that should be available for all layoutsets for tasks ofdatatype 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
Paymentcomponent 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
Paymentcomponent as specified above.
- [ ] The added layoutset contains a default layout, which is set up with the
- [x] When a payment task is deleted, the corresponding layoutset is deleted.
This should be made in a generic way for all tasks. We should include custom handling of the payment task type.
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?)
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.
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 🤔
Reviewed this issue, but we need more details in Refinement tomorrow.
Tested OK in dev!