finalize method

Future<ApiCallback<Order>> finalize(
  1. {String cartId}
)

Implementation

Future<ApiCallback<Order>> finalize({String cartId}) async {
  try {
    if (cartId == null) cartId = await _getDefaultCartId();

    var response =
        await _requester.put(FINALIZE.replaceAll(PARAMETER_CART_ID, cartId));

    Order order = Order.fromJson(response.data);

    return ApiCallback<Order>(isSuccessful: true, resultData: order);
  } on DioError catch (e) {
    return ApiCallback<Order>().defaultErrorCallback(e);
  } catch (e) {
    return ApiCallback<Order>().defaultErrorCallback(e);
  }
}