Skip to content

Commit

Permalink
Update Order and CustomerSearch (#292)
Browse files Browse the repository at this point in the history
* Update CustomerSearch
Change search parameter Phone1 to Phone

* Update Order
Add TotalToPay and reorder fields alphabetically

* Fix tests
Add checksum to OCR numbers
  • Loading branch information
adamelfstrom authored Oct 4, 2024
1 parent 588b1d4 commit e0b4cab
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 39 deletions.
10 changes: 8 additions & 2 deletions FortnoxSDK.Tests/ConnectorTests/CustomerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public async Task Test_Find()
#endregion Arrange

var testKeyMark = TestUtils.RandomString();
var testPhone1 = "111111111";

var connector = FortnoxClient.CustomerConnector;
var newCustomer = new Customer()
Expand All @@ -92,7 +93,8 @@ public async Task Test_Find()
Email = "[email protected]",
Type = CustomerType.Private,
Active = false,
Comments = testKeyMark
Comments = testKeyMark,
Phone1 = testPhone1
};

//Add entries
Expand All @@ -102,7 +104,11 @@ public async Task Test_Find()
}

//Apply base test filter
var searchSettings = new CustomerSearch();
var searchSettings = new CustomerSearch
{
City = testKeyMark,
Phone = testPhone1
};
searchSettings.City = testKeyMark;
var fullCollection = await connector.FindAsync(searchSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Test_SupplierInvoiceExternalURLConnection_CRUD()
InvoiceDate = new DateTime(2020, 1, 1),
DueDate = new DateTime(2020, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task Test_SupplierInvoiceFileConnection_CRUD()
InvoiceDate = new DateTime(2020, 1, 1),
DueDate = new DateTime(2020, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Test_SupplierInvoicePayment_CRUD()
InvoiceDate = new DateTime(2020, 1, 1),
DueDate = new DateTime(2020, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down
6 changes: 3 additions & 3 deletions FortnoxSDK.Tests/ConnectorTests/SupplierInvoiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task Test_SupplierInvoice_CRUD()
InvoiceDate = new DateTime(2010, 1, 1),
DueDate = new DateTime(2010, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down Expand Up @@ -95,7 +95,7 @@ public async Task Test_Find()
InvoiceDate = new DateTime(2010, 1, 1),
DueDate = new DateTime(2010, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down Expand Up @@ -157,7 +157,7 @@ public async Task Test_Book()
InvoiceDate = new DateTime(2020, 1, 1),
DueDate = new DateTime(2020, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down
2 changes: 1 addition & 1 deletion FortnoxSDK.Tests/ReportedIssuesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public async Task Test_Issue96_fixed() // Origins from https://github.com/Fortno
InvoiceDate = new DateTime(2010, 1, 1),
DueDate = new DateTime(2010, 2, 1),
SalesType = SalesType.Stock,
OCR = "123456789",
OCR = "1234567897",
Total = 5000,
SupplierInvoiceRows = new List<SupplierInvoiceRow>()
{
Expand Down
5 changes: 5 additions & 0 deletions FortnoxSDK/Entities.Subsets/OrderSubset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ public class OrderSubset
[ReadOnly]
[JsonProperty]
public decimal? Total { get; private set; }

///<summary> Total amount to pay </summary>
[ReadOnly]
[JsonProperty]
public decimal? TotalToPay { get; private set; }
}
63 changes: 34 additions & 29 deletions FortnoxSDK/Entities/Orders/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ public class Order
///<summary> Delivery name </summary>
[JsonProperty]
public string DeliveryName { get; set; }

[WarehouseRequired]
[JsonProperty]
public DeliveryState? DeliveryState { get; set; }

///<summary> Delivery zip code </summary>
[JsonProperty]
Expand Down Expand Up @@ -158,6 +162,14 @@ public class Order
[ReadOnly]
[JsonProperty]
public long? InvoiceReference { get; private set; }

///<summary> The properties for the object in this array is listed in the table “Labels” </summary>
[JsonProperty]
public IList<LabelReference> Labels { get; set; }

///<summary> Language code. Can be SV or EN. </summary>
[JsonProperty]
public Language? Language { get; set; }

///<summary> Net amount </summary>
[ReadOnly]
Expand Down Expand Up @@ -215,6 +227,10 @@ public class Order
[JsonProperty]
public string Project { get; set; }

/// <summary> The date that the document was marked as ready in warehouse. </summary>
[JsonProperty]
public DateTime? OutboundDate { get; set; }

///<summary> Remarks on order </summary>
[JsonProperty]
public string Remarks { get; set; }
Expand All @@ -228,6 +244,14 @@ public class Order
[ReadOnly]
[JsonProperty]
public bool? Sent { get; private set; }

/// <summary> The stock point that the items are to taken from or has been taken from. </summary>
[JsonProperty]
public string StockPointCode { get; set; }

/// <summary> The stock point that the items are to taken from or has been taken from. </summary>
[JsonProperty]
public string StockPointId { get; set; }

///<summary> Amount of the Taxreduction </summary>
[ReadOnly]
Expand All @@ -250,6 +274,11 @@ public class Order
[ReadOnly]
[JsonProperty]
public decimal? Total { get; private set; }

///<summary> Total amount to pay </summary>
[ReadOnly]
[JsonProperty]
public decimal? TotalToPay { get; private set; }

///<summary> Total vat amount </summary>
[ReadOnly]
Expand All @@ -263,6 +292,11 @@ public class Order
///<summary> Code of delivery </summary>
[JsonProperty]
public string WayOfDelivery { get; set; }

/// <summary> Used to see if the document has been marked as ready in warehouse. </summary>
[ReadOnly]
[JsonProperty]
public bool? WarehouseReady { get; private set; }

///<summary> Customer reference </summary>
[JsonProperty]
Expand All @@ -275,33 +309,4 @@ public class Order
///<summary> Order zip code </summary>
[JsonProperty]
public string ZipCode { get; set; }

/// <summary> The stock point that the items are to taken from or has been taken from. </summary>
[JsonProperty]
public string StockPointCode { get; set; }

/// <summary> The stock point that the items are to taken from or has been taken from. </summary>
[JsonProperty]
public string StockPointId { get; set; }

/// <summary> Used to see if the document has been marked as ready in warehouse. </summary>
[ReadOnly]
[JsonProperty]
public bool? WarehouseReady { get; private set; }

/// <summary> The date that the document was marked as ready in warehouse. </summary>
[JsonProperty]
public DateTime? OutboundDate { get; set; }

[WarehouseRequired]
[JsonProperty]
public DeliveryState? DeliveryState { get; set; }

///<summary> The properties for the object in this array is listed in the table “Labels” </summary>
[JsonProperty]
public IList<LabelReference> Labels { get; set; }

///<summary> Language code. Can be SV or EN. </summary>
[JsonProperty]
public Language? Language { get; set; }
}
7 changes: 6 additions & 1 deletion FortnoxSDK/Search/CustomerSearch.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Fortnox.SDK.Search;

public class CustomerSearch : BaseSearch
Expand All @@ -23,6 +25,9 @@ public class CustomerSearch : BaseSearch

[SearchParameter]
public string GLNDelivery { get; set; }

[SearchParameter]
public DateTime LastModified { get; set; }

Check warning on line 30 in FortnoxSDK/Search/CustomerSearch.cs

View workflow job for this annotation

GitHub Actions / build

'CustomerSearch.LastModified' hides inherited member 'BaseSearch.LastModified'. Use the new keyword if hiding was intended.

[SearchParameter]
public string Name { get; set; }
Expand All @@ -31,7 +36,7 @@ public class CustomerSearch : BaseSearch
public string OrganisationNumber { get; set; }

[SearchParameter]
public string Phone1 { get; set; }
public string Phone { get; set; }

[SearchParameter]
public string ZipCode { get; set; }
Expand Down

0 comments on commit e0b4cab

Please sign in to comment.