getInstallments method

Future<ApiCallback<List<Installment>>> getInstallments(
  1. {String cartId}
)

Implementation

Future<ApiCallback<List<Installment>>> getInstallments(
    {String cartId}) async {
  try {
    if (cartId == null) cartId = await _getDefaultCartId();

    var response = await _requester
        .get(GET_INSTALLMENTS.replaceAll(PARAMETER_CART_ID, cartId));
    // Parse result
    var responseData = response.data as List;
    var installments = List<Installment>();
    for (var row in responseData) {
      installments.add(Installment.fromJson(row));
    }
    // Callback invocation
    return ApiCallback<List<Installment>>(
        isSuccessful: true, resultData: installments);
  } on DioError catch (e) {
    return ApiCallback<List<Installment>>().defaultErrorCallback(e);
  }
}