fetchOrder method

Future<PaymentOptionModel> fetchOrder(
  1. String? orderId
)

Implementation

Future<PaymentOptionModel> fetchOrder(String? orderId) async {
  final response =
      await httpClient.get(Uri.parse(getpaymentMethods(_baseUrl, orderId!)));

  if (response.statusCode != 200) {
    throw Exception('error creating order');
  }

  final json = jsonDecode(response.body);
  if (kDebugMode) {
    print(json);
  }
  return PaymentOptionModel.fromJson(json);
}