Order constructor
Order({
- String orderId = '',
- required OrderType orderType,
- HttpService? httpService,
- 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');
}
}