public async Task <HSOrder> Submit(OrderDirection direction, string orderID, [FromBody] OrderCloudIntegrationsCreditCardPayment payment)
 {
     return(await _orderSubmitCommand.SubmitOrderAsync(orderID, direction, payment, UserContext.AccessToken));
 }
Beispiel #2
0
        public async Task should_throw_if_order_is_already_submitted()
        {
            // Arrange
            _oc.IntegrationEvents.GetWorksheetAsync <HSOrderWorksheet>(OrderDirection.Incoming, "mockOrderID").Returns(Task.FromResult(new HSOrderWorksheet
            {
                Order = new Models.HSOrder {
                    ID = "mockOrderID", IsSubmitted = true
                }
            }));

            // Act
            var ex = Assert.ThrowsAsync <CatalystBaseException>(async() => await _sut.SubmitOrderAsync("mockOrderID", OrderDirection.Outgoing, new OrderCloudIntegrationsCreditCardPayment {
            }, "mockUserToken"));

            // Assert
            Assert.AreEqual("OrderSubmit.AlreadySubmitted", ex.ApiError.ErrorCode);
        }