Validation
Payment Adjustment is capable of validation at different levels dependent upon configuration.
Cancellation Time Validator
The purpose of this validator is to determine if there is sufficient time left to cancel a payment.
This is brought in as a Spring Bean of class CancellationTimeValidator.
It contains a single method: isItOkToCancelTransaction(String id, OffsetDateTime transactionScheduledTime).
This method first checks the transaction is not scheduled for the past; if it is, it will return false.
Secondly, it compares a configured cut-off time against the current time.
If the current time is within the cut-off time, then it is deemed too late to cancel the transaction and the method will return false. Otherwise it will return true.
To configure the cut-off time, you can amend the Duration at configuration path ipf.payment-adjustment.cancellation.request.allowed-time.
The default for this configuration is 2 hours.
Message Component Validator
The purpose of this validator is to validate the request object (e.g. the PaymentCancellationRequest).
This needs to be injected as a MessageComponentValidator Spring Bean in your application.
Further reading on this object can be found at core:iso20022-model:features/validations.adoc#messagecomponentvalidator
The ValidationOptions passed to the MessageComponentValidator.validate method can be configured as shown below in Configuration.
Payment Cancellation Request Validation Service
The purpose of this validator is to apply specific checks against the contents of the cancellation request by comparing fields. The failure messages this service returns demonstrate the checks taking place. Two examples of the failure messages are:
-
"if payload.content.undrlyg.orgnlPmtInfAndCxl.pmtInfCxl is true then payload.content.Undrlyg.orgnlPmtInfAndCxl.txInf must be empty"
-
"if payload.content.Undrlyg.orgnlPmtInfAndCxl.txInf.cxlRsnInf.rsn.prtry has a value then payload.content.undrlyg.orgnlPmtInfAndCxl.pmtInfCxl must be false"
This validator is brought in as a Spring Bean of class PaymentCancellationRequestValidationService.
This Spring Bean accepts an optional jakarta.validation.Validator as a constructor argument, meaning you can inject your own jakarta.validation.Validator Spring Bean into the application to further customise validation.
You can skip the use of this validator by setting the configuration path ipf.payment-adjustment.cancellation.request.skipping-payment-adjustment-validation to true.
Configuration
Below are the configuration options for validating a request within the Payment Adjustment server modules.
Property Grouping: ipf.payment-adjustment.cancellation.request
| Key | Description | Default Value |
|---|---|---|
ipf.payment-adjustment.cancellation.request.allowed-time |
Used in the CancellationTimeValidator to determine if it is too late to cancel a transaction. |
|
ipf.payment-adjustment.cancellation.request.iso-20022-validation.business-rule-validation |
Sets the |
|
ipf.payment-adjustment.cancellation.request.iso-20022-validation.fail-if-message-rules-have-not-been-implemented |
Sets the |
|
ipf.payment-adjustment.cancellation.request.iso-20022-validation.message-rule-validation |
Sets the |
|
ipf.payment-adjustment.cancellation.request.iso-20022-validation.schema-validation |
Sets the |
|
ipf.payment-adjustment.cancellation.request.skipping-payment-adjustment-validation |
When |
|
ipf.payment-adjustment.cancellation.request.skipping-validation |
When |
|