public void Test_SubmitDisputeDocument()
        {
            DisputeDTO         dispute         = null;
            DisputeDocumentDTO disputeDocument = null;

            FilterDisputeDocuments filter = new FilterDisputeDocuments();

            filter.Status = DisputeDocumentStatus.CREATED;

            // search for dispute having any documents created
            foreach (DisputeDTO d in _clientDisputes.Where(x => x.Status == DisputeStatus.PENDING_CLIENT_ACTION || x.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION))
            {
                DisputeDocumentDTO dd = Api.Disputes.GetDocumentsForDispute(d.Id, new Pagination(1, 1), filter).FirstOrDefault();

                if (dd != null)
                {                // found
                    dispute         = d;
                    disputeDocument = dd;
                    break;
                }
            }

            if (dispute == null)
            {
                dispute = _clientDisputes.FirstOrDefault(x => x.Status == DisputeStatus.PENDING_CLIENT_ACTION || x.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION);

                if (dispute == null)
                {
                    Assert.Fail("Cannot test submitting dispute's documents because there's no dispute with expected status in the disputes list.");
                }

                DisputeDocumentPostDTO documentPost = new DisputeDocumentPostDTO(DisputeDocumentType.DELIVERY_PROOF);
                disputeDocument = Api.Disputes.CreateDisputeDocument(documentPost, dispute.Id);
            }

            DisputeDocumentDTO result = null;

            try
            {
                if (disputeDocument == null)
                {
                    Assert.Fail("Cannot test submitting dispute's documents because there's no dispute document that can be updated.");
                }

                DisputeDocumentPutDTO disputeDocumentPut = new DisputeDocumentPutDTO
                {
                    Status = DisputeDocumentStatus.VALIDATION_ASKED
                };

                result = Api.Disputes.SubmitDisputeDocument(disputeDocumentPut, dispute.Id, disputeDocument.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            Assert.IsNotNull(result);
            Assert.IsTrue(disputeDocument.Type == result.Type);
            Assert.IsTrue(result.Status == DisputeDocumentStatus.VALIDATION_ASKED);
        }
 /// <summary>Submits dispute document.</summary>
 /// <param name="disputeDocument">Dispute document to be submitted.</param>
 /// <param name="disputeId">Dispute identifier.</param>
 /// <param name="disputeDocumentId">Dispute document identifier.</param>
 /// <returns>Dispute document instance returned from API.</returns>
 public DisputeDocumentDTO SubmitDisputeDocument(DisputeDocumentPutDTO disputeDocument, String disputeId, String disputeDocumentId)
 {
     return(this.UpdateObject <DisputeDocumentDTO, DisputeDocumentPutDTO>(MethodKey.DisputesDocumentSubmit, disputeDocument, disputeId, disputeDocumentId));
 }
示例#3
0
 /// <summary>Submits dispute document.</summary>
 /// <param name="disputeDocument">Dispute document to be submitted.</param>
 /// <param name="disputeId">Dispute identifier.</param>
 /// <param name="disputeDocumentId">Dispute document identifier.</param>
 /// <returns>Dispute document instance returned from API.</returns>
 public async Task <DisputeDocumentDTO> SubmitDisputeDocumentAsync(DisputeDocumentPutDTO disputeDocument, String disputeId, String disputeDocumentId)
 {
     return(await this.UpdateObjectAsync <DisputeDocumentDTO, DisputeDocumentPutDTO>(MethodKey.DisputesDocumentSubmit, disputeDocument, disputeId, disputeDocumentId));
 }