getCheckoutStatus method
Future<InappifySdkResult<InappifyCheckoutResult> >
getCheckoutStatus(
- InappifyCheckoutStatusRequest request
inherited
Reads one authoritative checkout status.
Implementation
@override
Future<InappifySdkResult<InappifyCheckoutResult>> getCheckoutStatus(
InappifyCheckoutStatusRequest request,
) async {
final cancelled = _preCancelled<InappifyCheckoutResult>(
'getCheckoutStatus',
request.cancellation,
);
if (cancelled != null) return cancelled;
if (request.checkoutId.isEmpty) {
return _invalid<InappifyCheckoutResult>(
'getCheckoutStatus',
'A checkoutId is required.',
);
}
return _run<InappifyCheckoutResult>(
'getCheckoutStatus',
action: () async {
final raw = await _bridge.call(
'getCheckoutStatus',
positionalArguments: <Object?>[
request.checkoutId,
if (request.cancellation != null) const <String, Object?>{},
],
cancellation: request.cancellation,
injectAbortSignal: request.cancellation != null,
);
final checkout = InappifyWebPayloadCodec.checkout(raw);
_recordCheckoutState(checkout);
return checkout;
},
cancellation: request.cancellation,
);
}