Uploaded image for project: 'mod-invoice'
  1. mod-invoice
  2. MODINVOICE-34

Create voucher on transition to "Approved"

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Priority: P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.0.0
    • Labels:
      None
    • Template:
    • Sprint:
      ACQ Sprint 65, ACQ Sprint 66
    • Story Points:
      5
    • Development Team:
      Thunderjet

      Description

      Overview:
      When an invoice transitions to "Approved" status, a voucher and associated voucher lines should be generated.

      1. Obtain a system generated voucher number via GET /voucher-storage/voucher-number
      2. Apply fund distributions and calculate totals for each voucher-line.
        • There's one voucher line for each externalAccountNumber.
        • Multiple funds can have the same externalAccountNumber
      3. Apply exchange rate calculations for each voucher-line
      4. Calculate voucher-level totals from all of the voucher-line totals (after exchange rate has been applied to each line)
      5. For now, ignore invoice adjustments. Adjustments will be covered in a separate story

      The JSR 354 JavaMoney API should be used. For now the default currencyExchangeProvider configuration is sufficient. Fine-tuning may take place in later stories.

      Example:

      Invoice

      • currency: EUR
      • status: Approved
      • total: €40
      • invoiceLines:
        • InvoiceLine-1
          • total: €10
          • fundDistributions:
            • FD001 - Fund A: 50%
            • FD002 - Fund B: 50%
        • InvoiceLine-2
          • total: €10
          • fundDistributions:
            • FD003 - Fund B: 50%
            • FD004 - Fund C: 50%
        • InvoiceLine-3
          • total: €20
          • fundDistributions:
            • FD005 - Fund B: 25%
            • FD006 - Fund D: 75%

      Fund A

      • externalAccountNo: 123456

      Fund B

      • externalAccountNo: 234567

      Fund C

      • externalAccountNo: 123456

      Fund D

      • externalAccountNo: 345678

      Voucher

      • systemCurrency: USD
      • invoiceCurrency: EUR
      • exchangeRate: 1.10
      • voucherAmount: $44.00
      • voucherLines:
        • VoucherLine-1
          • externalAccountNo: 123456
          • sourceIds:
            • UUID of InvoiceLine-1
            • UUID of InvoiceLine-2
          • fundDistributions:
            • FD001 -> Fund A: €5 (InvoiceLine-1)
            • FD004 -> Fund C: €5 (InvoiceLine-2)
          • voucherLineAmount: $11.00
        • VoucherLine-2
          • externalAccountNo: 234567
          • sourceIds:
            • UUID of InvoiceLine-1
            • UUID of InvoiceLine-2
            • UUID of InvoiceLine-3
          • fundDistributions:
            • FD002 -> Fund B: €5 (InvoiceLine-1)
            • FD003 -> Fund B: €5 (InvoiceLine-2)
            • FD005 -> Fund B: €5 (InvoiceLine-3)
          • voucherLineAmount: $16.50
        • VoucherLine-3
          • externalAccountNo: 345678
          • sourceIds:
            • UUID of InvoiceLine-3
          • fundDistributions:
            • FD006 -> Fund D: €15 (InvoiceLine-3)
          • voucherLineAmount: $16.50

      I've also attached a text file with more basic examples of an invoice, invoiceLines, funds, voucher, voucherLines in json format: https://issues.folio.org/secure/attachment/18280/voucher_json_example.txt

      Acceptance Criteria:

      • Vouchers are created as described above upon invoice transition to "Approved"
      • Unit tests are updated
      • API tests will be handled in a separate story
      • JavaMoney is used for calculations and currency exchanges

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                khandramai Viachaslau Khandramai
                Reporter:
                cmcnally Craig McNally
                Tester Assignee:
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases