-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Możliwość określenia nagłówka Accept dla niektórych endpointów (stero…
…wanie wersją typu wyniku zwracanego przez endpoint KSeF, np. `application/vnd.v3+json`) - wyjątek `NoAuthenticationException` — dla błędu 21304 brak uwierzytelniania - `NoAuthorizationException` - wyrzucany dla "21301 Brak autoryzacji" dziedziczy aktualnie po `NonRepeatableException`
- Loading branch information
Showing
16 changed files
with
242 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-api/src/main/java/io/alapierre/ksef/client/model/rest/invoice/SessionStatusResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.alapierre.ksef.client.model.rest.invoice; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* @author Adrian Lapierre {@literal [email protected]} | ||
* Copyrights by original author 2022.01.22 | ||
*/ | ||
@Data | ||
public class SessionStatusResponse { | ||
private String timestamp; | ||
private String referenceNumber; | ||
private int processingCode; | ||
private String processingDescription; | ||
private String upoUrl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...ient-spec/src/main/java/io/alapierre/ksef/client/exception/NoAuthenticationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package io.alapierre.ksef.client.exception; | ||
|
||
import io.alapierre.ksef.client.ApiException; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Adrian Lapierre {@literal [email protected]} | ||
* Copyrights by original author 2023.10.23 | ||
*/ | ||
public class NoAuthenticationException extends ApiException { | ||
|
||
public NoAuthenticationException() { | ||
} | ||
|
||
public NoAuthenticationException(Throwable throwable) { | ||
super(throwable); | ||
} | ||
|
||
public NoAuthenticationException(String message) { | ||
super(message); | ||
} | ||
|
||
public NoAuthenticationException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody, List<ExceptionDetail> details) { | ||
super(message, throwable, code, responseHeaders, responseBody, details); | ||
} | ||
|
||
public NoAuthenticationException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(message, throwable, code, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthenticationException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(message, code, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthenticationException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { | ||
super(message, throwable, code, responseHeaders); | ||
} | ||
|
||
public NoAuthenticationException(int code, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(code, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthenticationException(int code, String message) { | ||
super(code, message); | ||
} | ||
|
||
public NoAuthenticationException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody, List<ExceptionDetail> details) { | ||
super(code, message, responseHeaders, responseBody, details); | ||
} | ||
|
||
public NoAuthenticationException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(code, message, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthenticationException(String message, Throwable throwable) { | ||
super(message, throwable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,13 @@ | ||
package io.alapierre.ksef.client.exception; | ||
|
||
import io.alapierre.ksef.client.ApiException; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Adrian Lapierre {@literal [email protected]} | ||
* Copyrights by original author 2023.10.23 | ||
*/ | ||
public class NoAuthorizationException extends ApiException { | ||
|
||
public NoAuthorizationException() { | ||
} | ||
|
||
public NoAuthorizationException(Throwable throwable) { | ||
super(throwable); | ||
} | ||
|
||
public NoAuthorizationException(String message) { | ||
super(message); | ||
} | ||
public class NoAuthorizationException extends NonRepeatableException { | ||
|
||
public NoAuthorizationException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody, List<ExceptionDetail> details) { | ||
super(message, throwable, code, responseHeaders, responseBody, details); | ||
|
@@ -34,27 +21,7 @@ public NoAuthorizationException(String message, int code, Map<String, List<Strin | |
super(message, code, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthorizationException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { | ||
super(message, throwable, code, responseHeaders); | ||
} | ||
|
||
public NoAuthorizationException(int code, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(code, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthorizationException(int code, String message) { | ||
super(code, message); | ||
} | ||
|
||
public NoAuthorizationException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody, List<ExceptionDetail> details) { | ||
super(code, message, responseHeaders, responseBody, details); | ||
} | ||
|
||
public NoAuthorizationException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { | ||
super(code, message, responseHeaders, responseBody); | ||
} | ||
|
||
public NoAuthorizationException(String message, Throwable throwable) { | ||
super(message, throwable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
ksef-sample/src/test-integration/java/io/alapierre/ksef/test/BaseIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.alapierre.ksef.test; | ||
|
||
import io.alapierre.ksef.client.AbstractApiClient; | ||
import io.alapierre.ksef.client.ApiClient; | ||
import io.alapierre.ksef.client.ApiException; | ||
import io.alapierre.ksef.client.JsonSerializer; | ||
import io.alapierre.ksef.client.api.InterfejsyInteraktywneFakturaApi; | ||
import io.alapierre.ksef.client.api.InterfejsyInteraktywneSesjaApi; | ||
import io.alapierre.ksef.client.model.rest.auth.AuthorisationChallengeRequest; | ||
import io.alapierre.ksef.client.model.rest.auth.InitSignedResponse; | ||
import io.alapierre.ksef.client.model.rest.auth.SessionTerminateResponse; | ||
import io.alapierre.ksef.client.okhttp.OkHttpApiClient; | ||
import io.alapierre.ksef.client.serializer.gson.GsonJsonSerializer; | ||
import io.alapierre.ksef.token.facade.KsefTokenFacade; | ||
import lombok.val; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.text.ParseException; | ||
|
||
import static io.alapierre.ksef.test.TestConfig.NIP; | ||
import static io.alapierre.ksef.test.TestConfig.TOKEN; | ||
|
||
/** | ||
* @author Adrian Lapierre {@literal [email protected]} | ||
* Copyrights by original author 2023.11.07 | ||
*/ | ||
public abstract class BaseIT { | ||
|
||
protected final JsonSerializer serializer = new GsonJsonSerializer(); | ||
protected final ApiClient client = new OkHttpApiClient(serializer); | ||
protected final InterfejsyInteraktywneSesjaApi sessionApi = new InterfejsyInteraktywneSesjaApi(client); | ||
protected final InterfejsyInteraktywneFakturaApi invoiceApi = new InterfejsyInteraktywneFakturaApi(client); | ||
|
||
protected @NotNull InitSignedResponse login() throws ParseException, ApiException { | ||
val facade = new KsefTokenFacade(sessionApi); | ||
return facade.authByToken(AbstractApiClient.Environment.TEST, NIP, AuthorisationChallengeRequest.IdentifierType.onip, TOKEN); | ||
} | ||
|
||
protected @NotNull SessionTerminateResponse logout(String sessionToken) throws ApiException { | ||
return sessionApi.terminateSession(sessionToken); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.