buyCorporateAddon method

void buyCorporateAddon(
  1. Addon addon
)

Implementation

void buyCorporateAddon(Addon addon) async {
  if (isInvalidSubscription()) {
    return;
  }

  if (passengerAddonsPricing.value == null) {
    CustomFlashWidget.showFlashMessage(
      type: FlashType.error,
      title: 'Invalid addon',
      message: "Can't proceed with this addon please try a different one.",
    );
    return;
  }

  if (corporatePassengersNumber.value < 1) {
    CustomFlashWidget.showFlashMessage(
      type: FlashType.error,
      title: 'Invalid passengers',
      message:
          'Please select the number of passengers first before proceeding to purchasing the addon.',
    );
    return;
  }

  type.value = SubscriptionType.corporateAddon;
  await Preferences.storeCorporateAddon(
    passengerAddonsPricing.value!,
    corporatePassengersNumber.value,
  );
  goto(Routes.SUBSCRIPTION_PAYMENT);
}