Exemplo n.º 1
0
        public void Default_SuccessfullyReturned()
        {
            // Act
            _creditNotePostModel = CreditNoteClient.Default(CreditedIssuedInvoiceId).AssertResult();

            // Assert
            AssertDefault(_creditNotePostModel);
        }
Exemplo n.º 2
0
        public async Task DefaultAsync_SuccessfullyReturned()
        {
            // Act
            _creditNotePostModel = (await CreditNoteClient.DefaultAsync(CreditedIssuedInvoiceId)).AssertResult();

            // Assert
            AssertDefault(_creditNotePostModel);
        }
Exemplo n.º 3
0
        public async Task GetDetailAsync_ReturnsCreditNote()
        {
            // Act
            var creditNoteGetModel = (await CreditNoteClient.Detail(_postedCreditNoteId).GetAsync()).AssertResult();

            // Assert
            Assert.AreEqual(_postedCreditNoteId, creditNoteGetModel.Id);
            ComparePostAndGetModels(_creditNotePostModel, creditNoteGetModel, false);
            ComparePostAndGetItems(_creditNotePostModel.Items, creditNoteGetModel.Items.Cast <CreditNoteItemListGetModel>().ToList());
        }
Exemplo n.º 4
0
        public async Task DeleteAsync_SuccessfullyDeletedCreditNote()
        {
            // Act
            var result1 = (await CreditNoteClient.DeleteAsync(_postedCreditNoteId)).AssertResult();
            var result2 = (await CreditNoteClient.DeleteAsync(_offsetCreditNoteId)).AssertResult();

            // Assert
            Assert.True(result1);
            Assert.True(result2);
        }
Exemplo n.º 5
0
        public void Delete_SuccessfullyDeletedCreditNote()
        {
            // Act
            var result1 = CreditNoteClient.Delete(_postedCreditNoteId).AssertResult();
            var result2 = CreditNoteClient.Delete(_offsetCreditNoteId).AssertResult();

            // Assert
            Assert.True(result1);
            Assert.True(result2);
        }
Exemplo n.º 6
0
        public async Task RecountAsync_SuccessfullyRecounted()
        {
            // Arrange
            var creditNoteRecountPostModel = CreateRecountPostModel();

            // Act
            var creditNoteRecountGetModel = (await CreditNoteClient.RecountAsync(creditNoteRecountPostModel)).AssertResult();

            // Assert
            ComparePostAndGetRecountModels(creditNoteRecountPostModel, creditNoteRecountGetModel);
        }
Exemplo n.º 7
0
        public void Recount_SuccessfullyRecounted()
        {
            // Arrange
            var creditNoteRecountPostModel = CreateRecountPostModel();

            // Act
            var creditNoteRecountGetModel = CreditNoteClient.Recount(creditNoteRecountPostModel).AssertResult();

            // Assert
            ComparePostAndGetRecountModels(creditNoteRecountPostModel, creditNoteRecountGetModel);
        }
Exemplo n.º 8
0
        public async Task UpdateAsync_SuccessfullyUpdatedCreditNote()
        {
            // Arrange
            var creditNotePatchModel = CreatePatchModel();

            // Act
            var creditNoteGetModel = (await CreditNoteClient.UpdateAsync(creditNotePatchModel)).AssertResult();

            // Assert
            Assert.AreEqual(creditNotePatchModel.Id, creditNoteGetModel.Id);
            ComparePatchAndGetModels(creditNotePatchModel, creditNoteGetModel);
        }
Exemplo n.º 9
0
        public void Update_SuccessfullyUpdatedCreditNote()
        {
            // Arrange
            var creditNotePatchModel = CreatePatchModel();

            // Act
            var creditNoteGetModel = CreditNoteClient.Update(creditNotePatchModel).AssertResult();

            // Assert
            Assert.AreEqual(creditNotePatchModel.Id, creditNoteGetModel.Id);
            ComparePatchAndGetModels(creditNotePatchModel, creditNoteGetModel);
            AssertDeliveryAddress(creditNoteGetModel.DeliveryAddress, DeliveryAddressId2);
        }
Exemplo n.º 10
0
        public async Task PostAsync_SuccessfullyPosted()
        {
            // Arrange
            CreatePostModel(_creditNotePostModel);

            // Act
            var creditNoteGetModel = (await CreditNoteClient.PostAsync(_creditNotePostModel)).AssertResult();

            _postedCreditNoteId = creditNoteGetModel.Id;

            // Assert
            ComparePostAndGetModels(_creditNotePostModel, creditNoteGetModel, false);
            ComparePostAndGetItems(_creditNotePostModel.Items, creditNoteGetModel.Items.Cast <CreditNoteItemListGetModel>().ToList());
        }
Exemplo n.º 11
0
        public void GetDetail_ReturnsCreditNote()
        {
            // Act
            var creditNoteGetModel = CreditNoteClient.Detail(_postedCreditNoteId)
                                     .Include(c => c.CreditedInvoice).Get().AssertResult();

            // Assert
            Assert.AreEqual(_postedCreditNoteId, creditNoteGetModel.Id);
            ComparePostAndGetModels(_creditNotePostModel, creditNoteGetModel, false);
            ComparePostAndGetItems(_creditNotePostModel.Items, creditNoteGetModel.Items.Cast <CreditNoteItemListGetModel>().ToList());
            AssertDeliveryAddress(creditNoteGetModel.DeliveryAddress, DeliveryAddressId1);
            Assert.NotNull(creditNoteGetModel.CreditedInvoice);
            Assert.AreEqual(creditNoteGetModel.CreditedInvoiceId, creditNoteGetModel.CreditedInvoice.Id);
        }
Exemplo n.º 12
0
        public void Post_SuccessfullyPosted()
        {
            // Arrange
            CreatePostModel(_creditNotePostModel);

            // Act
            var creditNoteGetModel = CreditNoteClient.Post(_creditNotePostModel).AssertResult();

            _postedCreditNoteId = creditNoteGetModel.Id;

            // Assert
            ComparePostAndGetModels(_creditNotePostModel, creditNoteGetModel, false);
            ComparePostAndGetItems(_creditNotePostModel.Items, creditNoteGetModel.Items.Cast <CreditNoteItemListGetModel>().ToList());
            AssertDeliveryAddress(creditNoteGetModel.DeliveryAddress, DeliveryAddressId1);
        }
Exemplo n.º 13
0
        public async Task CreateFromInvoiceWithMossAsync_SuccessfullyCreated()
        {
            // Act
            var model = (await CreditNoteClient.DefaultAsync(InvoiceWithMossId)).AssertResult();

            model.CreditNoteReason = "Creadit note reason";
            var result = (await CreditNoteClient.PostAsync(model)).AssertResult();

            // Assert
            Assert.Greater(result.Id, 0);
            Assert.That(result.HasVatRegimeOss, Is.True);
            Assert.AreEqual(result.Items.First().VatRate, 19);

            // Teardown
            CreditNoteClient.Delete(result.Id);
        }
Exemplo n.º 14
0
        public void OffsetNewCreditNote_SuccessfullyOffset()
        {
            // Arrange
            _creditNoteToOffsetPostModel = CreditNoteClient.Default(CreditedIssuedInvoiceId).AssertResult();
            CreatePostModel(_creditNoteToOffsetPostModel);

            // Act
            var offsetCreditNote = CreditNoteClient.Offset(_creditNoteToOffsetPostModel).AssertResult();

            _offsetCreditNoteId = offsetCreditNote.Id;

            // Assert
            Assert.AreEqual(_offsetCreditNoteId, offsetCreditNote.Id);
            ComparePostAndGetModels(_creditNoteToOffsetPostModel, offsetCreditNote, true);
            ComparePostAndGetItems(_creditNoteToOffsetPostModel.Items, offsetCreditNote.Items.Cast <CreditNoteItemListGetModel>().ToList());
            Assert.IsNotNull(offsetCreditNote.DateOfPayment);
        }
Exemplo n.º 15
0
        public async Task GetListAsync_ReturnsCreditNotes()
        {
            // Act
            var data = (await CreditNoteClient
                        .List()
                        .Filter(c => c.Id.IsEqual(_postedCreditNoteId))
                        .GetAsync())
                       .AssertResult();

            // Assert
            Assert.NotNull(data.Items);
            Assert.Greater(data.TotalItems, 0);
            Assert.Greater(data.TotalPages, 0);
            var firstItem = data.Items.First();

            ComparePostAndGetModels(_creditNotePostModel, firstItem, false);
            ComparePostAndGetItems(_creditNotePostModel.Items, firstItem.Items);
        }
Exemplo n.º 16
0
        public async Task OffsetExistingCreditNoteAsync_SuccessfullyOffset()
        {
            // Arrange
            var result = (await IssuedDocumentPaymentClient.FullyUnpayAsync(CreditedIssuedInvoiceId)).AssertResult();

            Assert.True(result);
            result = (await IssuedDocumentPaymentClient.FullyUnpayAsync(_offsetCreditNoteId)).AssertResult();
            Assert.True(result);

            // Act
            var offsetCreditNote = (await CreditNoteClient.OffsetAsync(_offsetCreditNoteId)).AssertResult();

            // Assert
            Assert.AreEqual(_offsetCreditNoteId, offsetCreditNote.Id);
            ComparePostAndGetModels(_creditNoteToOffsetPostModel, offsetCreditNote, true);
            ComparePostAndGetItems(_creditNoteToOffsetPostModel.Items, offsetCreditNote.Items.Cast <CreditNoteItemListGetModel>().ToList());
            Assert.IsNotNull(offsetCreditNote.DateOfPayment);
        }