checkout method
Future<NimbblCheckoutPaymentResponse?>
checkout(
- NimbblCheckoutOptions options
)
Implementation
Future<NimbblCheckoutPaymentResponse?> checkout(
NimbblCheckoutOptions options) async {
final response = await NimbblCoreApiSDK().updateOrderDetails(
options.orderToken!,
getOrderID( options.orderToken!),
'callback_mobile',
'flutter',
'1.0.0',
);
if (response.data != null) {
final checkoutDetailResponse = await NimbblCoreApiSDK()
.getCheckoutDetails(options.orderToken!);
if (checkoutDetailResponse.data != null) {
return await Navigator.push(
_contextReference!.target!,
MaterialPageRoute(
builder: (context) =>
NimbblCheckoutWebView(
options: options,
btnBackGroundColor: HexColor.fromHex(checkoutDetailResponse.data!
.checkoutBackgroundColor!),
btnTextColor: checkoutDetailResponse.data!.checkoutTextColor =='white'?Colors.white:Colors.black,
)),
);
} else {
return NimbblCheckoutPaymentResponse(isSuccess: false,
data: {'message': response.error?.error?.nimbblMerchantMessage});
}
} else {
return NimbblCheckoutPaymentResponse(isSuccess: false,
data: {'message': response.error?.error?.nimbblMerchantMessage});
}
}