Fiscalization - Redcrest-Solutions/FlyingFleet-issues GitHub Wiki

graph TD;
  a(Open Cash Register)-->b(Enter Start Cash)
  b-->c{Operation Type}
  c-->d(Sale)
  c-->e(Cancelling)
  c-->f(Change Cash Inventory)
  d-->g{More entry}
  e-->g
  f-->g
  g-->|No| h(Closing Cash Register)
  g-->|Yes| b

Open Cash Register

Just start creating transactions in a TSS

Enter Start Cash

SIGN DE => transaction ?? Example

Sale

SIGN DE

// Create
var request = RestRequest(MiddleWareUrl + "/tss/" + tss + "/admin/auth", Method.Post);
request.AddJsonBody(new { admin_pin = adminPin });

// Update (set active)
request = new RestRequest(MiddleWareUrl + "/tss/" + tss + "/tx/" + txGuid, Method.Put);
request.AddJsonBody(new { state = "ACTIVE", client_id = "00000000-0000-0000-0000-000000000000" });

// Finish Order
request = new RestRequest(MiddleWareUrl + "/tss/" + tss + "/tx/" + txGuid, Method.Put);
            request.AddJsonBody(new
            {
                state = "FINISHED",
                client_id = "00000000-0000-0000-0000-000000000000",
                schema = new
                {
                    standard_v1 = new
                    {
                        order = new
                        {
                            line_items = new[] {
                                new { quantity = "1", text = "Beer", price_per_unit = "6.00" },
                                new { quantity = "1", text = "Coke", price_per_unit = "2.00" }
                            }
                        }
                    }
                }
            });

// Finish payment
            request = new RestRequest(MiddleWareUrl + "/tss/" + tss + "/tx/" + txGuid, Method.Put);
            request.AddJsonBody(new
            {
                state = "FINISHED",
                client_id = "00000000-0000-0000-0000-000000000000",
                schema = new
                {
                    standard_v1 = new
                    {
                        receipt = new
                        {
                            receipt_type = "RECEIPT",
                            amounts_per_vat_rate = new[]
                            {
                                new { vat_rate = "NORMAL", amount = "14.875" }
                            },
                            amounts_per_payment_type = new[]
                            {
                                new { payment_type = "CASH", amount = "14.875" }
                            }
                        }
                    }
                }
            });

Cancelling

SIGN DE

            request = new RestRequest(MiddleWareUrl + "/tss/" + tss + "/tx/" + txGuid, Method.Put);
            request.AddJsonBody(new
            {
                state = "CANCELLED",
                client_id = "00000000-0000-0000-0000-000000000000",
                schema = new
                {
                    standard_v1 = new
                    {
                        receipt = new
                        {
                            receipt_type = "CANCELLATION",
                            amounts_per_vat_rate = new[]
                            {
                                new { vat_rate = "NORMAL", amount = "14.875" }
                            },
                            amounts_per_payment_type = new[]
                            {
                                new { payment_type = "CASH", amount = "14.875" }
                            }
                        }
                    }
                }
            });

Change Cash Inventory

SIGN DE => transaction ?? Example

Closing Cash Register

DSFINVK DE

            request = new RestRequest(CashRegisterJournalUrl + "/cash_point_closings/" + closing_id, Method.Put);
            request.AddJsonBody(new
            {
                head = new
                {
                    first_transaction_export_id = first_transaction_id,
                    last_transaction_export_id = last_transaction_id,
                    export_creation_date = 1577833200
                },
                client_id = "00000000-0000-0000-0000-000000000000",
                cash_point_closing_export_id = 2147483647
            });