Esempio n. 1
0
        private bool ValidateOrderRequest(Customer customer, OrderRequest order)
        {
            bool productsExist = ValidateProducts(order);

            if (!productsExist)
            {
                return(false);
            }

            var taxes    = calculator.CalculateTaxes(order, customer);
            var discount = calculator.CalculateDiscount(order, customer);

            bool approvalResponse = orderApproval.Approve(new ApproveRequest
            {
                Customer = customer,
                Order    = order,
                Taxes    = taxes,
                Discount = discount
            });

            return(approvalResponse);
        }
Esempio n. 2
0
        public async Task <WorkflowStatus> ProcessAuditorApproval(
            [ActivityTrigger] DurableActivityContext context,
            ILogger log)
        {
            var data = context.GetInput <ProcessAuditorApprovalData>();

            if (data.ApprovalEventData.Result)
            {
                await _approvalService.Approve(data.WorkflowId, data.ApprovalEventData.Auditor);
            }
            else
            {
                await _approvalService.Deny(data.WorkflowId, data.ApprovalEventData.Auditor);
            }

            if (await _approvalService.IsParticipantInWaitingState(data.WorkflowId))
            {
                return(WorkflowStatus.InApproval);
            }

            await _approvalService.SetStatus(data.WorkflowId, WorkflowStatus.ApprovalCompleted);

            return(WorkflowStatus.ApprovalCompleted);
        }
Esempio n. 3
0
 public Task Approve([FromBody] NotificationApprovalViewModel inputModel) =>
 approvalService.Approve(inputModel.Id, Guid.Parse(LoggedUserId));
Esempio n. 4
0
 private async Task ApproveCost(Guid costId, UserIdentity userIdentity)
 {
     await _approvalService.Approve(costId, userIdentity, BuType.Pg, SourceSystem.Coupa);
 }