Пример #1
0
 public Task <EmptyResponse> PutEvidence(string disputeId, DisputeEvidenceRequest disputeEvidenceRequest,
                                         CancellationToken cancellationToken = default)
 {
     CheckoutUtils.ValidateParams("disputeId", disputeId, "disputeEvidenceRequest", disputeEvidenceRequest);
     return(ApiClient.Put <EmptyResponse>(BuildPath(DisputesPath, disputeId, EvidencePath), SdkAuthorization(),
                                          disputeEvidenceRequest,
                                          cancellationToken));
 }
        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 ShouldPutEvidenceDispute()
        {
            const string disputeId = "dsp_s5151531";
            var          request   = new DisputeEvidenceRequest();

            _apiClient.Setup(apiClient =>
                             apiClient.Put <EmptyResponse>($"disputes/{disputeId}/evidence", _authorization, request,
                                                           CancellationToken.None,
                                                           null))
            .ReturnsAsync(() => new EmptyResponse());

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

            var response = await client.PutEvidence(disputeId, request);

            response.ShouldNotBeNull();
        }