getCart method

Future<void> getCart(
  1. String? orderGroupId
)

Implementation

Future<void> getCart(String? orderGroupId) async {
  if (!isPageLoading.value) {
    isPageLoading.value = true;
    isPaymentLoading.value = true;
    update();
  }

  final response = await paymentService.getCart(
    param:
        orderGroupId?.isNotEmpty == true
            ? {"orderGroupID": orderGroupId}
            : null,
  );
  Checkout? cart;
  response.fold(
    (error) {
      onError?.call(error.message);
      update();
    },
    (result) {
      // checkoutCart = result;
      cart = result;
    },
  );
  // if (checkoutCart.orderGroupID.isNotEmpty) {
  //   await mapToModel(checkoutCart);
  if (cart != null) {
    await mapToModel(model: cart!, orderGroupID: orderGroupId);
    await poinInquiry();
  }
  if (isPageLoading.value) {
    isPageLoading.value = false;
    isPaymentLoading.value = false;
    update();
  }
}