Skip to content

Customizing Operation Form Data

Roman Štrobl edited this page Mar 20, 2018 · 30 revisions

When creating an operation, you can customize the operation form data. This customization has an effect on how the operation form data is displayed during the operation review step.

The customization should be done by the client which initiates the operation before the authentication process is initiated.

For more information about operation form data see the Next Step REST API.

Standard Operation Form Data Attributes

Following attributes are required to be specified for each operation:

  • title - title of the operation
  • greeting - message for the user related to the operation displayed in web interface
  • summary - summary of the operation shown in push messages

Custom Operation Form Data Attributes

Following structured custom form data attributes are available:

  • AMOUNT - amount with currency
  • NOTE - free text
  • BANK_ACCOUNT_CHOICE - choice of a bank account
  • KEY_VALUE - generic key-value field

Value Formatting

Following form data attributes support value formatting:

  • AMOUNT
  • NOTE
  • KEY_VALUE

The value is formatted based on specified format type. The following format types can be used:

  • TEXT - value is not formatted
  • LOCALIZED_TEXT - value is localized using localization key from message resources
  • DATE - value is formatted as date using current locale, expected value format is YYYY-MM-DD
  • NUMBER - value is formatted as number using current locale
  • AMOUNT - value is formatted as amount with currency using current locale
  • ACCOUNT - value is not formatted (reserved for future use)

Resource Localization

Form data labels are specified using localization key, such as "operation.title". This key is localized using resources. See chapter Customizing Web Flow Appearance for details about updating resources.

Form data value localization:

  • Form data values are localized in case they use the LOCALIZED_TEXT value format type.
  • Currency in AMOUNT form data type is localized using message resource: currency.[currency].name.

Other form data values are not localized and are displayed as received.

Resource Translation

Resource translation is process of inserting other form data values into existing values.

Example:

operation.summary=Hello, please confirm payment {operation.amount} {operation.currency} to account {operation.account}.

Summary is translated into:

operation.summary=Hello, please confirm payment 100 CZK to account 12345678/0123.

Resource translation is performed on following attribute values:

  • title
  • greeting
  • summary

Java API for Operation Form Data

See example below:

// variable definition
String account = "238400856/0300";
BigDecimal amount = BigDecimal.valueOf(100);
String currency = "CZK";
String note = "Utility Bill Payment - 05/2017";
String dueDate = "2017-06-29";

// operation form data initialization
OperationFormData formData = new OperationFormData();
formData.addTitle("operation.title");
formData.addGreeting("operation.greeting");
formData.addSummary("operation.summary");
formData.addAmount("operation.amount", amount, "operation.currency", currency);
formData.addKeyValue("operation.account", account, OperationFormFieldAttributeFormatted.ValueFormatType.ACCOUNT);
formData.addKeyValue("operation.dueDate", dueDate, OperationFormFieldAttributeFormatted.ValueFormatType.DATE);
formData.addNote("operation.note", note, OperationFormFieldAttributeFormatted.ValueFormatType.TEXT);

// sample operation configuration for bank account choice select
OperationFormFieldConfig bankAccountConfig = new OperationFormFieldConfig();
bankAccountConfig.setId("operation.bankAccountChoice");
bankAccountConfig.setEnabled(false);
bankAccountConfig.setDefaultValue("CZ4043210000000087654321");
formData.getConfig().add(bankAccountConfig);

// operation initialization
final ObjectResponse<CreateOperationResponse> payment = client.createOperation("authorize_payment", data, formData, null);
session.setAttribute("operationId", payment.getResponseObject().getOperationId());
Clone this wiki locally