예제 #1
0
        public async Task ShouldUpdateWorkflowCondition()
        {
            EventWorkflowConditionRequest eventWorkflowConditionRequest = new EventWorkflowConditionRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Put <EmptyResponse>("workflows" + "/workflow_id/conditions/condition_id", _authorization,
                                                           eventWorkflowConditionRequest, CancellationToken.None, null))
            .ReturnsAsync(() => new EmptyResponse());

            IWorkflowsClient workflowsClient = new WorkflowsClient(_apiClient.Object, _configuration.Object);

            var updateResponse =
                await workflowsClient.UpdateWorkflowCondition("workflow_id", "condition_id",
                                                              eventWorkflowConditionRequest);

            updateResponse.ShouldNotBeNull();
        }
예제 #2
0
        public async Task ShouldUpdateWorkflowCondition()
        {
            var createdWorkflow = await CreateWorkflow();

            createdWorkflow.ShouldNotBeNull();
            createdWorkflow.Id.ShouldNotBeNull();

            GetWorkflowResponse getWorkflowResponse = await DefaultApi.WorkflowsClient().GetWorkflow(createdWorkflow.Id);

            getWorkflowResponse.ShouldNotBeNull();
            getWorkflowResponse.Id.ShouldNotBeNullOrEmpty();
            getWorkflowResponse.Name.ShouldBe(WorkflowName);
            getWorkflowResponse.Conditions.ShouldNotBeNull();
            getWorkflowResponse.Conditions.Count.ShouldBe(3);

            WorkflowConditionResponse eventWorkflowConditionResponse =
                getWorkflowResponse.Conditions.FirstOrDefault(x => x.Type.Equals(WorkflowConditionType.Event));

            eventWorkflowConditionResponse.ShouldNotBeNull();

            EventWorkflowConditionRequest updateEventCondition = new EventWorkflowConditionRequest()
            {
                Events = new Dictionary <string, ISet <string> >
                {
                    {
                        "gateway",
                        new HashSet <string>
                        {
                            "card_verified",
                            "card_verification_declined",
                            "payment_approved",
                            "payment_pending",
                            "payment_declined",
                            "payment_voided",
                            "payment_captured",
                            "payment_refunded"
                        }
                    },
                    {
                        "dispute",
                        new HashSet <string>
                        {
                            "dispute_canceled",
                            "dispute_evidence_required",
                            "dispute_expired",
                            "dispute_lost",
                            "dispute_resolved",
                            "dispute_won"
                        }
                    }
                }
            };

            await DefaultApi.WorkflowsClient().UpdateWorkflowCondition(getWorkflowResponse.Id,
                                                                       eventWorkflowConditionResponse.Id, updateEventCondition);

            GetWorkflowResponse getWorkflowResponse2 = await DefaultApi.WorkflowsClient().GetWorkflow(createdWorkflow.Id);

            getWorkflowResponse2.ShouldNotBeNull();
            getWorkflowResponse2.Conditions.ShouldNotBeNull();
            getWorkflowResponse2.Conditions.Count.ShouldBe(3);

            WorkflowConditionResponse updatedEventConditionResponse =
                getWorkflowResponse2.Conditions.FirstOrDefault(x => x.Type.Equals(WorkflowConditionType.Event));

            updatedEventConditionResponse.ShouldNotBeNull();
            updatedEventConditionResponse.Id.ShouldNotBeNull();
            updatedEventConditionResponse.Type.ShouldNotBeNull();
        }