public void Test_GetDocument()
        {
            DisputeDTO dispute = _clientDisputes.FirstOrDefault(x => x.Status == DisputeStatus.PENDING_CLIENT_ACTION || x.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION);

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

            DisputeDocumentDTO document = null;
            DisputeDocumentDTO result = null;

            try
            {
                DisputeDocumentPostDTO documentPost = new DisputeDocumentPostDTO(DisputeDocumentType.OTHER);
                document = Api.Disputes.CreateDisputeDocument(documentPost, dispute.Id);

                result = Api.Disputes.GetDocument(document.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            Assert.IsNotNull(result);
            Assert.AreEqual(result.CreationDate, document.CreationDate);
            Assert.AreEqual(result.Id, document.Id);
            Assert.AreEqual(result.RefusedReasonMessage, document.RefusedReasonMessage);
            Assert.AreEqual(result.RefusedReasonType, document.RefusedReasonType);
            Assert.AreEqual(result.Status, document.Status);
            Assert.AreEqual(result.Tag, document.Tag);
            Assert.AreEqual(result.Type, document.Type);
            Assert.AreEqual(result.DisputeId, document.DisputeId);
        }
        public void Test_CreateDisputeDocument()
        {
            DisputeDTO dispute = _clientDisputes.FirstOrDefault(x => x.Status == DisputeStatus.PENDING_CLIENT_ACTION || x.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION);

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

            DisputeDocumentDTO result = null;

            try
            {
                DisputeDocumentPostDTO documentPost = new DisputeDocumentPostDTO(DisputeDocumentType.DELIVERY_PROOF);

                result = Api.Disputes.CreateDisputeDocument(documentPost, dispute.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Type, DisputeDocumentType.DELIVERY_PROOF);
        }
Esempio n. 3
0
 /// <summary>Creates document for dispute.</summary>
 /// <param name="disputeDocument">Dispute document to be created.</param>
 /// <param name="disputeId">Dispute identifier.</param>
 /// <returns>Dispute document returned from API.</returns>
 public DisputeDocumentDTO CreateDisputeDocument(DisputeDocumentPostDTO disputeDocument, string disputeId)
 {
     return this.CreateObject<DisputeDocumentDTO, DisputeDocumentPostDTO>(MethodKey.DisputesDocumentCreate, disputeDocument, disputeId);
 }