public async Task <Account?> LoadAccountAsync(string accountId, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(accountId) || !IdentifierRegex.IsMatch(accountId))
            {
                throw new MalformedRequestException("AccountId does not match expected format.");
            }

            var accountPath = GetPath(accountId);

            var account = await LoadFromPath <Account>(accountPath, cancellationToken);

            return(account);
        }
        public async Task <Order?> LoadOrderAsync(string orderId, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(orderId) || !IdentifierRegex.IsMatch(orderId))
            {
                throw new MalformedRequestException("OrderId does not match expected format.");
            }

            var orderFilePath = GetOrderPath(orderId);

            var order = await LoadFromPath <Order>(orderFilePath, cancellationToken);

            return(order);
        }
Beispiel #3
0
 private static void AddLineID(string RegexStr, LineType ID)
 {
     LineIds.Add(new VariableIdentifier(RegexStr, ID, (Row, IdentifierRegex) => {
         return(IdentifierRegex.IsMatch(Row));
     }));
 }