Ejemplo n.º 1
0
        /// <summary>
        /// Returns <see cref="IOrder"/> by thumbprint of certificate
        /// </summary>
        /// <param name="accountId"><see cref="IAccount"/> specific id</param>
        /// <param name="thumbprint">Thumbprint of certificate</param>
        /// <exception cref="MalformedException"/>
        public IOrder GetByCertificate(int accountId, string thumbprint)
        {
            // get order
            var order = OrderRepository.GetByThumbprint(thumbprint);

            if (order == null)
            {
                throw new MalformedException("Order not found");
            }


            // check access
            AccountSecurityService.CheckAccess(new AccountAccess
            {
                Account = AccountService.GetById(accountId),
                Target  = order,
            });
            return(order);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public IOrder GetById(int accountId, int id)
        {
            var order = OrderRepository.GetById(id);

            if (order == null)
            {
                throw new MalformedException("Order not found");
            }

            // check access
            AccountSecurityService.CheckAccess(new AccountAccess
            {
                Account = AccountService.GetById(accountId),
                Target  = order,
            });

            RefreshStatus(order);

            return(order);
        }