@powerhousedao/contributor-billing 0.0.82 → 0.0.83

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.
Files changed (36) hide show
  1. package/dist/document-models/invoice/gen/ph-factories.js +1 -1
  2. package/dist/document-models/invoice/gen/schema/types.d.ts +1 -0
  3. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
  4. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
  5. package/dist/document-models/invoice/gen/schema/zod.js +1 -0
  6. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  7. package/dist/document-models/invoice/src/reducers/general.js +1 -0
  8. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  9. package/dist/editors/contributor-billing/components/DriveExplorer.js +1 -26
  10. package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
  11. package/dist/editors/contributor-billing/components/EditorContainer.js +1 -13
  12. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +1 -2
  13. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  14. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +12 -3
  15. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +1 -3
  16. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  17. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +112 -56
  18. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
  19. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +9 -19
  20. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +2 -1
  21. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
  22. package/dist/editors/invoice/editor.d.ts.map +1 -1
  23. package/dist/editors/invoice/editor.js +1 -3
  24. package/package.json +1 -1
  25. package/dist/reducers/general.d.ts +0 -8
  26. package/dist/reducers/general.d.ts.map +0 -1
  27. package/dist/reducers/general.js +0 -73
  28. package/dist/reducers/items.d.ts +0 -8
  29. package/dist/reducers/items.d.ts.map +0 -1
  30. package/dist/reducers/items.js +0 -195
  31. package/dist/reducers/parties.d.ts +0 -8
  32. package/dist/reducers/parties.d.ts.map +0 -1
  33. package/dist/reducers/parties.js +0 -266
  34. package/dist/reducers/transitions.d.ts +0 -8
  35. package/dist/reducers/transitions.d.ts.map +0 -1
  36. package/dist/reducers/transitions.js +0 -162
@@ -1,266 +0,0 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - modify it by implementing the reducer functions
4
- * - delete the file and run the code generator again to have it reset
5
- */
6
- function getStateValue(input, currentValue) {
7
- return input === undefined ? currentValue : input;
8
- }
9
- export const reducer = {
10
- editIssuerOperation(state, action, dispatch) {
11
- try {
12
- if ('address' in state.issuer && ('city' in action.input ||
13
- 'country' in action.input ||
14
- 'extendedAddress' in action.input ||
15
- 'postalCode' in action.input ||
16
- 'stateProvince' in action.input ||
17
- 'streetAddress' in action.input)) {
18
- state.issuer.address = {
19
- ...state.issuer.address,
20
- city: action.input.city !== undefined ? action.input.city : state.issuer.address?.city ?? null,
21
- country: action.input.country !== undefined ? action.input.country : state.issuer.address?.country ?? null,
22
- extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.issuer.address?.extendedAddress ?? null,
23
- postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.issuer.address?.postalCode ?? null,
24
- stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.issuer.address?.stateProvince ?? null,
25
- streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.issuer.address?.streetAddress ?? null,
26
- };
27
- }
28
- if ('contactInfo' in state.issuer && ('tel' in action.input ||
29
- 'email' in action.input)) {
30
- state.issuer.contactInfo = {
31
- ...state.issuer.contactInfo,
32
- tel: action.input.tel !== undefined ? action.input.tel : state.issuer.contactInfo?.tel ?? null,
33
- email: action.input.email !== undefined ? action.input.email : state.issuer.contactInfo?.email ?? null,
34
- };
35
- }
36
- if ('country' in action.input) {
37
- state.issuer.country = action.input.country !== undefined ? action.input.country : state.issuer.country ?? null;
38
- }
39
- if ('id' in action.input) {
40
- state.issuer.id = action.input.id ? { taxId: action.input.id } : null;
41
- }
42
- if ('name' in action.input) {
43
- state.issuer.name = action.input.name !== undefined ? action.input.name : state.issuer.name ?? null;
44
- }
45
- }
46
- catch (e) {
47
- console.error(e);
48
- }
49
- },
50
- editIssuerBankOperation(state, action, dispatch) {
51
- try {
52
- if (!state.issuer.paymentRouting) {
53
- state.issuer.paymentRouting = {
54
- bank: null,
55
- wallet: null,
56
- };
57
- }
58
- state.issuer.paymentRouting.bank = {
59
- ABA: getStateValue(action.input.ABA, state.issuer.paymentRouting.bank?.ABA ?? null),
60
- BIC: getStateValue(action.input.BIC, state.issuer.paymentRouting.bank?.BIC ?? null),
61
- SWIFT: getStateValue(action.input.SWIFT, state.issuer.paymentRouting.bank?.SWIFT ?? null),
62
- accountNum: action.input.accountNum ??
63
- state.issuer.paymentRouting.bank?.accountNum ??
64
- "",
65
- accountType: getStateValue(action.input.accountType, state.issuer.paymentRouting.bank?.accountType ?? null),
66
- address: {
67
- city: getStateValue(action.input.city, state.issuer.paymentRouting.bank?.address.city ?? null),
68
- country: getStateValue(action.input.country, state.issuer.paymentRouting.bank?.address.country ?? null),
69
- extendedAddress: getStateValue(action.input.extendedAddress, state.issuer.paymentRouting.bank?.address.extendedAddress ?? null),
70
- postalCode: getStateValue(action.input.postalCode, state.issuer.paymentRouting.bank?.address.postalCode ?? null),
71
- stateProvince: getStateValue(action.input.stateProvince, state.issuer.paymentRouting.bank?.address.stateProvince ?? null),
72
- streetAddress: getStateValue(action.input.streetAddress, state.issuer.paymentRouting.bank?.address.streetAddress ?? null),
73
- },
74
- beneficiary: getStateValue(action.input.beneficiary, state.issuer.paymentRouting.bank?.beneficiary ?? null),
75
- name: action.input.name ?? state.issuer.paymentRouting.bank?.name ?? "",
76
- memo: getStateValue(action.input.memo, state.issuer.paymentRouting.bank?.memo ?? null),
77
- intermediaryBank: {
78
- ABA: getStateValue(action.input.ABAIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
79
- BIC: getStateValue(action.input.BICIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
80
- SWIFT: getStateValue(action.input.SWIFTIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
81
- accountNum: action.input.accountNumIntermediary ??
82
- state.issuer.paymentRouting.bank?.intermediaryBank?.accountNum ??
83
- "",
84
- accountType: getStateValue(action.input.accountTypeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.accountType ??
85
- null),
86
- address: {
87
- city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
88
- .city ?? null),
89
- country: getStateValue(action.input.countryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
90
- .country ?? null),
91
- extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
92
- .extendedAddress ?? null),
93
- postalCode: getStateValue(action.input.postalCodeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
94
- .postalCode ?? null),
95
- stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
96
- .stateProvince ?? null),
97
- streetAddress: getStateValue(action.input.streetAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
98
- .streetAddress ?? null),
99
- },
100
- beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
101
- null),
102
- name: action.input.nameIntermediary ??
103
- state.issuer.paymentRouting.bank?.intermediaryBank?.name ??
104
- "",
105
- memo: getStateValue(action.input.memoIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
106
- },
107
- };
108
- }
109
- catch (e) {
110
- console.error(e);
111
- }
112
- },
113
- editIssuerWalletOperation(state, action, dispatch) {
114
- try {
115
- if (!state.issuer.paymentRouting) {
116
- state.issuer.paymentRouting = {
117
- bank: null,
118
- wallet: null,
119
- };
120
- }
121
- state.issuer.paymentRouting.wallet = {
122
- address: action.input.address ??
123
- state.issuer.paymentRouting.wallet?.address ??
124
- null,
125
- chainId: action.input.chainId ??
126
- state.issuer.paymentRouting.wallet?.chainId ??
127
- null,
128
- chainName: action.input.chainName ??
129
- state.issuer.paymentRouting.wallet?.chainName ??
130
- null,
131
- rpc: action.input.rpc ?? state.issuer.paymentRouting.wallet?.rpc ?? null,
132
- };
133
- }
134
- catch (e) {
135
- console.error(e);
136
- }
137
- },
138
- editPayerOperation(state, action, dispatch) {
139
- try {
140
- if ('address' in state.payer && ('city' in action.input ||
141
- 'country' in action.input ||
142
- 'extendedAddress' in action.input ||
143
- 'postalCode' in action.input ||
144
- 'stateProvince' in action.input ||
145
- 'streetAddress' in action.input)) {
146
- state.payer.address = {
147
- ...state.payer.address,
148
- city: action.input.city !== undefined ? action.input.city : state.payer.address?.city ?? null,
149
- country: action.input.country !== undefined ? action.input.country : state.payer.address?.country ?? null,
150
- extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.payer.address?.extendedAddress ?? null,
151
- postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.payer.address?.postalCode ?? null,
152
- stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.payer.address?.stateProvince ?? null,
153
- streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.payer.address?.streetAddress ?? null,
154
- };
155
- }
156
- if ('contactInfo' in state.payer && ('tel' in action.input ||
157
- 'email' in action.input)) {
158
- state.payer.contactInfo = {
159
- ...state.payer.contactInfo,
160
- tel: action.input.tel !== undefined ? action.input.tel : state.payer.contactInfo?.tel ?? null,
161
- email: action.input.email !== undefined ? action.input.email : state.payer.contactInfo?.email ?? null,
162
- };
163
- }
164
- if ('country' in action.input) {
165
- state.payer.country = action.input.country !== undefined ? action.input.country : state.payer.country ?? null;
166
- }
167
- if ('id' in action.input) {
168
- state.payer.id = action.input.id ? { taxId: action.input.id } : null;
169
- }
170
- if ('name' in action.input) {
171
- state.payer.name = action.input.name !== undefined ? action.input.name : state.payer.name ?? null;
172
- }
173
- }
174
- catch (e) {
175
- console.error(e);
176
- }
177
- },
178
- editPayerBankOperation(state, action, dispatch) {
179
- try {
180
- if (!state.payer.paymentRouting) {
181
- state.payer.paymentRouting = {
182
- bank: null,
183
- wallet: null,
184
- };
185
- }
186
- state.payer.paymentRouting.bank = {
187
- ABA: getStateValue(action.input.ABA, state.payer.paymentRouting.bank?.ABA ?? null),
188
- BIC: getStateValue(action.input.BIC, state.payer.paymentRouting.bank?.BIC ?? null),
189
- SWIFT: getStateValue(action.input.SWIFT, state.payer.paymentRouting.bank?.SWIFT ?? null),
190
- accountNum: action.input.accountNum ??
191
- state.payer.paymentRouting.bank?.accountNum ??
192
- "",
193
- accountType: getStateValue(action.input.accountType, state.payer.paymentRouting.bank?.accountType ?? null),
194
- address: {
195
- city: getStateValue(action.input.city, state.payer.paymentRouting.bank?.address.city ?? null),
196
- country: getStateValue(action.input.country, state.payer.paymentRouting.bank?.address.country ?? null),
197
- extendedAddress: getStateValue(action.input.extendedAddress, state.payer.paymentRouting.bank?.address.extendedAddress ?? null),
198
- postalCode: getStateValue(action.input.postalCode, state.payer.paymentRouting.bank?.address.postalCode ?? null),
199
- stateProvince: getStateValue(action.input.stateProvince, state.payer.paymentRouting.bank?.address.stateProvince ?? null),
200
- streetAddress: getStateValue(action.input.streetAddress, state.payer.paymentRouting.bank?.address.streetAddress ?? null),
201
- },
202
- beneficiary: getStateValue(action.input.beneficiary, state.payer.paymentRouting.bank?.beneficiary ?? null),
203
- name: action.input.name ?? state.payer.paymentRouting.bank?.name ?? "",
204
- memo: getStateValue(action.input.memo, state.payer.paymentRouting.bank?.memo ?? null),
205
- intermediaryBank: {
206
- ABA: getStateValue(action.input.ABAIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
207
- BIC: getStateValue(action.input.BICIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
208
- SWIFT: getStateValue(action.input.SWIFTIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
209
- accountNum: action.input.accountNumIntermediary ??
210
- state.payer.paymentRouting.bank?.intermediaryBank?.accountNum ??
211
- "",
212
- accountType: getStateValue(action.input.accountTypeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.accountType ??
213
- null),
214
- address: {
215
- city: getStateValue(action.input.cityIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.city ??
216
- null),
217
- country: getStateValue(action.input.countryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
218
- .country ?? null),
219
- extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
220
- .extendedAddress ?? null),
221
- postalCode: getStateValue(action.input.postalCodeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
222
- .postalCode ?? null),
223
- stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
224
- .stateProvince ?? null),
225
- streetAddress: getStateValue(action.input.streetAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
226
- .streetAddress ?? null),
227
- },
228
- beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
229
- null),
230
- name: action.input.nameIntermediary ??
231
- state.payer.paymentRouting.bank?.intermediaryBank?.name ??
232
- "",
233
- memo: getStateValue(action.input.memoIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
234
- },
235
- };
236
- }
237
- catch (e) {
238
- console.error(e);
239
- }
240
- },
241
- editPayerWalletOperation(state, action, dispatch) {
242
- try {
243
- if (!state.payer.paymentRouting) {
244
- state.payer.paymentRouting = {
245
- bank: null,
246
- wallet: null,
247
- };
248
- }
249
- state.payer.paymentRouting.wallet = {
250
- address: action.input.address ??
251
- state.payer.paymentRouting.wallet?.address ??
252
- null,
253
- chainId: action.input.chainId ??
254
- state.payer.paymentRouting.wallet?.chainId ??
255
- null,
256
- chainName: action.input.chainName ??
257
- state.payer.paymentRouting.wallet?.chainName ??
258
- null,
259
- rpc: action.input.rpc ?? state.payer.paymentRouting.wallet?.rpc ?? null,
260
- };
261
- }
262
- catch (e) {
263
- console.error(e);
264
- }
265
- },
266
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - modify it by implementing the reducer functions
4
- * - delete the file and run the code generator again to have it reset
5
- */
6
- import type { InvoiceTransitionsOperations } from "../../gen/transitions/operations.js";
7
- export declare const reducer: InvoiceTransitionsOperations;
8
- //# sourceMappingURL=transitions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../reducers/transitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAGxF,eAAO,MAAM,OAAO,EAAE,4BA4IrB,CAAC"}
@@ -1,162 +0,0 @@
1
- /**
2
- * This is a scaffold file meant for customization:
3
- * - modify it by implementing the reducer functions
4
- * - delete the file and run the code generator again to have it reset
5
- */
6
- import { permittedTransitions } from "../../utils/statusTransitions.js";
7
- export const reducer = {
8
- cancelOperation(state, action, dispatch) {
9
- if (permittedTransitions[state.status].includes('CANCELLED')) {
10
- state.status = 'CANCELLED';
11
- }
12
- else {
13
- throw new Error(`Invalid transition from ${state.status} to CANCELLED`);
14
- }
15
- },
16
- issueOperation(state, action, dispatch) {
17
- if (!action.input.invoiceNo || !action.input.dateIssued) {
18
- throw new Error('Invoice number and date issued are required');
19
- }
20
- if (permittedTransitions[state.status].includes('ISSUED')) {
21
- state.status = 'ISSUED';
22
- state.invoiceNo = action.input.invoiceNo;
23
- state.dateIssued = action.input.dateIssued;
24
- }
25
- else {
26
- throw new Error(`Invalid transition from ${state.status} to ISSUED`);
27
- }
28
- },
29
- resetOperation(state, action, dispatch) {
30
- if (permittedTransitions[state.status].includes('DRAFT')) {
31
- state.status = 'DRAFT';
32
- }
33
- else {
34
- throw new Error(`Invalid transition from ${state.status} to DRAFT`);
35
- }
36
- },
37
- rejectOperation(state, action, dispatch) {
38
- if (!action.input.id || !action.input.reason) {
39
- throw new Error('Reason, ID and final are required');
40
- }
41
- if (permittedTransitions[state.status].includes('REJECTED')) {
42
- state.status = 'REJECTED';
43
- const rejection = {
44
- id: action.input.id,
45
- reason: action.input.reason,
46
- final: action.input.final,
47
- };
48
- state.rejections.push(rejection);
49
- }
50
- else {
51
- throw new Error(`Invalid transition from ${state.status} to REJECTED`);
52
- }
53
- },
54
- acceptOperation(state, action, dispatch) {
55
- if (!action.input.payAfter) {
56
- throw new Error('Pay after is required');
57
- }
58
- if (permittedTransitions[state.status].includes('ACCEPTED')) {
59
- state.status = 'ACCEPTED';
60
- state.payAfter = action.input.payAfter;
61
- }
62
- else {
63
- throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
64
- }
65
- },
66
- reinstateOperation(state, action, dispatch) {
67
- const finalRejection = state.rejections.find(rejection => rejection.final === true);
68
- if (finalRejection) {
69
- throw new Error('Cannot reinstate an invoice that has been rejected');
70
- }
71
- if (permittedTransitions[state.status].includes('ISSUED')) {
72
- state.status = 'ISSUED';
73
- }
74
- else {
75
- throw new Error(`Invalid transition from ${state.status} to ISSUED`);
76
- }
77
- },
78
- schedulePaymentOperation(state, action, dispatch) {
79
- if (!action.input.id || !action.input.processorRef) {
80
- throw new Error('ID and processorRef are required');
81
- }
82
- if (permittedTransitions[state.status].includes('PAYMENTSCHEDULED')) {
83
- state.status = 'PAYMENTSCHEDULED';
84
- state.payments.push({
85
- id: action.input.id,
86
- processorRef: action.input.processorRef,
87
- paymentDate: '',
88
- txnRef: "",
89
- confirmed: false,
90
- issue: "",
91
- amount: 0,
92
- });
93
- }
94
- else {
95
- throw new Error(`Invalid transition from ${state.status} to PAYMENTSCHEDULED`);
96
- }
97
- },
98
- reapprovePaymentOperation(state, action, dispatch) {
99
- if (permittedTransitions[state.status].includes('ACCEPTED')) {
100
- state.status = 'ACCEPTED';
101
- }
102
- else {
103
- throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
104
- }
105
- },
106
- registerPaymentTxOperation(state, action, dispatch) {
107
- if (permittedTransitions[state.status].includes('PAYMENTSENT')) {
108
- state.status = 'PAYMENTSENT';
109
- const payment = state.payments.find(payment => payment.id === action.input.id);
110
- if (!payment)
111
- throw new Error('Payment not found');
112
- payment.txnRef = action.input.txRef;
113
- payment.paymentDate = action.input.timestamp;
114
- }
115
- else {
116
- throw new Error(`Invalid transition from ${state.status} to PAYMENTSENT`);
117
- }
118
- },
119
- reportPaymentIssueOperation(state, action, dispatch) {
120
- if (!action.input.id || !action.input.issue) {
121
- throw new Error('ID and issue are required');
122
- }
123
- if (permittedTransitions[state.status].includes('PAYMENTISSUE')) {
124
- state.status = 'PAYMENTISSUE';
125
- const payment = state.payments.find(payment => payment.id === action.input.id);
126
- if (!payment)
127
- throw new Error('Payment not found');
128
- payment.issue = action.input.issue;
129
- }
130
- else {
131
- throw new Error(`Invalid transition from ${state.status} to PAYMENTISSUE`);
132
- }
133
- },
134
- confirmPaymentOperation(state, action, dispatch) {
135
- if (!action.input.id || !action.input.amount) {
136
- throw new Error('ID and amount are required');
137
- }
138
- if (permittedTransitions[state.status].includes('PAYMENTRECEIVED')) {
139
- state.status = 'PAYMENTRECEIVED';
140
- const payment = state.payments.find(payment => payment.id === action.input.id);
141
- if (!payment)
142
- throw new Error('Payment not found');
143
- payment.confirmed = true;
144
- payment.amount = action.input.amount;
145
- }
146
- else {
147
- throw new Error(`Invalid transition from ${state.status} to PAYMENTRECEIVED`);
148
- }
149
- },
150
- closePaymentOperation(state, action, dispatch) {
151
- if (!action.input.closureReason) {
152
- throw new Error('Closure reason is required');
153
- }
154
- if (permittedTransitions[state.status].includes('PAYMENTCLOSED')) {
155
- state.status = 'PAYMENTCLOSED';
156
- state.closureReason = action.input.closureReason;
157
- }
158
- else {
159
- throw new Error(`Invalid transition from ${state.status} to PAYMENTCLOSED`);
160
- }
161
- },
162
- };