public Task <DisputesQueryResponse> Query(DisputesQueryFilter filter, CancellationToken cancellationToken = default) { CheckoutUtils.ValidateParams("filter", filter); return(ApiClient.Query <DisputesQueryResponse>(DisputesPath, SdkAuthorization(), filter, cancellationToken)); }
private async Task ShouldQueryDisputes() { var request = new DisputesQueryFilter(); var response = await DefaultApi.DisputesClient().Query(request); response.ShouldNotBeNull(); response.Limit.ShouldNotBeNull(); response.Skip.ShouldNotBeNull(); response.TotalCount.ShouldNotBeNull(); if (response.TotalCount > 0) { var dispute = response.Data[0]; var disputeDetails = await DefaultApi.DisputesClient().GetDisputeDetails(dispute.Id); disputeDetails.ShouldNotBeNull(); disputeDetails.Id.ShouldBe(dispute.Id); disputeDetails.Category.ShouldBe(dispute.Category); disputeDetails.Status.ShouldBe(dispute.Status); disputeDetails.Amount.ShouldBe(dispute.Amount); disputeDetails.ReasonCode.ShouldBe(dispute.ReasonCode); disputeDetails.Payment.ShouldNotBeNull(); disputeDetails.Payment.Id.ShouldBe(dispute.PaymentId); } }
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(); }