Order constructor

Order({
  1. String orderId = '',
  2. required OrderType orderType,
  3. HttpService? httpService,
  4. PINAppIntent? pinAppIntent,
})

Implementation

Order({
  this.orderId = '',
  required OrderType orderType,
  HttpService? httpService,
  PINAppIntent? pinAppIntent,
})  : _orderType = orderType,
      _orderDetails = OrderDetails(type: orderType, orderLines: []),
      _appIntent = pinAppIntent ?? PINAppIntentImpl(),
      _httpService = httpService ?? HttpServiceImpl() {
  _oldOrderLines = _orderDetails;
  if (!Constants.initilalized) {
    throw StokedError('Initialise SDK before creating an order');
  }
  if (_orderDetails.terminalId.isEmpty) {
    throw StokedError(
        'Set terminalId or register terminal before creating an order');
  }
}