getPaymentInfo method

Future<void> getPaymentInfo()

Implementation

Future<void> getPaymentInfo() async {
  try {
    var response = await Requests.getDio(showLoadingDialog: false).get(
      "payments/$bookedPaymentId",
    );

    if (response.statusCode == 200) {
      if (response.data['data']['status'] == "COMPLETED") {
        startTimer.value = false;
        timer?.cancel();
        closeDialog();
        await Get.find<AuthenticationController>().getUserProfile();
        goto(Routes.PAYMENT_SUCCESS, parameters: {
          'paymentId': bookedPaymentId,
        });
        return;
      }
      if (response.data['data']['status'] == "CANCELLED") {
        startTimer.value = false;
        timer?.cancel();
        closeDialog();
        goto(Routes.PAYMENT_FAILURE, parameters: {
          'paymentId': bookedPaymentId,
        });

        return;
      }
    }
  } catch (e) {
    debugPrint(e.toString());
  }
}