configureHook static method
Configure the transaction/initialization webhook.
Build hook with the chainable Hook().initiate(url).transaction(url) — the
SDK POSTs {"data":"<payload>"} to those endpoint(s) after each transaction
and after initialization, with the hook's headers applied (plus auto
X-Device-Id / X-Device-Time). Delivery is background, internet-gated, and
retried 5× at 1-minute intervals. Safe to call before initiate.
encryptor optionally transforms the base64 payload before it is sent
(e.g. to encrypt it); it is invoked over the bridge at notify time and its
return value becomes the data sent. When null, the base64 payload is
sent as-is.
Implementation
static Future<void> configureHook(
Hook hook, {
String Function(String data)? encryptor,
}) {
final params = {
'transactionUrl': hook.transactionUrl,
'initiateUrl': hook.initiateUrl,
'headers': hook.headers,
};
final cbs = (encryptor == null) ? null : {'encryptor': encryptor};
return _bridge.invoke('configureHook', params: params, callbacks: cbs);
}