-
Notifications
You must be signed in to change notification settings - Fork 9
Customizing Operation Form Data
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.
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
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 -
BANNER
- banner which is displayed above form field -
HEADING
- heading with label -
PARTY_INFO
- information about party
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)
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 for custom attributes:
- 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 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
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, ValueFormatType.ACCOUNT);
formData.addKeyValue("operation.dueDate", dueDate, ValueFormatType.DATE);
formData.addNote("operation.note", note, 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());
Operation form data can be decorated in Data Adapter by implementing method decorateFormData
. The additional form attributes appear during the operation review step (after the user was authenticated and operation authorization is required).
The example below decorates operation form data -- three bank accounts are added to the BANK_ACCOUNT_CHOICE
attribute:
List<BankAccount> bankAccounts = new ArrayList<>();
BankAccount bankAccount1 = new BankAccount();
bankAccount1.setName("Běžný účet v CZK");
bankAccount1.setBalance(new BigDecimal("24394.52"));
bankAccount1.setNumber("12345678/1234");
bankAccount1.setAccountId("CZ4012340000000012345678");
bankAccount1.setCurrency("CZK");
bankAccounts.add(bankAccount1);
BankAccount bankAccount2 = new BankAccount();
bankAccount2.setName("Spořící účet v CZK");
bankAccount2.setBalance(new BigDecimal("158121.10"));
bankAccount2.setNumber("87654321/4321");
bankAccount2.setAccountId("CZ4043210000000087654321");
bankAccount2.setCurrency("CZK");
bankAccounts.add(bankAccount2);
BankAccount bankAccount3 = new BankAccount();
bankAccount3.setName("Spořící účet v EUR");
bankAccount3.setBalance(new BigDecimal("1.90"));
bankAccount3.setNumber("44444444/1111");
bankAccount3.setAccountId("CZ4011110000000044444444");
bankAccount3.setCurrency("EUR");
bankAccount3.setUsableForPayment(false);
bankAccount3.setUnusableForPaymentReason(dataAdapterI18NService.messageSource().getMessage("operationReview.balanceTooLow", null, LocaleContextHolder.getLocale()));
bankAccounts.add(bankAccount3);
boolean choiceEnabled = true;
String defaultValue = "CZ4012340000000012345678";
List<FormFieldConfig> configs = formData.getConfig();
for (FormFieldConfig config: configs) {
if ("operation.bankAccountChoice".equals(config.getId())) {
choiceEnabled = config.isEnabled();
// You should check the default value against list of available accounts.
defaultValue = config.getDefaultValue();
}
}
Attribute attr = formData.addBankAccountChoice(BANK_ACCOUNT_CHOICE_ID, bankAccounts, choiceEnabled, defaultValue);
The example below decorates operation form data by adding banner above the BANK_ACCOUNT_CHOICE
attribute which was previously added:
formData.addBannerBeforeField(BannerType.BANNER_WARNING, "banner.invalidAccount", attr);
The example below decorates operation form data by adding information about third party:
// Add information about 3rd party
PartyInfo partyInfo = new PartyInfo();
partyInfo.setName("Tesco");
partyInfo.setLogoURL("https://itesco.cz/img/logo/logo.svg");
partyInfo.setDescription("Objevte více příběhů psaných s chutí");
partyInfo.setWebsiteURL("https://itesco.cz/hello/vse-o-jidle/pribehy-psane-s-chuti/clanek/tomovy-burgery-pro-zapalene-fanousky/15012");
formData.addPartyInfo("operation.partyInfo", partyInfo);
In order to add party information before an existing field instead of appending it after last field, use the addPartyInfoBeforeField()
method.
Overview
Applications
- Web Flow Server
- Next Step Server
- Data Adapter
- Mobile Token
- PowerAuth Server
- PowerAuth Admin
- PowerAuth Push Server
REST APIs
- NextStep Server REST API Reference
- Data Adapter REST API Reference
- Web Flow REST API Reference
- Mobile Push Registration API
- Mobile Token REST API Reference
Deployment
Customizing Web Flow
- Customizing Web Flow Appearance
- Implementing Data Adapter Interface
- Web Flow Configuration
- Configuring Next Step Definitions
- Customizing Operation Form Data
- Mobile Token Configuration
Technical Notes
Development
Releases