initPayment method
Implementation
Future<void> initPayment(PaymentDetails paymentDetails,
{bool gotoPayment = true,BookingHistory? paymentHistory, bool isRateConfirmed = false, bool isSaved = false, bool isPaymentFailedForRateRequest = false}) async {
log("### ${paymentDetails.toJson()}");
this.paymentDetails.value = paymentDetails;
this.paymentDetails.refresh();
passengerCreation();
await storePayment();
if (gotoPayment) {
if (isRateConfirmed || isPaymentFailedForRateRequest) {
if(checkBookingisWithIn12Hours(this.paymentDetails.value.departureDate ?? '', this.paymentDetails.value.departureTime ?? '',defaultHours: 8).isLowerThan(0)){
await callDependingOnScreen(
doMobile: () async {
await openBottomSheet(
const BookingNotPossible(
isRateInit: true,
isDialog: false,
)
);
},
doWeb: () async {
await openDialog(
barrierDismissible: false,
const BookingNotPossible(
isRateInit: true,
isDialog: true,
)
);
},
);
return;
}
goto(Routes.RATE_CONFIRMATION_VIEW);
} else if(isSaved){
goto(Routes.RATE_REQUEST_VIEW);
} else {
goto(Routes.CHOOSE_PAYMENT);
}
}
}