Skip to content

Commit a97d118

Browse files
author
CIRF-DEV9
committed
2.2.0
1 parent 04b3539 commit a97d118

46 files changed

Lines changed: 7331 additions & 115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/RELEASE_NOTES.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
## Rejestr zmian: Wersja 2.2.0
2+
### Nowe
3+
- Dodano możliwość przełączenia PascalCase/camelCase w nazwach właściwości zwracanych z API.
4+
- Dodano obsługę endpointa `POST /permissions/query/entities/grants` umożliwiającego pobranie listy uprawnień do obsługi faktur w bieżącym kontekście logowania.
5+
- Rozszerzono odpowiedź endpointu POST `/auth/challenge` o pole `clientIp` zwracające adres IP klienta zarejestrowany przez KSeF.
6+
- Ustandaryzowano odpowiedzi `401 Unauthorized` oraz `403 Forbidden` do formatu Problem Details `(application/problem+json)`.
7+
- Dodano schematy `UnauthorizedProblemDetails` oraz `ForbiddenProblemDetails`.
8+
- Rozszerzono `ForbiddenProblemDetails` o wymagane pole `reasonCode` oraz o opcjonalny obiekt `security` (dodatkowe dane zależne od `reasonCode`).
9+
110
## Rejestr zmian: Wersja 2.1.2
211
### Nowe
12+
313
- Dodano nowy kod systemowy `FA_RR(1)` w `SystemCode` (wraz z mapowaniem w `SystemCodeHelper`).
414
- Dodano nowy test E2E dla faktury VAT RR: `AuthorizationPermissionsRRInvoicingE2ETests.RRInvoicingPermission_AllowsSendingFaRrInvoice`.
515

616
## Rejestr zmian: Wersja 2.1.1
717
### Nowe
818
- Dodano parametr `enforceXadesCompliance` w metodzie `SubmitXadesAuthRequestAsync`, umożliwiający wcześniejsze włączenie nowych wymagań walidacji XAdES na środowiskach DEMO i PROD poprzez nagłówek `X-KSeF-Feature: enforce-xades-compliance`.
9-
- Dodano wsparcie dla .NET Standard 2.0 dla Windows oraz .NET Framework 4.8, dzięki zaangażowaniu Kontrybutora [@marcinborecki](https://github.com/CIRFMF/ksef-client-csharp/commits?author=marcinborecki)
19+
- Dodano wsparcie dla .NET Standard 2.0 dla Windows oraz .NET Framework 4.8, dzięki zaangażowaniu Kontrybutora [@marcinborecki](https://github.com/CIRFMF/ksef-client-csharp/pull/197)
20+
1021

1122

1223
## Rejestr zmian: Wersja 2.1.0
@@ -19,7 +30,7 @@
1930

2031
### Zmodyfikowane
2132
- `AuthStatus`, `AuthenticationListItem`: Pole `AuthenticationMethod` oznaczono jako **Obsolete** (planowane wycofanie: 2026-11-16).
22-
- Metody `AddBatchFilePart` oraz `AddBatchFileParts` z parametrem `fileName` oznaczono jako przestarzałe (Obsolete) i zostaną usunięte w niedalekiej przyszłości. Zaleca się używanie przyciążeń bez parametru `fileName`
33+
- Metody `AddBatchFilePart` oraz `AddBatchFileParts` z parametrem `fileName` oznaczono jako przestarzałe (Obsolete) i zostaną usunięte w niedalekiej przyszłości. Zaleca się używanie przeciążeń bez parametru `fileName`
2334
- `KsefNumberValidator` zwraca teraz komunikat informujący o błędzie w przypadku nieprawidłowej sumy kontrolnej
2435
- `DateRange`: Zmieniono typ pól `From` i `To` z DateTime na DateTimeOffset w celu poprawnej obsługi stref czasowych i offsetów zgodnie ze specyfikacją API KSeF (format ISO 8601 z offsetem/UTC/lokalny Europe/Warsaw)
2536
- Zmiana typu DateRange.From i DateRange.To z DateTime na DateTimeOffset może wpłynąć na Twoje rozwiązania. Jeśli korzystasz z DateRange do filtrowania faktur, sprawdź czy Twój kod poprawnie tworzy DateTimeOffset

KSeF.Client.ClientFactory/KSeFFactoryExtensions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Extensions.DependencyInjection;
2+
using KSeF.Client.Http;
23
using System.Net.Http.Headers;
34

45
namespace KSeF.Client.ClientFactory.DI
@@ -13,8 +14,13 @@ public static class KSeFFactoryExtensions
1314
/// </summary>
1415
/// <param name="services">Rozszerzany interfejs</param>
1516
/// <exception cref="ArgumentException"></exception>
16-
public static IServiceCollection RegisterKSeFClientFactory(this IServiceCollection services)
17+
public static IServiceCollection RegisterKSeFClientFactory(this IServiceCollection services, bool useCamelCase = false)
1718
{
19+
if (useCamelCase)
20+
{
21+
JsonUtil.ResetConfigurationForCasePropertyName(useCamelCase);
22+
}
23+
1824
services.AddHttpClient(Environment.Demo.ToString(), http =>
1925
{
2026
http.BaseAddress = new Uri(KsefEnvironmentConfig.BaseUrls[Environment.Demo]);

KSeF.Client.Core/Exceptions/ApiExceptionDetail.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,14 @@ public class ApiExceptionDetail
2121
/// Opcjonalna lista dodatkowych komunikatów kontekstowych.
2222
/// </summary>
2323
public List<string> Details { get; set; }
24+
25+
public ApiExceptionDetail() { }
26+
27+
public ApiExceptionDetail(int code, string description, List<string> details = null)
28+
{
29+
ExceptionCode = code;
30+
ExceptionDescription = description;
31+
Details = details;
32+
}
2433
}
2534
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
3+
namespace KSeF.Client.Core.Exceptions
4+
{
5+
public class ForbiddenProblemDetails
6+
{
7+
public string Title { get; set; }
8+
public int Status { get; set; }
9+
public string Detail { get; set; }
10+
public string Instance { get; set; }
11+
public string ReasonCode { get; set; }
12+
public Dictionary<string, object> Security { get; set; }
13+
public string TraceId { get; set; }
14+
}
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace KSeF.Client.Core.Exceptions
2+
{
3+
public class UnauthorizedProblemDetails
4+
{
5+
public string Title { get; set; }
6+
public int Status { get; set; }
7+
public string Detail { get; set; }
8+
public string Instance { get; set; }
9+
public string TraceId { get; set; }
10+
}
11+
}

KSeF.Client.Core/Infrastructure/Rest/Routes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ public static class Query
374374
/// Wyszukiwanie uprawnień nadanych podmiotom unijnym (EU entities) w bieżącym kontekście.
375375
/// </summary>
376376
public const string EuEntitiesGrants = Prefix + "/query/eu-entities/grants";
377+
378+
/// <summary>
379+
/// Wyszukiwanie uprawnień do obsługi faktur w bieżącym kontekście.
380+
/// </summary>
381+
public const string Entities = Prefix + "/query/entities/grants";
377382
}
378383

379384
/// <summary>

KSeF.Client.Core/Interfaces/Clients/ISearchPermissionClient.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,21 @@ public interface ISearchPermissionClient
103103
/// <exception cref="KsefApiException">Nieprawidłowe żądanie. (400 Bad request)</exception>
104104
/// <exception cref="KsefApiException">Brak autoryzacji. (401 Unauthorized)</exception>
105105
Task<PagedPermissionsResponse<EuEntityPermission>> SearchGrantedEuEntityPermissionsAsync(EuEntityPermissionsQueryRequest requestPayload, string accessToken, int? pageOffset = null, int? pageSize = null, CancellationToken cancellationToken = default);
106+
107+
/// <summary>
108+
/// Pobranie listy uprawnień do obsługi faktur w bieżącym kontekście.
109+
/// </summary>
110+
/// <param name="requestPayload">Zapytanie z ContextIdentifier</param>
111+
/// <param name="accessToken">Access token</param>
112+
/// <param name="pageOffset">Index strony wyników (domyślnie 0)</param>
113+
/// <param name="pageSize">Ilość elementów na stronie (domyślnie 10)</param>
114+
/// <param name="cancellationToken"></param>
115+
/// <returns><see cref="EntityPermissionGrantResponse"/></returns>
116+
Task<EntityPermissionGrantResponse> QueryEntitiesGrantsAsync(
117+
EntityPermissionGrantQueryRequest requestPayload,
118+
string accessToken,
119+
int? pageOffset = null,
120+
int? pageSize = null,
121+
CancellationToken cancellationToken = default);
106122
}
107123
}

KSeF.Client.Core/Models/ApiResponses/OnlineSessionCodeResponse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public static class OnlineSessionCodeResponse
4545
/// </summary>
4646
public const int SessionCancelledNoInvoices = 440;
4747

48-
/// <summary>
49-
/// Kod 445 — Błąd weryfikacji, brak poprawnych faktur.
50-
/// </summary>
51-
public const int NoValidInvoices = 445;
48+
/// <summary>
49+
/// Kod 445 — Błąd weryfikacji, brak poprawnych faktur.
50+
/// </summary>
51+
public const int NoValidInvoices = 445;
5252

5353
/// <summary>
5454
/// Kod 500 — Nieznany błąd.

KSeF.Client.Core/Models/Authorization/AuthenticationChallengeResponse.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ public class AuthenticationChallengeResponse
1919
/// </summary>
2020
public long TimestampMs { get; set; }
2121

22+
/// <summary>
23+
/// Adres IP klienta
24+
/// </summary>
25+
public string ClientIp { get; set; }
2226
}
2327
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Runtime.Serialization;
2+
using System.Xml.Serialization;
3+
4+
namespace KSeF.Client.Core.Models.Permissions.Entity
5+
{
6+
public class EntityPermissionGrantQueryRequest
7+
{
8+
public EntityPermissionGrantQueryContextIdentifier ContextIdentifier { get; set; }
9+
}
10+
11+
public class EntityPermissionGrantQueryContextIdentifier
12+
{
13+
public EntityPermissionGrantQueryContextIdentifierType Type { get; set; }
14+
public string Value { get; set; }
15+
16+
}
17+
18+
public enum EntityPermissionGrantQueryContextIdentifierType
19+
{
20+
[EnumMember(Value = "Nip")]
21+
Nip,
22+
[EnumMember(Value = "InternalId")]
23+
InternalId
24+
}
25+
}

0 commit comments

Comments
 (0)