fiskaly / fiskaly-sdk-java

fiskaly Cloud-TSE SDK for Java/JRE and Java/Android
MIT License
4 stars 0 forks source link

Cannot call upsertTransaction without not required paramter "schema" #28

Closed wmk1 closed 3 years ago

wmk1 commented 4 years ago

Currently there is attempt to create (or update) transaction using this endpoint:

https://developer.fiskaly.com/api/kassensichv/v1/#operation/upsertTransaction

However, I am always encountering an error regarding schema. I think that it's due to missing some properties upon V1Schema:

An error occured while attempting to connect with Fiskaly client. schema: Invalid type. Expected: object, given: string

so I am trying to make it without any schema as according to documentation, it's not mandatory parameter. Then, I am encountering another error:

An error occured while attempting to connect with Fiskaly client. The TSS is not initialized. ERROR (ErrorLogger.java:36:flush) {} - { Status: "400", Error: "Bad Request", Message: "The TSS is not initialized.", Code: "E_TSS_NOT_INITIALIZED", RequestId: "d97f07322cf51ef6a806df82888cbfc5"}

I am pretty sure that I am using valid TSS as I am using it during TSS initialization and Client ID initialization. My code snippet: public void finishTransaction(UUID tssId, UUID tssClientId, int lastRevision, V1StandardSchema schema) { UUID txId = randomUUID(); Map<String, Object> requestBody = new HashMap<>(); requestBody.put("state", ACTIVE); requestBody.put("client_id", Preconditions.checkNotNull(tssClientId)); //requestBody.put("schema", new Gson().toJson(schema)); Map<String, Object> queryParams = new HashMap<>(); queryParams.put("last_revision", lastRevision); try { tseClient.serveTransaction(tssId, tssClientId, txId, new Gson().toJson(requestBody), queryParams);

Java version: openjdk version "1.8.0_265" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_265-b01) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.265-b01, mixed mode)

Fiskaly client DLL version: com.fiskaly.client-windows-amd64-v1.2.000 Fiskaly maven dependency:

com.fiskaly.sdk fiskaly-sdk 1.2.001-jre
wmk1 commented 3 years ago

Issue closed, the bug was within code, not SDK itself.