Annotation Interface PreCheckoutHandler
@Retention(RUNTIME)
@Target(METHOD)
@Repeatable(PreCheckoutHandlers.class)
public @interface PreCheckoutHandler
Annotation for handling pre-checkout query events in a declarative manner.
Designed specifically for handling events when users initiate payment processes,
providing validation and processing capabilities before completing transactions.
This annotation enables structured handling of payment pre-authorization with
filtering options for payload content, regular expressions, and custom logic
for validating and processing payment requests.
Equivalent with using
Equivalent with using
BotClient.onPreCheckout(FilterExecutor, UpdateHandler)- Since:
- 1.2.0
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends CustomFilter> Custom filter class for advanced filtering of pre-checkout query events.String[]Specifies the payment payload identifiers to match in pre-checkout queries.intPriority order for handler registration and execution.Regular expression pattern to match against payment payload content.
-
Element Details
-
payload
String[] payloadSpecifies the payment payload identifiers to match in pre-checkout queries. Multiple payload values are combined using OR logic - the handler will trigger if the payment payload matches any of the specified identifiers.- Returns:
- array of payload identifier strings to match
- Default:
{}
-
regex
String regexRegular expression pattern to match against payment payload content. The handler will trigger if the payment payload matches the specified regex pattern.- Returns:
- regex pattern string for payload matching
- Default:
""
-
filter
Class<? extends CustomFilter> filterCustom filter class for advanced filtering of pre-checkout query events. Use this to implement custom logic for determining which payment requests should trigger this handler, such as filtering by payment amount, currency, user payment history, inventory availability, or other business rules.- Returns:
- class implementing
CustomFilterinterface
- Default:
io.github.natanimn.telebof.filters.DefaultCustomFilter.class
-
priority
int priorityPriority order for handler registration and execution. Handlers with lower priority numbers are registered and executed before those with higher numbers.- Returns:
- priority integer value (lower = earlier execution)
- Default:
0
-