Skip to content

Commit

Permalink
Update to version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iAlexeyProkhorov committed Jan 2, 2023
1 parent 8ab4a87 commit 4970565
Show file tree
Hide file tree
Showing 9 changed files with 359 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Baroque.NovaPoshta.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netcoreapp2.2;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<Version>1.3.1</Version>
<Version>1.4.0</Version>
<Description>Library represents full client for 'Nova Poshta' API</Description>
<RepositoryType>Git</RepositoryType>
<PackageReleaseNotes>Supports API 2.0 methods for all available models.</PackageReleaseNotes>
Expand Down
38 changes: 0 additions & 38 deletions Domain/Documents/CreateDocumentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,43 +155,5 @@ public class CreateDocumentRequest
/// </summary>
[DataMember]
public IList<Seat> OptionsSeat { get; set; } = new List<Seat>();


/// <summary>
/// Represents document seat options
/// </summary>
[DataContract]
public class Seat
{
/// <summary>
/// Gets or sets seat volume. (In cubic meter)
/// </summary>
[DataMember(Name = "volumetricVolume")]
public decimal VolumetricVolume { get; set; }

/// <summary>
/// Gets or sets seat width. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricWidth")]
public decimal VolumetricWidth { get; set; }

/// <summary>
/// Gets or sets seat length. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricLength")]
public decimal VolumetricLength { get; set; }

/// <summary>
/// Gets or sets seat height. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricHeight")]
public decimal VolumetricHeight { get; set; }

/// <summary>
/// Gets or sets seat weigth. (In kilograms)
/// </summary>
[DataMember(Name = "weight")]
public decimal Weight { get; set; }
}
}
}
19 changes: 19 additions & 0 deletions Domain/Documents/DeleteDocumentRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Runtime.Serialization;

namespace Baroque.NovaPoshta.Client.Domain.Documents
{
/// <summary>
/// Represents delete document request.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a9f43ff1-8512-11ec-8ced-005056b2dbe1
/// </summary>
[DataContract]
public class DeleteDocumentRequest
{
/// <summary>
/// Gets or sets deleting document uniqu reference key. Required property.
/// </summary>
[DataMember]
public Guid DocumentRefs { get; set; }
}
}
20 changes: 20 additions & 0 deletions Domain/Documents/DeleteDocumentResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Runtime.Serialization;

namespace Baroque.NovaPoshta.Client.Domain.Documents
{
/// <summary>
/// Represents document delete method response.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a9f43ff1-8512-11ec-8ced-005056b2dbe1
/// </summary>
public class DeleteDocumentResponse : BaseResponseEnvelope<DeleteDocumentResponse.DeletedDocument>
{
/// <summary>
/// Represents deleted document
/// </summary>
[DataContract]
public class DeletedDocument : BaseRefItem
{

}
}
}
41 changes: 41 additions & 0 deletions Domain/Documents/Seat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Runtime.Serialization;

namespace Baroque.NovaPoshta.Client.Domain.Documents
{
/// <summary>
/// Represents document seat options
/// </summary>
[DataContract]
public class Seat
{
/// <summary>
/// Gets or sets seat volume. (In cubic meter)
/// </summary>
[DataMember(Name = "volumetricVolume")]
public decimal VolumetricVolume { get; set; }

/// <summary>
/// Gets or sets seat width. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricWidth")]
public decimal VolumetricWidth { get; set; }

/// <summary>
/// Gets or sets seat length. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricLength")]
public decimal VolumetricLength { get; set; }

/// <summary>
/// Gets or sets seat height. (In centimeter)
/// </summary>
[DataMember(Name = "volumetricHeight")]
public decimal VolumetricHeight { get; set; }

/// <summary>
/// Gets or sets seat weigth. (In kilograms)
/// </summary>
[DataMember(Name = "weight")]
public decimal Weight { get; set; }
}
}
145 changes: 145 additions & 0 deletions Domain/Documents/UpdateDocumentRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Baroque.NovaPoshta.Client.Domain.Documents
{
/// <summary>
/// Represent document update method request.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a98a4354-8512-11ec-8ced-005056b2dbe1
/// </summary>
[DataContract]
public class UpdateDocumentRequest : BaseRefItem
{
/// <summary>
/// Gets or sets payer type.
/// Variants: Sender, Recipient, ThirdPerson
/// </summary>
[DataMember]
public string PayerType { get; set; } = "Sender";

/// <summary>
/// Gets or sets payment method type key.
/// Variants: Cash, NonCash
/// </summary>
[DataMember]
public string PaymentMethod { get; set; } = "Cash";

/// <summary>
/// Gets or sets package send date. Date format: dd.MM.yyyy
/// </summary>
[DataMember]
public string DateTime { get; set; }

/// <summary>
/// Gets or sets cargo type reference.
/// Documentation: https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a5912a1e-8512-11ec-8ced-005056b2dbe1
/// </summary>
[DataMember]
public string CargoType { get; set; } = "Cargo";

/// <summary>
/// Gets or sets package general volume. Required if property 'OptionSeats' isn't set.
/// Minimal value: 0,0004
/// </summary>
[DataMember]
public decimal? VolumeGeneral { get; set; }

/// <summary>
/// Gets or sets summary package weight. Min value: 0,1.
/// </summary>
[DataMember]
public decimal Weight { get; set; }

/// <summary>
/// Gets or sets service type reference.
/// Variants: DoorsDoors, DoorsWarehouse, WarehouseWarehouse, WarehouseDoors
/// </summary>
[DataMember]
public string ServiceType { get; set; } = "DoorsDoors";

/// <summary>
/// Gets or sets package seats amount.
/// </summary>
[DataMember]
public int SeatsAmount { get; set; }

/// <summary>
/// Gets or sets package description.
/// </summary>
[DataMember]
public string Description { get; set; }

/// <summary>
/// Gets or sets package assessed value.
/// </summary>
[DataMember]
public decimal Cost { get; set; }

/// <summary>
/// Gets or sets city sender reference key.
/// </summary>
[DataMember]
public Guid CitySender { get; set; }

/// <summary>
/// Gets or sets sendere reference key.
/// </summary>
[DataMember]
public Guid Sender { get; set; }

/// <summary>
/// Gets or sets sender address reference key.
/// </summary>
[DataMember]
public Guid SenderAddress { get; set; }

/// <summary>
/// Gets or sets sender contact person reference key.
/// </summary>
[DataMember]
public Guid ContactSender { get; set; }

/// <summary>
/// Gets or sets sender phone number.
/// </summary>
[DataMember]
public string SendersPhone { get; set; }

/// <summary>
/// Gets or sets recipient city reference number.
/// </summary>
[DataMember]
public Guid CityRecipient { get; set; }

/// <summary>
/// Gets or sets recipeint reference number.
/// </summary>
[DataMember]
public Guid Recipient { get; set; }

/// <summary>
/// Gets or sets recipeint address reference key.
/// </summary>
[DataMember]
public Guid RecipientAddress { get; set; }

/// <summary>
/// Gets or sets recipeint contact person reference key.
/// </summary>
[DataMember]
public Guid ContactRecipient { get; set; }

/// <summary>
/// Gets or sets recipient phone number.
/// </summary>
[DataMember]
public string RecipientsPhone { get; set; }

/// <summary>
/// Gets or sets seats options
/// </summary>
[DataMember]
public IList<Seat> OptionsSeat { get; set; } = new List<Seat>();
}
}
55 changes: 55 additions & 0 deletions Domain/Documents/UpdateDocumentResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Runtime.Serialization;

namespace Baroque.NovaPoshta.Client.Domain.Documents
{
/// <summary>
/// Represent document update method request.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a98a4354-8512-11ec-8ced-005056b2dbe1
/// </summary>
[DataContract]
public class UpdateDocumentResponse : BaseResponseEnvelope<UpdateDocumentResponse.UpdateResult>
{
/// <summary>
/// Gets or sets document updating warnings
/// </summary>
[DataMember(Name = "warnings")]
public string[] Warnings { get; set; } = new string[0];

/// <summary>
/// Gets or sets document updating errors
/// </summary>
[DataMember(Name = "errors")]
public string[] Errors { get; set; } = new string[0];

/// <summary>
/// Represents document update result.
/// </summary>
[DataContract]
public class UpdateResult : BaseRefItem
{
/// <summary>
/// Gets or sets delivery cost.
/// </summary>
[DataMember]
public decimal CostOnSite { get; set; }

/// <summary>
/// Gets or sets estimated delivery date. Date format: dd.MM.yyyy
/// </summary>
[DataMember]
public string EstimatedDeliveryDate { get; set; }

/// <summary>
/// Gets or sets document tracking number.
/// </summary>
[DataMember]
public string IntDocNumber { get; set; }

/// <summary>
/// Gets or sets document type.
/// </summary>
[DataMember]
public string TypeDocument { get; set; }
}
}
}
54 changes: 54 additions & 0 deletions Services/Documents/DocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,59 @@ public DocumentService(INovaPoshtaGateway novaPoshtaGateway)
var response = _novaPoshtaGateway.CreateRequest<CreateDocumentRequest, CreateDocumentResponse>(request);
return response;
}

/// <summary>
/// Updates internet document. Represents 'update' method of 'InternetDocument' model.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a98a4354-8512-11ec-8ced-005056b2dbe1
/// </summary>
/// <param name="updateDocumentRequest">Update document request</param>
/// <returns>Document update result</returns>
public virtual IResponseEnvelope<UpdateDocumentResponse.UpdateResult> UpdateDocument(UpdateDocumentRequest updateDocumentRequest)
{
var request = new RequestEnvelope<UpdateDocumentRequest>(updateDocumentRequest)
{
ApiKey = _novaPoshtaGateway.ApiKey,
CalledMethod = "update",
ModelName = MODEL
};

var response = _novaPoshtaGateway.CreateRequest<UpdateDocumentRequest, UpdateDocumentResponse>(request);
return response;
}

/// <summary>
/// Deletes internet document. Reprents 'delete' method of 'InternetDocument' model.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a9f43ff1-8512-11ec-8ced-005056b2dbe1
/// </summary>
/// <param name="reference">Deleting document unique reference key</param>
/// <returns>Document deletion result</returns>
public virtual IResponseEnvelope<DeleteDocumentResponse.DeletedDocument> DeleteDocument(Guid reference)
{
var request = new DeleteDocumentRequest()
{
DocumentRefs = reference
};

return DeleteDocument(request);
}

/// <summary>
/// Deletes internet document. Reprents 'delete' method of 'InternetDocument' model.
/// Documentation: https://developers.novaposhta.ua/view/model/a90d323c-8512-11ec-8ced-005056b2dbe1/method/a9f43ff1-8512-11ec-8ced-005056b2dbe1
/// </summary>
/// <param name="deleteDocumentRequest">Delete document request</param>
/// <returns>Document deletion result</returns>
public virtual IResponseEnvelope<DeleteDocumentResponse.DeletedDocument> DeleteDocument(DeleteDocumentRequest deleteDocumentRequest)
{
var request = new RequestEnvelope<DeleteDocumentRequest>(deleteDocumentRequest)
{
ApiKey = _novaPoshtaGateway.ApiKey,
CalledMethod = "delete",
ModelName = MODEL
};

var response = _novaPoshtaGateway.CreateRequest<DeleteDocumentRequest, DeleteDocumentResponse>(request);
return response;
}
}
}
Loading

0 comments on commit 4970565

Please sign in to comment.