deniskristov / checkbox-api-client

Java API client
https://checkbox.ua
3 stars 1 forks source link

Added ReceiptFilter #6

Closed dimaloop closed 2 years ago

dimaloop commented 2 years ago

Hello, please review this PR

this is my first PR, I will be grateful for the comments, if something is not correct

dimaloop commented 2 years ago

Also:

dimaloop commented 2 years ago

Thank you for an answer!

  1. prefix did not work as expected with an "empty" StringJoiner - its always join prefix, even in a case of "empty" - so maybe you can point me with a small example?
  2. Ok, done. I think endpoints are not always exists in "tree" structure, but ok, fixed
  3. Sorry, my fault. I had no experience with lombok. Fixed

Feel free to edit my code, if it is possible

deniskristov commented 2 years ago
  1. sure:
    StringJoiner query = new StringJoiner("&","?", "");
    query.setEmptyValue("");
    Assert.assertEquals("", query.toString());
    query.add("test1");
    query.add("test2");
    Assert.assertEquals("?test1&test2", query.toString());
dimaloop commented 2 years ago

Ohh, you right. With emptyValue it works as expected

dimaloop commented 2 years ago

I cannot split the following changes in another PR while current is open (don't know how, sorry), so there are new changes:

[+] added CARD type to Payment [+] extended TYPEs and fields of ReceiptModel according to api specs [+] added value/extraValue fields to ReportTaxesModel

deniskristov commented 2 years ago

Great! One more thing: I cannot find serial in the documentation and my test shows that it doesn't work.

By the way, as I remember CARD is deprecated, and CASHLESS should be used instead. But anyway, if it exists in docs it's a good idea to have it in enums.

dimaloop commented 2 years ago
  1. You right, "serial" field field is not included in the search. Fixed
  2. Cannot find any info about CARD is deprecated https://dev-api.checkbox.in.ua/api/redoc#operation/get_receipt_api_v1_receipts_new__receipt_id__get
type string (Готівкова форма оплати (CASH))Enum: "CASH" "CARD" "CASHLESS"An enumeration.
deniskristov commented 2 years ago
  1. Here: https://dev-api.checkbox.in.ua/api/redoc#operation/create_receipt_api_v1_receipts_sell_post

image

dimaloop commented 2 years ago

Ok, confirmed. API documentation is a bit unclear

I will remove this type

BTW, "label" - required field, without them, I've got error