private async Task ShouldTestFullDisputesWorkflow()
        {
            //Make the payment
            var payment = await MakeCardPayment(true, 1040L);

            payment.ShouldNotBeNull();
            var query = new DisputesQueryFilter {
                PaymentId = payment.Id
            };

            //Query for dispute
            DisputesQueryResponse queryResponse = await Retriable(async() =>
                                                                  await DefaultApi.DisputesClient().Query(query), HasItems);

            queryResponse.ShouldNotBeNull();
            queryResponse.Data[0].PaymentId.ShouldBe(payment.Id);

            //Upload dispute evidence
            const string filePath     = "./Resources/checkout.jpeg";
            var          fileResponse = await DefaultApi.DisputesClient().SubmitFile(filePath, "dispute_evidence");

            //Provide dispute evidence
            var disputeEvidenceRequest = new DisputeEvidenceRequest()
            {
                ProofOfDeliveryOrServiceFile = fileResponse.Id,
                ProofOfDeliveryOrServiceText = "proof of delivery or service text",
                InvoiceOrReceiptFile         = fileResponse.Id,
                InvoiceOrReceiptText         = "Copy of the invoice",
                CustomerCommunicationFile    = fileResponse.Id,
                CustomerCommunicationText    = "Copy of an email exchange with the cardholder",
                AdditionalEvidenceFile       = fileResponse.Id,
                AdditionalEvidenceText       = "Scanned document"
            };

            var disputeId = queryResponse.Data[0].Id;
            await DefaultApi.DisputesClient().PutEvidence(disputeId, disputeEvidenceRequest);

            //Verify the dispute evidence
            var evidence = await DefaultApi.DisputesClient().GetEvidence(disputeId);

            evidence.ShouldNotBeNull();
            evidence.ProofOfDeliveryOrServiceFile.ShouldBe(disputeEvidenceRequest.ProofOfDeliveryOrServiceFile);
            evidence.ProofOfDeliveryOrServiceText.ShouldBe(disputeEvidenceRequest.ProofOfDeliveryOrServiceText);
            evidence.InvoiceOrReceiptFile.ShouldBe(disputeEvidenceRequest.InvoiceOrReceiptFile);
            evidence.InvoiceOrReceiptText.ShouldBe(disputeEvidenceRequest.InvoiceOrReceiptText);
            evidence.CustomerCommunicationFile.ShouldBe(disputeEvidenceRequest.CustomerCommunicationFile);
            evidence.CustomerCommunicationText.ShouldBe(disputeEvidenceRequest.CustomerCommunicationText);
            evidence.AdditionalEvidenceFile.ShouldBe(disputeEvidenceRequest.AdditionalEvidenceFile);
            evidence.AdditionalEvidenceText.ShouldBe(disputeEvidenceRequest.AdditionalEvidenceText);

            //Submit the dispute
            await DefaultApi.DisputesClient().SubmitEvidence(disputeId);
        }
        private async Task ShouldQueryDispute()
        {
            var request       = new DisputesQueryFilter();
            var responseAsync = new DisputesQueryResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Query <DisputesQueryResponse>("disputes", _authorization, request,
                                                                     CancellationToken.None))
            .ReturnsAsync(() => responseAsync);

            IDisputesClient client = new DisputesClient(_apiClient.Object, _configuration.Object);

            var response = await client.Query(request);

            response.ShouldNotBeNull();
        }
 private static bool HasItems(DisputesQueryResponse obj)
 {
     return(obj.TotalCount > 0);
 }