fiskaly / fiskaly-sdk-swift

fiskaly Cloud-TSE SDK for Swift/iOS
MIT License
5 stars 5 forks source link

SDKError Client is not readable #19

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello,

I get a Client is Not readable error when using FiskalySDK. It happens when I try to. Start a Transaction with client.request. Copied all code from the Readme.me and still getting the error. The Client and TSS Is active in the Dashboard. It works in the Postmen environment but not with the FiskalyHTTPClient.

`let transactionBody = [ "state": "ACTIVE", "client_id": client_id, ]

           let transactionBodyData = try? JSONSerialization.data(withJSONObject: transactionBody)
           let transactionBodyEncoded = transactionBodyData?.base64EncodedString()

 error ->          let responseCreateTransaction = try client.request(
               method: "PUT",
               path: "tss/\(TSE)/tx/\(transactionUUID)",
               query: ["last_revision": "0"],
               body: transactionBodyEncoded!)`
prempador commented 4 years ago

Hello, thanks for the report. Seems like SDKError was thrown every time an error occured, I fixed this with the latest commit. You should now see the right Error Message.

ghost commented 4 years ago

Thanks for the fast support! How to handle now when the SDK throws : Client response not decodable into class. Should I modify the Decode or are there other solutions?

prempador commented 4 years ago

That error should never really happen, I am trying to reproduce your problem, but I don't seem to be able to. Could you provide any more information, as your bug report is kind of vague.

ghost commented 4 years ago

Hello I made a Screenshot now with the SDK which you committed, which gives me advanced Error Informations:

Bildschirmfoto 2020-06-13 um 20 00 08
prempador commented 4 years ago

Could you send the String inside the body here so I can decode it? You can also decode it yourself.

But it is a 401 Error, so "Unauthorized". Please make sure you have a valid API_KEY and API_SECRET.

ghost commented 4 years ago

body: "eyJzdGF0dXNfY29kZSI6NDAxLCJlcnJvciI6IlVuYXV0aG9yaXplZCIsIm1lc3NhZ2UiOiJBdXRob3JpemF0aW9uIGhlYWRlciBtdXN0IGZvbGxvdyB0aGUgZm9ybWF0IFwiQXV0aG9yaXphdGlvbjogQmVhcmVyIC4uLlwiIn0="

i have a valid API_KEY and API_SECRET but I am using it without ProcessInfo.processInfo or might be there the problem?

Bildschirmfoto 2020-06-13 um 20 12 35
prempador commented 4 years ago

So I was just able to reproduce the exact same error message with a wrong API_KEY Pair. Please double check your credentials.

ghost commented 4 years ago

Big Thanks for the fast Support! It was first a little bit weird, I guess my Xcode messed it up everything, and with the 401 I had space char in the API Secret that's why it didn't work ;D

Do you have an email where I can ask you some questions about the api like providing "andere geschäftsvorfälle" like when the client opens the cashbox to describe the transactions or should I put this information in the raw { processData }

prempador commented 4 years ago

General support like questions about what and how things need to be signed are currently handled and distributed by our sales team. Please send an email to sales@fiskaly.com with your questions. We are working on a ticketing system for these questions. As soon as it is available it can be found at https://developer.fiskaly.com .