@powerhousedao/contributor-billing 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -8
- package/dist/document-models/billing-statement/actions.d.ts +1 -0
- package/dist/document-models/billing-statement/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.js +58 -47
- package/dist/document-models/billing-statement/gen/document-schema.d.ts +38 -38
- package/dist/document-models/billing-statement/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +6 -2
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts +3 -2
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.js +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/ph-factories.js +1 -1
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +5 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.js +5 -0
- package/dist/document-models/billing-statement/gen/utils.js +2 -2
- package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/general.js +5 -4
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/line-items.js +7 -2
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/tags.js +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.js +94 -7
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts +2 -1
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/general.test.js +33 -88
- package/dist/document-models/billing-statement/src/tests/line-items.test.js +22 -125
- package/dist/document-models/billing-statement/src/tests/tags.test.js +13 -47
- package/dist/document-models/document-models.js +2 -2
- package/dist/document-models/expense-report/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/expense-report/gen/document-model.js +48 -48
- package/dist/document-models/expense-report/gen/document-schema.d.ts +6 -6
- package/dist/document-models/expense-report/gen/utils.js +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.js +94 -8
- package/dist/document-models/expense-report/src/tests/wallet.test.js +145 -10
- package/dist/document-models/index.d.ts +2 -6
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +2 -6
- package/dist/document-models/integrations/gen/document-model.js +33 -33
- package/dist/document-models/integrations/gen/document-schema.d.ts +6 -6
- package/dist/document-models/integrations/gen/utils.js +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.js +9 -32
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/integrations/src/tests/document-model.test.js +91 -5
- package/dist/document-models/integrations/src/tests/integrations.test.js +21 -46
- package/dist/document-models/invoice/gen/document-model.js +147 -147
- package/dist/document-models/invoice/gen/document-schema.d.ts +127 -127
- package/dist/document-models/invoice/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.js +16 -122
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +4 -4
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +17 -123
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +34 -10
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +7 -7
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +96 -50
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/transitions.js +69 -53
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/invoice/src/tests/document-model.test.js +91 -4
- package/dist/document-models/invoice/src/tests/general.test.js +24 -26
- package/dist/document-models/invoice/src/tests/items.test.js +37 -17
- package/dist/document-models/invoice/src/tests/parties.test.js +32 -26
- package/dist/document-models/invoice/src/tests/transitions.test.js +52 -500
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -1
- package/dist/document-models/invoice/utils/statusTransitions.js +10 -10
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +32 -23
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/objectSetTable.js +1 -2
- package/dist/editors/billing-statement/editor.d.ts +4 -0
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +34 -16
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +36 -37
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +28 -10
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.js +18 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveContents.js +10 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts +7 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.js +16 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/EmptyState.js +10 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Files.js +12 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/FolderTree.js +65 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Folders.js +12 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/clean-new-editor/config.d.ts +4 -0
- package/dist/editors/clean-new-editor/config.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/config.js +5 -0
- package/dist/editors/clean-new-editor/editor.d.ts +4 -0
- package/dist/editors/clean-new-editor/editor.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/editor.js +11 -0
- package/dist/editors/clean-new-editor/module.d.ts +3 -0
- package/dist/editors/clean-new-editor/module.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/module.js +10 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts +14 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.js +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts +3 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DriveContents.js +10 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +3 -3
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +13 -180
- package/dist/editors/contributor-billing/components/EmptyState.d.ts +3 -0
- package/dist/editors/contributor-billing/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/EmptyState.js +10 -0
- package/dist/editors/contributor-billing/components/Files.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Files.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Files.js +12 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +6 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderTree.js +65 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Folders.js +12 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts +38 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/HeaderControls.js +124 -0
- package/dist/editors/contributor-billing/components/HeaderStats.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.js → HeaderStats.js} +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts +22 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.js +399 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts +6 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.js +111 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts +32 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.js +55 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts +13 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.js +16 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/contributor-billing/config.d.ts +1 -0
- package/dist/editors/contributor-billing/config.d.ts.map +1 -1
- package/dist/editors/contributor-billing/config.js +4 -1
- package/dist/editors/contributor-billing/editor.d.ts +1 -0
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +4 -1
- package/dist/editors/contributor-billing/module.d.ts +1 -1
- package/dist/editors/contributor-billing/module.d.ts.map +1 -1
- package/dist/editors/contributor-billing/module.js +3 -2
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts +15 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts.map +1 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.js +122 -0
- package/dist/editors/editors.js +2 -2
- package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts.map +1 -1
- package/dist/editors/expense-report/editor.js +8 -8
- package/dist/editors/index.d.ts +2 -2
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/editors/integrations/components/EditName.d.ts +3 -0
- package/dist/editors/integrations/components/EditName.d.ts.map +1 -0
- package/dist/editors/integrations/components/EditName.js +31 -0
- package/dist/editors/integrations/editor.d.ts +2 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +5 -132
- package/dist/editors/integrations/module.d.ts +1 -0
- package/dist/editors/integrations/module.d.ts.map +1 -1
- package/dist/editors/integrations/module.js +3 -2
- package/dist/editors/invoice/components/confirmationModal.js +1 -1
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/countryForm.js +1 -1
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/currencyForm.js +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -1
- package/dist/editors/invoice/components/datePicker.js +1 -1
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -1
- package/dist/editors/invoice/components/inputField.js +3 -2
- package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/components/lineItemMobileModal.js +1 -1
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/selectField.js +7 -7
- package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -1
- package/dist/editors/invoice/components/statusModalComponents.js +27 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +102 -40
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
- package/dist/editors/invoice/exportUBL.js +35 -18
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +15 -9
- package/dist/editors/invoice/invoiceToGnosis.js +3 -3
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.js +3 -3
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.js +4 -3
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/module.d.ts +1 -0
- package/dist/editors/invoice/module.d.ts.map +1 -1
- package/dist/editors/invoice/module.js +2 -1
- package/dist/editors/invoice/requestFinance.js +4 -4
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +5 -4
- package/dist/editors/invoice/utils/utils.d.ts.map +1 -1
- package/dist/editors/invoice/utils/utils.js +5 -4
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +11 -5
- package/dist/editors/invoice/validation/validationManager.d.ts +2 -2
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +5 -5
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +178 -178
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts +7 -0
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/DriveExplorer.js +184 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts +2 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.js +73 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.js +1 -1
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/RowActionMenu.d.ts +1 -1
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
- package/dist/old-contributor-billing/config.d.ts +3 -0
- package/dist/old-contributor-billing/config.d.ts.map +1 -0
- package/dist/old-contributor-billing/config.js +4 -0
- package/dist/old-contributor-billing/editor.d.ts +3 -0
- package/dist/old-contributor-billing/editor.d.ts.map +1 -0
- package/dist/old-contributor-billing/editor.js +8 -0
- package/dist/old-contributor-billing/module.d.ts +3 -0
- package/dist/old-contributor-billing/module.d.ts.map +1 -0
- package/dist/old-contributor-billing/module.js +9 -0
- package/dist/old-contributor-billing/util.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/util.js +11 -9
- package/dist/powerhouse.manifest.json +6 -41
- package/dist/processors/index.d.ts +1 -6
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -18
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createExpenseReportCsv.js +24 -24
- package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createXeroCsv.js +52 -46
- package/dist/scripts/invoice/autoTagging.d.ts +1 -1
- package/dist/scripts/invoice/autoTagging.d.ts.map +1 -1
- package/dist/scripts/invoice/autoTagging.js +168 -138
- package/dist/scripts/invoice/exampleBatchTxn.js +16 -16
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +32 -25
- package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
- package/dist/scripts/invoice/pdfToClaudeAI.js +36 -30
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
- package/dist/scripts/invoice/requestFinance.js +13 -13
- package/dist/style.css +407 -13659
- package/dist/subgraphs/billing-statement/resolvers.d.ts +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +16 -5
- package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/schema.js +12 -67
- package/dist/subgraphs/expense-report/resolvers.d.ts +1 -1
- package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/resolvers.js +4 -5
- package/dist/subgraphs/expense-report/schema.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/schema.js +5 -48
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/integrations/resolvers.d.ts +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +4 -5
- package/dist/subgraphs/integrations/schema.d.ts.map +1 -1
- package/dist/subgraphs/integrations/schema.js +3 -43
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/index.js +1 -20
- package/dist/subgraphs/invoice/resolvers.d.ts +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +4 -9
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +14 -232
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.d.ts +1 -1
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -0
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.js +38 -34
- package/dist/subgraphs/invoice-addon/index.d.ts +11 -0
- package/dist/subgraphs/invoice-addon/index.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/index.js +11 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/resolvers.js +12 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/schema.js +52 -0
- package/package.json +9 -20
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +0 -8
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/actions.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +0 -4
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.js +0 -3
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts +0 -2
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/error.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +0 -7
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.js +0 -3
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +0 -6
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +0 -1
- package/dist/document-models/expense-report/src/tests/expense-report.test.js +0 -24
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +0 -2
- package/dist/editors/contributor-billing/util.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.d.ts +0 -4
- package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.js +0 -8
- package/dist/editors/hooks/useExpenseReportDocument.d.ts +0 -4
- package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useExpenseReportDocument.js +0 -8
- package/dist/editors/hooks/useIntegrationsDocument.d.ts +0 -4
- package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useIntegrationsDocument.js +0 -8
- package/dist/editors/hooks/useInvoiceDocument.d.ts +0 -4
- package/dist/editors/hooks/useInvoiceDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useInvoiceDocument.js +0 -8
- package/dist/editors/integrations/config.d.ts +0 -3
- package/dist/editors/integrations/config.d.ts.map +0 -1
- package/dist/editors/integrations/config.js +0 -3
- package/dist/editors/invoice/exportSAFTPT.d.ts +0 -184
- package/dist/editors/invoice/exportSAFTPT.d.ts.map +0 -1
- package/dist/editors/invoice/exportSAFTPT.js +0 -548
- package/dist/processors/line-item-processor/index.d.ts +0 -11
- package/dist/processors/line-item-processor/index.d.ts.map +0 -1
- package/dist/processors/line-item-processor/index.js +0 -36
- package/dist/subgraphs/invoice/customResolvers.d.ts.map +0 -1
- package/editors/invoice/assets/custom.d.ts +0 -4
- package/editors/invoice/assets/powerhouseLogo.png +0 -0
- /package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.d.ts → HeaderStats.d.ts} +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/util.d.ts +0 -0
|
@@ -2,506 +2,58 @@
|
|
|
2
2
|
* This is a scaffold file meant for customization:
|
|
3
3
|
* - change it by adding new tests or modifying the existing ones
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import {} from "
|
|
7
|
-
import { reducer } from "
|
|
8
|
-
import * as creators from "../../gen/transitions/creators.js";
|
|
5
|
+
import { describe, it, expect } from "vitest";
|
|
6
|
+
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
+
import { reducer, utils, isInvoiceDocument, cancel, CancelInputSchema, issue, IssueInputSchema, reset, ResetInputSchema, reject, RejectInputSchema, accept, AcceptInputSchema, } from "@powerhousedao/contributor-billing/document-models/invoice";
|
|
9
8
|
describe("Transitions Operations", () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
beforeEach(() => {
|
|
60
|
-
document.state.global.status = "ISSUED";
|
|
61
|
-
document.state.global.invoiceNo = "INV-2024-001";
|
|
62
|
-
document.state.global.dateIssued = "2024-01-15";
|
|
63
|
-
});
|
|
64
|
-
it("should handle ISSUED -> REJECTED transition", () => {
|
|
65
|
-
const input = {
|
|
66
|
-
id: "rejection-1",
|
|
67
|
-
reason: "Incorrect pricing information",
|
|
68
|
-
final: false
|
|
69
|
-
};
|
|
70
|
-
const updatedDocument = reducer(document, creators.reject(input));
|
|
71
|
-
expect(updatedDocument.state.global.status).toBe("REJECTED");
|
|
72
|
-
expect(updatedDocument.state.global.rejections).toHaveLength(1);
|
|
73
|
-
expect(updatedDocument.state.global.rejections[0].reason).toBe("Incorrect pricing information");
|
|
74
|
-
expect(updatedDocument.state.global.rejections[0].final).toBe(false);
|
|
75
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
76
|
-
expect(updatedDocument.operations.global[0].type).toBe("REJECT");
|
|
77
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
78
|
-
});
|
|
79
|
-
it("should handle ISSUED -> ACCEPTED transition", () => {
|
|
80
|
-
const input = {
|
|
81
|
-
payAfter: "2024-02-15T00:00:00Z"
|
|
82
|
-
};
|
|
83
|
-
const updatedDocument = reducer(document, creators.accept(input));
|
|
84
|
-
expect(updatedDocument.state.global.status).toBe("ACCEPTED");
|
|
85
|
-
expect(updatedDocument.state.global.payAfter).toBe("2024-02-15T00:00:00Z");
|
|
86
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
87
|
-
expect(updatedDocument.operations.global[0].type).toBe("ACCEPT");
|
|
88
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
describe("REJECTED status transitions", () => {
|
|
92
|
-
beforeEach(() => {
|
|
93
|
-
document.state.global.status = "REJECTED";
|
|
94
|
-
document.state.global.rejections = [{
|
|
95
|
-
id: "rejection-1",
|
|
96
|
-
reason: "Incorrect pricing",
|
|
97
|
-
final: false
|
|
98
|
-
}];
|
|
99
|
-
});
|
|
100
|
-
it("should handle REJECTED -> ISSUED transition", () => {
|
|
101
|
-
const input = {
|
|
102
|
-
_placeholder: "reinstate_placeholder"
|
|
103
|
-
};
|
|
104
|
-
const updatedDocument = reducer(document, creators.reinstate(input));
|
|
105
|
-
expect(updatedDocument.state.global.status).toBe("ISSUED");
|
|
106
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
107
|
-
expect(updatedDocument.operations.global[0].type).toBe("REINSTATE");
|
|
108
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
109
|
-
});
|
|
110
|
-
it("should not allow REJECTED -> ISSUED transition when final rejection exists", () => {
|
|
111
|
-
document.state.global.rejections = [{
|
|
112
|
-
id: "rejection-1",
|
|
113
|
-
reason: "Final rejection",
|
|
114
|
-
final: true
|
|
115
|
-
}];
|
|
116
|
-
const input = {
|
|
117
|
-
_placeholder: "reinstate_placeholder"
|
|
118
|
-
};
|
|
119
|
-
const updatedDocument = reducer(document, creators.reinstate(input));
|
|
120
|
-
expect(updatedDocument.operations.global[0].error).toBe("Cannot reinstate an invoice that has been rejected");
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
describe("ACCEPTED status transitions", () => {
|
|
124
|
-
beforeEach(() => {
|
|
125
|
-
document.state.global.status = "ACCEPTED";
|
|
126
|
-
});
|
|
127
|
-
it("should handle ACCEPTED -> PAYMENTSCHEDULED transition", () => {
|
|
128
|
-
const input = {
|
|
129
|
-
id: "payment-1",
|
|
130
|
-
processorRef: "stripe_pi_123456"
|
|
131
|
-
};
|
|
132
|
-
const updatedDocument = reducer(document, creators.schedulePayment(input));
|
|
133
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTSCHEDULED");
|
|
134
|
-
expect(updatedDocument.state.global.payments).toHaveLength(1);
|
|
135
|
-
expect(updatedDocument.state.global.payments[0].id).toBe("payment-1");
|
|
136
|
-
expect(updatedDocument.state.global.payments[0].processorRef).toBe("stripe_pi_123456");
|
|
137
|
-
expect(updatedDocument.state.global.payments[0].confirmed).toBe(false);
|
|
138
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
139
|
-
expect(updatedDocument.operations.global[0].type).toBe("SCHEDULE_PAYMENT");
|
|
140
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
141
|
-
});
|
|
142
|
-
it("should handle ACCEPTED -> PAYMENTCLOSED transition", () => {
|
|
143
|
-
const input = {
|
|
144
|
-
closureReason: "CANCELLED"
|
|
145
|
-
};
|
|
146
|
-
const updatedDocument = reducer(document, creators.closePayment(input));
|
|
147
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
|
|
148
|
-
expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
|
|
149
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
150
|
-
expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
|
|
151
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
describe("PAYMENTSCHEDULED status transitions", () => {
|
|
155
|
-
beforeEach(() => {
|
|
156
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
157
|
-
document.state.global.payments = [{
|
|
158
|
-
id: "payment-1",
|
|
159
|
-
processorRef: "stripe_pi_123456",
|
|
160
|
-
paymentDate: "",
|
|
161
|
-
txnRef: "",
|
|
162
|
-
confirmed: false,
|
|
163
|
-
issue: "",
|
|
164
|
-
amount: 0
|
|
165
|
-
}];
|
|
166
|
-
});
|
|
167
|
-
it("should handle PAYMENTSCHEDULED -> PAYMENTSENT transition", () => {
|
|
168
|
-
const input = {
|
|
169
|
-
id: "payment-1",
|
|
170
|
-
timestamp: "2024-01-20T10:30:00Z",
|
|
171
|
-
txRef: "txn_789012"
|
|
172
|
-
};
|
|
173
|
-
const updatedDocument = reducer(document, creators.registerPaymentTx(input));
|
|
174
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTSENT");
|
|
175
|
-
expect(updatedDocument.state.global.payments[0].txnRef).toBe("txn_789012");
|
|
176
|
-
expect(updatedDocument.state.global.payments[0].paymentDate).toBe("2024-01-20T10:30:00Z");
|
|
177
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
178
|
-
expect(updatedDocument.operations.global[0].type).toBe("REGISTER_PAYMENT_TX");
|
|
179
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
180
|
-
});
|
|
181
|
-
it("should handle PAYMENTSCHEDULED -> PAYMENTISSUE transition", () => {
|
|
182
|
-
const input = {
|
|
183
|
-
id: "payment-1",
|
|
184
|
-
issue: "Payment processor timeout"
|
|
185
|
-
};
|
|
186
|
-
const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
|
|
187
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
|
|
188
|
-
expect(updatedDocument.state.global.payments[0].issue).toBe("Payment processor timeout");
|
|
189
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
190
|
-
expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
|
|
191
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
192
|
-
});
|
|
193
|
-
it("should handle PAYMENTSCHEDULED -> PAYMENTCLOSED transition", () => {
|
|
194
|
-
const input = {
|
|
195
|
-
closureReason: "CANCELLED"
|
|
196
|
-
};
|
|
197
|
-
const updatedDocument = reducer(document, creators.closePayment(input));
|
|
198
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
|
|
199
|
-
expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
|
|
200
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
201
|
-
expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
|
|
202
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
describe("PAYMENTSENT status transitions", () => {
|
|
206
|
-
beforeEach(() => {
|
|
207
|
-
document.state.global.status = "PAYMENTSENT";
|
|
208
|
-
document.state.global.payments = [{
|
|
209
|
-
id: "payment-1",
|
|
210
|
-
processorRef: "stripe_pi_123456",
|
|
211
|
-
paymentDate: "2024-01-20T10:30:00Z",
|
|
212
|
-
txnRef: "txn_789012",
|
|
213
|
-
confirmed: false,
|
|
214
|
-
issue: "",
|
|
215
|
-
amount: 0
|
|
216
|
-
}];
|
|
217
|
-
});
|
|
218
|
-
it("should handle PAYMENTSENT -> PAYMENTISSUE transition", () => {
|
|
219
|
-
const input = {
|
|
220
|
-
id: "payment-1",
|
|
221
|
-
issue: "Transaction failed"
|
|
222
|
-
};
|
|
223
|
-
const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
|
|
224
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
|
|
225
|
-
expect(updatedDocument.state.global.payments[0].issue).toBe("Transaction failed");
|
|
226
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
227
|
-
expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
|
|
228
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
229
|
-
});
|
|
230
|
-
it("should handle PAYMENTSENT -> PAYMENTRECEIVED transition", () => {
|
|
231
|
-
const input = {
|
|
232
|
-
id: "payment-1",
|
|
233
|
-
amount: 1500.00
|
|
234
|
-
};
|
|
235
|
-
const updatedDocument = reducer(document, creators.confirmPayment(input));
|
|
236
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTRECEIVED");
|
|
237
|
-
expect(updatedDocument.state.global.payments[0].confirmed).toBe(true);
|
|
238
|
-
expect(updatedDocument.state.global.payments[0].amount).toBe(1500.00);
|
|
239
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
240
|
-
expect(updatedDocument.operations.global[0].type).toBe("CONFIRM_PAYMENT");
|
|
241
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
describe("PAYMENTISSUE status transitions", () => {
|
|
245
|
-
beforeEach(() => {
|
|
246
|
-
document.state.global.status = "PAYMENTISSUE";
|
|
247
|
-
document.state.global.payments = [{
|
|
248
|
-
id: "payment-1",
|
|
249
|
-
processorRef: "stripe_pi_123456",
|
|
250
|
-
paymentDate: "",
|
|
251
|
-
txnRef: "",
|
|
252
|
-
confirmed: false,
|
|
253
|
-
issue: "Payment processor timeout",
|
|
254
|
-
amount: 0
|
|
255
|
-
}];
|
|
256
|
-
});
|
|
257
|
-
it("should handle PAYMENTISSUE -> ACCEPTED transition", () => {
|
|
258
|
-
const input = {
|
|
259
|
-
_placeholder: "reapprove_placeholder"
|
|
260
|
-
};
|
|
261
|
-
const updatedDocument = reducer(document, creators.reapprovePayment(input));
|
|
262
|
-
expect(updatedDocument.state.global.status).toBe("ACCEPTED");
|
|
263
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
264
|
-
expect(updatedDocument.operations.global[0].type).toBe("REAPPROVE_PAYMENT");
|
|
265
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
266
|
-
});
|
|
267
|
-
it("should handle PAYMENTISSUE -> PAYMENTCLOSED transition", () => {
|
|
268
|
-
const input = {
|
|
269
|
-
closureReason: "CANCELLED"
|
|
270
|
-
};
|
|
271
|
-
const updatedDocument = reducer(document, creators.closePayment(input));
|
|
272
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
|
|
273
|
-
expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
|
|
274
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
275
|
-
expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
|
|
276
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
describe("PAYMENTRECEIVED status transitions", () => {
|
|
280
|
-
beforeEach(() => {
|
|
281
|
-
document.state.global.status = "PAYMENTRECEIVED";
|
|
282
|
-
document.state.global.payments = [{
|
|
283
|
-
id: "payment-1",
|
|
284
|
-
processorRef: "stripe_pi_123456",
|
|
285
|
-
paymentDate: "2024-01-20T10:30:00Z",
|
|
286
|
-
txnRef: "txn_789012",
|
|
287
|
-
confirmed: true,
|
|
288
|
-
issue: "",
|
|
289
|
-
amount: 1500.00
|
|
290
|
-
}];
|
|
291
|
-
});
|
|
292
|
-
it("should handle PAYMENTRECEIVED -> PAYMENTISSUE transition", () => {
|
|
293
|
-
const input = {
|
|
294
|
-
id: "payment-1",
|
|
295
|
-
issue: "Payment amount discrepancy"
|
|
296
|
-
};
|
|
297
|
-
const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
|
|
298
|
-
expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
|
|
299
|
-
expect(updatedDocument.state.global.payments[0].issue).toBe("Payment amount discrepancy");
|
|
300
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
301
|
-
expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
|
|
302
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
describe("PAYMENTCLOSED status transitions", () => {
|
|
306
|
-
beforeEach(() => {
|
|
307
|
-
document.state.global.status = "PAYMENTCLOSED";
|
|
308
|
-
document.state.global.closureReason = "CANCELLED";
|
|
309
|
-
});
|
|
310
|
-
it("should handle PAYMENTCLOSED -> ACCEPTED transition", () => {
|
|
311
|
-
const input = {
|
|
312
|
-
_placeholder: "reapprove_placeholder"
|
|
313
|
-
};
|
|
314
|
-
const updatedDocument = reducer(document, creators.reapprovePayment(input));
|
|
315
|
-
expect(updatedDocument.state.global.status).toBe("ACCEPTED");
|
|
316
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
317
|
-
expect(updatedDocument.operations.global[0].type).toBe("REAPPROVE_PAYMENT");
|
|
318
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
describe("Error cases", () => {
|
|
322
|
-
it("should throw error for invalid DRAFT -> ACCEPTED transition", () => {
|
|
323
|
-
document.state.global.status = "DRAFT";
|
|
324
|
-
const input = {
|
|
325
|
-
payAfter: "2024-02-15T00:00:00Z"
|
|
326
|
-
};
|
|
327
|
-
const updatedDocument = reducer(document, creators.accept(input));
|
|
328
|
-
expect(updatedDocument.operations.global[0].error).toBe("Invalid transition from DRAFT to ACCEPTED");
|
|
329
|
-
});
|
|
330
|
-
it("should throw error for invalid ISSUED -> PAYMENTSCHEDULED transition", () => {
|
|
331
|
-
document.state.global.status = "ISSUED";
|
|
332
|
-
const input = {
|
|
333
|
-
id: "payment-1",
|
|
334
|
-
processorRef: "stripe_pi_123456"
|
|
335
|
-
};
|
|
336
|
-
const updatedDocument = reducer(document, creators.schedulePayment(input));
|
|
337
|
-
expect(updatedDocument.operations.global[0].error).toBe("Invalid transition from ISSUED to PAYMENTSCHEDULED");
|
|
338
|
-
});
|
|
339
|
-
it("should throw error for missing required fields in issue operation", () => {
|
|
340
|
-
document.state.global.status = "DRAFT";
|
|
341
|
-
const input = {
|
|
342
|
-
invoiceNo: "",
|
|
343
|
-
dateIssued: ""
|
|
344
|
-
};
|
|
345
|
-
const updatedDocument = reducer(document, creators.issue(input));
|
|
346
|
-
expect(updatedDocument.operations.global[0].error).toBe("Invoice number and date issued are required");
|
|
347
|
-
});
|
|
348
|
-
it("should throw error for missing required fields in reject operation", () => {
|
|
349
|
-
document.state.global.status = "ISSUED";
|
|
350
|
-
const input = {
|
|
351
|
-
id: "",
|
|
352
|
-
reason: "",
|
|
353
|
-
final: false
|
|
354
|
-
};
|
|
355
|
-
const updatedDocument = reducer(document, creators.reject(input));
|
|
356
|
-
expect(updatedDocument.operations.global[0].error).toBe("Reason, ID and final are required");
|
|
357
|
-
});
|
|
358
|
-
it("should throw error for missing required fields in schedulePayment operation", () => {
|
|
359
|
-
document.state.global.status = "ACCEPTED";
|
|
360
|
-
const input = {
|
|
361
|
-
id: "",
|
|
362
|
-
processorRef: ""
|
|
363
|
-
};
|
|
364
|
-
const updatedDocument = reducer(document, creators.schedulePayment(input));
|
|
365
|
-
expect(updatedDocument.operations.global[0].error).toBe("ID and processorRef are required");
|
|
366
|
-
});
|
|
367
|
-
it("should throw error when payment not found in registerPaymentTx operation", () => {
|
|
368
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
369
|
-
document.state.global.payments = [{
|
|
370
|
-
id: "payment-1",
|
|
371
|
-
processorRef: "stripe_pi_123456",
|
|
372
|
-
paymentDate: "",
|
|
373
|
-
txnRef: "",
|
|
374
|
-
confirmed: false,
|
|
375
|
-
issue: "",
|
|
376
|
-
amount: 0
|
|
377
|
-
}];
|
|
378
|
-
const input = {
|
|
379
|
-
id: "non-existent-payment",
|
|
380
|
-
timestamp: "2024-01-20T10:30:00Z",
|
|
381
|
-
txRef: "txn_789012"
|
|
382
|
-
};
|
|
383
|
-
const updatedDocument = reducer(document, creators.registerPaymentTx(input));
|
|
384
|
-
expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
|
|
385
|
-
});
|
|
386
|
-
it("should throw schema validation error for invalid datetime in registerPaymentTx operation", () => {
|
|
387
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
388
|
-
document.state.global.payments = [{
|
|
389
|
-
id: "payment-1",
|
|
390
|
-
processorRef: "stripe_pi_123456",
|
|
391
|
-
paymentDate: "",
|
|
392
|
-
txnRef: "",
|
|
393
|
-
confirmed: false,
|
|
394
|
-
issue: "",
|
|
395
|
-
amount: 0
|
|
396
|
-
}];
|
|
397
|
-
// This should fail at the schema level due to invalid datetime format
|
|
398
|
-
expect(() => {
|
|
399
|
-
const input = {
|
|
400
|
-
id: "payment-1",
|
|
401
|
-
timestamp: "invalid-datetime",
|
|
402
|
-
txRef: "txn_789012"
|
|
403
|
-
};
|
|
404
|
-
reducer(document, creators.registerPaymentTx(input));
|
|
405
|
-
}).toThrow();
|
|
406
|
-
});
|
|
407
|
-
it("should throw error for missing required fields in reportPaymentIssue operation", () => {
|
|
408
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
409
|
-
document.state.global.payments = [{
|
|
410
|
-
id: "payment-1",
|
|
411
|
-
processorRef: "stripe_pi_123456",
|
|
412
|
-
paymentDate: "",
|
|
413
|
-
txnRef: "",
|
|
414
|
-
confirmed: false,
|
|
415
|
-
issue: "",
|
|
416
|
-
amount: 0
|
|
417
|
-
}];
|
|
418
|
-
const input = {
|
|
419
|
-
id: "",
|
|
420
|
-
issue: ""
|
|
421
|
-
};
|
|
422
|
-
const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
|
|
423
|
-
expect(updatedDocument.operations.global[0].error).toBe("ID and issue are required");
|
|
424
|
-
});
|
|
425
|
-
it("should throw error for missing required fields in confirmPayment operation", () => {
|
|
426
|
-
document.state.global.status = "PAYMENTSENT";
|
|
427
|
-
document.state.global.payments = [{
|
|
428
|
-
id: "payment-1",
|
|
429
|
-
processorRef: "stripe_pi_123456",
|
|
430
|
-
paymentDate: "2024-01-20T10:30:00Z",
|
|
431
|
-
txnRef: "txn_789012",
|
|
432
|
-
confirmed: false,
|
|
433
|
-
issue: "",
|
|
434
|
-
amount: 0
|
|
435
|
-
}];
|
|
436
|
-
const input = {
|
|
437
|
-
id: "",
|
|
438
|
-
amount: 0
|
|
439
|
-
};
|
|
440
|
-
const updatedDocument = reducer(document, creators.confirmPayment(input));
|
|
441
|
-
expect(updatedDocument.operations.global[0].error).toBe("ID and amount are required");
|
|
442
|
-
});
|
|
443
|
-
it("should throw error for missing required fields in closePayment operation", () => {
|
|
444
|
-
document.state.global.status = "ACCEPTED";
|
|
445
|
-
const input = {
|
|
446
|
-
closureReason: undefined
|
|
447
|
-
};
|
|
448
|
-
const updatedDocument = reducer(document, creators.closePayment(input));
|
|
449
|
-
expect(updatedDocument.operations.global[0].error).toBe("Closure reason is required");
|
|
450
|
-
});
|
|
451
|
-
it("should throw error when payment not found in registerPaymentTx", () => {
|
|
452
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
453
|
-
document.state.global.payments = [{
|
|
454
|
-
id: "payment-1",
|
|
455
|
-
processorRef: "stripe_pi_123456",
|
|
456
|
-
paymentDate: "",
|
|
457
|
-
txnRef: "",
|
|
458
|
-
confirmed: false,
|
|
459
|
-
issue: "",
|
|
460
|
-
amount: 0
|
|
461
|
-
}];
|
|
462
|
-
const input = {
|
|
463
|
-
id: "non-existent-payment",
|
|
464
|
-
timestamp: "2024-01-20T10:30:00Z",
|
|
465
|
-
txRef: "txn_789012"
|
|
466
|
-
};
|
|
467
|
-
const updatedDocument = reducer(document, creators.registerPaymentTx(input));
|
|
468
|
-
expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
|
|
469
|
-
});
|
|
470
|
-
it("should throw error when payment not found in reportPaymentIssue", () => {
|
|
471
|
-
document.state.global.status = "PAYMENTSCHEDULED";
|
|
472
|
-
document.state.global.payments = [{
|
|
473
|
-
id: "payment-1",
|
|
474
|
-
processorRef: "stripe_pi_123456",
|
|
475
|
-
paymentDate: "",
|
|
476
|
-
txnRef: "",
|
|
477
|
-
confirmed: false,
|
|
478
|
-
issue: "",
|
|
479
|
-
amount: 0
|
|
480
|
-
}];
|
|
481
|
-
const input = {
|
|
482
|
-
id: "non-existent-payment",
|
|
483
|
-
issue: "Payment issue"
|
|
484
|
-
};
|
|
485
|
-
const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
|
|
486
|
-
expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
|
|
487
|
-
});
|
|
488
|
-
it("should throw error when payment not found in confirmPayment", () => {
|
|
489
|
-
document.state.global.status = "PAYMENTSENT";
|
|
490
|
-
document.state.global.payments = [{
|
|
491
|
-
id: "payment-1",
|
|
492
|
-
processorRef: "stripe_pi_123456",
|
|
493
|
-
paymentDate: "2024-01-20T10:30:00Z",
|
|
494
|
-
txnRef: "txn_789012",
|
|
495
|
-
confirmed: false,
|
|
496
|
-
issue: "",
|
|
497
|
-
amount: 0
|
|
498
|
-
}];
|
|
499
|
-
const input = {
|
|
500
|
-
id: "non-existent-payment",
|
|
501
|
-
amount: 1500.00
|
|
502
|
-
};
|
|
503
|
-
const updatedDocument = reducer(document, creators.confirmPayment(input));
|
|
504
|
-
expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
|
|
505
|
-
});
|
|
9
|
+
it("should handle cancel operation", () => {
|
|
10
|
+
const document = utils.createDocument();
|
|
11
|
+
const input = generateMock(CancelInputSchema());
|
|
12
|
+
const updatedDocument = reducer(document, cancel(input));
|
|
13
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
14
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
15
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("CANCEL");
|
|
16
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
17
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
18
|
+
});
|
|
19
|
+
it("should handle issue operation", () => {
|
|
20
|
+
const document = utils.createDocument();
|
|
21
|
+
const input = generateMock(IssueInputSchema());
|
|
22
|
+
const updatedDocument = reducer(document, issue(input));
|
|
23
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
24
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
25
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ISSUE");
|
|
26
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
27
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
28
|
+
});
|
|
29
|
+
it("should handle reset operation", () => {
|
|
30
|
+
const document = utils.createDocument();
|
|
31
|
+
const input = generateMock(ResetInputSchema());
|
|
32
|
+
const updatedDocument = reducer(document, reset(input));
|
|
33
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
34
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
35
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("RESET");
|
|
36
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
37
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
38
|
+
});
|
|
39
|
+
it("should handle reject operation", () => {
|
|
40
|
+
const document = utils.createDocument();
|
|
41
|
+
const input = generateMock(RejectInputSchema());
|
|
42
|
+
const updatedDocument = reducer(document, reject(input));
|
|
43
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
44
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
45
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("REJECT");
|
|
46
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
47
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
48
|
+
});
|
|
49
|
+
it("should handle accept operation", () => {
|
|
50
|
+
const document = utils.createDocument();
|
|
51
|
+
const input = generateMock(AcceptInputSchema());
|
|
52
|
+
const updatedDocument = reducer(document, accept(input));
|
|
53
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
54
|
+
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
55
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("ACCEPT");
|
|
56
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
57
|
+
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
506
58
|
});
|
|
507
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusTransitions.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/utils/statusTransitions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAWhC,
|
|
1
|
+
{"version":3,"file":"statusTransitions.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/utils/statusTransitions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAWhC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Status transitions mapping
|
|
2
2
|
export const permittedTransitions = {
|
|
3
|
-
DRAFT: [
|
|
4
|
-
CANCELLED: [
|
|
5
|
-
ISSUED: [
|
|
6
|
-
REJECTED: [
|
|
7
|
-
ACCEPTED: [
|
|
8
|
-
PAYMENTSCHEDULED: [
|
|
9
|
-
PAYMENTSENT: [
|
|
10
|
-
PAYMENTISSUE: [
|
|
11
|
-
PAYMENTRECEIVED: [
|
|
12
|
-
PAYMENTCLOSED: [
|
|
3
|
+
DRAFT: ["CANCELLED", "ISSUED"],
|
|
4
|
+
CANCELLED: ["DRAFT"],
|
|
5
|
+
ISSUED: ["REJECTED", "ACCEPTED"],
|
|
6
|
+
REJECTED: ["ISSUED"],
|
|
7
|
+
ACCEPTED: ["PAYMENTSCHEDULED", "PAYMENTCLOSED"],
|
|
8
|
+
PAYMENTSCHEDULED: ["PAYMENTSENT", "PAYMENTISSUE", "PAYMENTCLOSED"],
|
|
9
|
+
PAYMENTSENT: ["PAYMENTISSUE", "PAYMENTRECEIVED"],
|
|
10
|
+
PAYMENTISSUE: ["ACCEPTED", "PAYMENTCLOSED"],
|
|
11
|
+
PAYMENTRECEIVED: ["PAYMENTISSUE"],
|
|
12
|
+
PAYMENTCLOSED: ["ACCEPTED"],
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAE3B,MAAM,qDAAqD,CAAC;AAmC7D,QAAA,MAAM,cAAc,GAAI,OAAO;IAC7B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAClD,4CAigBA,CAAC;AAEF,eAAe,cAAc,CAAC"}
|