Uploaded image for project: 'mod-invoice-storage'
  1. mod-invoice-storage
  2. MODINVOSTO-6

Implement invoice-number API

    XMLWordPrintable

    Details

    • Template:
    • Sprint:
      ACQ Sprint 60
    • Story Points:
      1
    • Development Team:
      Thunderjet

      Description

      Overview: The invoice needs a human readable number that uniques it in the system. This will be known as the FOLIO invoice number and is separate from the UUID of the invoice record.

      Requirements:
      FOLIO Invoice Number

      • System Generated
      • Should be unique
      • Should be sequential
      • Should not be editable
      • Min and number of digits is irrelevant to the user
      • Max number of digits should be 40
      • Presence of alphas in this number is irrelevant to the user

      Approach:

      • Create a sequence in the database during tenant setup. Example:
        CREATE SEQUENCE IF NOT EXISTS ${myuniversity}_${mymodule}.invoice_number NO MAXVALUE START WITH 10000 CACHE 1 NO CYCLE;
        GRANT USAGE ON SEQUENCE ${myuniversity}_${mymodule}.invoice_number TO ${myuniversity}_${mymodule};
        CREATE UNIQUE INDEX IF NOT EXISTS invoices_invoice_number_unique_idx ON ${myuniversity}_${mymodule}.invoices ((jsonb->>'invoiceNumber'))
        
      • The GET /invoice-storage/invoice-number API would simply get and return the next value in this sequence. e.g. SELECT nextval('invoice_number')

      NOTE: The default maximun value for a sequence in postgres is 2^63-1, which is much shorter than the 40 characters mentioned in the requirements (only 19 digits at most). However, the likelihood of ever reaching this number of invoices is very low, even when considering the arbitrary start value of 10000.

      Acceptance Criteria:

      • Unit test coverage is at or above 80% on new code
      • Raml/Module descriptor are updated

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                KVupp Kruthi Vuppala
                Reporter:
                dennisbridges Dennis Bridges
                Tester Assignee:
                Dennis Bridges Dennis Bridges
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases