@zeniai/client-epic-state 5.1.85 → 5.1.86
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/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/index.js +1 -1
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +9 -33
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +9 -35
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +5 -32
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +3 -23
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +3 -20
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +17 -60
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +10 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +5 -28
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +14 -22
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +7 -46
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +8 -26
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +9 -41
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +1 -4
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +1 -4
- package/lib/index.d.ts +3 -4
- package/lib/index.js +8 -7
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +1 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +8 -22
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +1 -2
- package/lib/view/invoicing/discountAction/discountActionEpic.js +8 -32
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +1 -2
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +8 -34
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +4 -31
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +2 -22
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +2 -19
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +1 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +16 -59
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -13
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +31 -11
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +1 -2
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +9 -28
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +4 -27
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +7 -24
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +16 -23
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +1 -2
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +6 -45
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -2
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +7 -25
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -10
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +2 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +1 -2
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +8 -40
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +2 -5
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -5
- package/package.json +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingCustomerAddresses } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload';
|
|
5
5
|
import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -46,28 +45,9 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
46
45
|
status: response.data.status,
|
|
47
46
|
}));
|
|
48
47
|
}
|
|
49
|
-
resultActions.push(openSnackbar({
|
|
50
|
-
messageSection: 'invoicing_customer_saved',
|
|
51
|
-
messageText: 'success',
|
|
52
|
-
type: 'success',
|
|
53
|
-
}));
|
|
54
48
|
return resultActions;
|
|
55
49
|
}
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
messageSection: 'invoicing_customer_saved',
|
|
60
|
-
messageText: 'failed',
|
|
61
|
-
type: 'error',
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
64
|
-
}), catchError((error) => from([
|
|
65
|
-
submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
66
|
-
JSON.stringify(error))),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_customer_saved',
|
|
69
|
-
messageText: 'failed',
|
|
70
|
-
type: 'error',
|
|
71
|
-
}),
|
|
72
|
-
])));
|
|
50
|
+
return of(submitInvoicingCustomerFormFailure(response.status));
|
|
51
|
+
}), catchError((error) => of(submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
52
|
+
JSON.stringify(error))))));
|
|
73
53
|
}));
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -39,14 +38,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
39
38
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
40
39
|
return request$.pipe(mergeMap((response) => {
|
|
41
40
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
42
|
-
return [
|
|
43
|
-
submitInvoicingSubscriptionFormFailure(response.status),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_subscription_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
];
|
|
41
|
+
return [submitInvoicingSubscriptionFormFailure(response.status)];
|
|
50
42
|
}
|
|
51
43
|
const saved = response.data;
|
|
52
44
|
const couponChanged = id != null &&
|
|
@@ -86,19 +78,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
86
78
|
status: saved.status,
|
|
87
79
|
}));
|
|
88
80
|
}
|
|
89
|
-
resultActions.push(openSnackbar({
|
|
90
|
-
messageSection: 'invoicing_subscription_saved',
|
|
91
|
-
messageText: 'success',
|
|
92
|
-
type: 'success',
|
|
93
|
-
}));
|
|
94
81
|
return resultActions;
|
|
95
|
-
}), catchError((error) =>
|
|
96
|
-
|
|
97
|
-
JSON.stringify(error))),
|
|
98
|
-
openSnackbar({
|
|
99
|
-
messageSection: 'invoicing_subscription_saved',
|
|
100
|
-
messageText: 'failed',
|
|
101
|
-
type: 'error',
|
|
102
|
-
}),
|
|
103
|
-
])));
|
|
82
|
+
}), catchError((error) => of(submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
83
|
+
JSON.stringify(error))))));
|
|
104
84
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses, } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -40,14 +39,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
40
39
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
41
40
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
42
41
|
if (!removeResult.success) {
|
|
43
|
-
return
|
|
44
|
-
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
-
openSnackbar({
|
|
46
|
-
messageSection: 'invoicing_subscription_saved',
|
|
47
|
-
messageText: 'failed',
|
|
48
|
-
type: 'error',
|
|
49
|
-
}),
|
|
50
|
-
]);
|
|
42
|
+
return of(submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)));
|
|
51
43
|
}
|
|
52
44
|
const applyStep$ = next === ''
|
|
53
45
|
? of({
|
|
@@ -59,11 +51,6 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
59
51
|
if (!applyResult.success) {
|
|
60
52
|
return [
|
|
61
53
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
-
openSnackbar({
|
|
63
|
-
messageSection: 'invoicing_subscription_saved',
|
|
64
|
-
messageText: 'failed',
|
|
65
|
-
type: 'error',
|
|
66
|
-
}),
|
|
67
54
|
];
|
|
68
55
|
}
|
|
69
56
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -71,11 +58,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
71
58
|
if (couponUpdated != null) {
|
|
72
59
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
73
60
|
}
|
|
74
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
75
|
-
messageSection: 'invoicing_subscription_saved',
|
|
76
|
-
messageText: 'success',
|
|
77
|
-
type: 'success',
|
|
78
|
-
}));
|
|
61
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
|
|
79
62
|
return resultActions;
|
|
80
63
|
}));
|
|
81
64
|
}));
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
|
|
5
5
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice, } from './invoiceActionReducer';
|
|
9
|
-
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
10
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
11
|
-
regenerate: 'invoicing_invoice_regenerated',
|
|
12
|
-
'send-reminder': 'invoicing_invoice_reminder_sent',
|
|
13
|
-
void: 'invoicing_invoice_voided',
|
|
14
|
-
};
|
|
15
8
|
export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => runInvoicingInvoiceAction.match(action) &&
|
|
16
9
|
action.payload.action !== 'issue-credit-note'), mergeMap((action) => {
|
|
17
10
|
const { action: kind, body, invoiceId } = action.payload;
|
|
18
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
19
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
20
|
-
? []
|
|
21
|
-
: [
|
|
22
|
-
openSnackbar({
|
|
23
|
-
messageSection: snackbarSection,
|
|
24
|
-
messageText,
|
|
25
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
26
|
-
}),
|
|
27
|
-
];
|
|
28
11
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
29
12
|
return zeniAPI
|
|
30
13
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -34,24 +17,17 @@ export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
34
17
|
updateInvoices([response.data], 'merge'),
|
|
35
18
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
36
19
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
37
|
-
...snackbar('success'),
|
|
38
20
|
];
|
|
39
21
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
error: response.status,
|
|
43
|
-
invoiceId,
|
|
44
|
-
}),
|
|
45
|
-
...snackbar('failed'),
|
|
46
|
-
]);
|
|
47
|
-
}), catchError((error) => from([
|
|
48
|
-
runInvoicingInvoiceActionFailure({
|
|
49
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error)),
|
|
22
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
23
|
+
error: response.status,
|
|
51
24
|
invoiceId,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
}));
|
|
26
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
27
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
invoiceId,
|
|
30
|
+
}))));
|
|
55
31
|
}));
|
|
56
32
|
export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateInvoicingInvoice.match), mergeMap((action) => {
|
|
57
33
|
const { data, invoiceId } = action.payload;
|
|
@@ -64,34 +40,15 @@ export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => action
|
|
|
64
40
|
updateInvoices([response.data], 'merge'),
|
|
65
41
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
66
42
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_invoice_saved',
|
|
69
|
-
messageText: 'success',
|
|
70
|
-
type: 'success',
|
|
71
|
-
}),
|
|
72
43
|
];
|
|
73
44
|
}
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
error: response.status,
|
|
77
|
-
invoiceId,
|
|
78
|
-
}),
|
|
79
|
-
openSnackbar({
|
|
80
|
-
messageSection: 'invoicing_invoice_saved',
|
|
81
|
-
messageText: 'failed',
|
|
82
|
-
type: 'error',
|
|
83
|
-
}),
|
|
84
|
-
]);
|
|
85
|
-
}), catchError((error) => from([
|
|
86
|
-
runInvoicingInvoiceActionFailure({
|
|
87
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
88
|
-
JSON.stringify(error)),
|
|
45
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
46
|
+
error: response.status,
|
|
89
47
|
invoiceId,
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
])));
|
|
48
|
+
}));
|
|
49
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
50
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
51
|
+
JSON.stringify(error)),
|
|
52
|
+
invoiceId,
|
|
53
|
+
}))));
|
|
97
54
|
}));
|
|
@@ -8,20 +8,7 @@ export const initialState = {
|
|
|
8
8
|
auditLogEntityRouteOptions: [],
|
|
9
9
|
auditLogListSortFieldOptions: [],
|
|
10
10
|
auditLogSourceLabels: [],
|
|
11
|
-
autoCollectionOptions: [],
|
|
12
|
-
billingPeriodUnitOptions: [],
|
|
13
|
-
catalogTrialEndActionOptions: [],
|
|
14
|
-
catalogTrialUnitOptions: [],
|
|
15
|
-
customerTypeOptions: [],
|
|
16
|
-
dateFormatOptions: [],
|
|
17
|
-
discountApplyOnOptions: [],
|
|
18
|
-
discountDurationTypeOptions: [],
|
|
19
|
-
discountTypeOptions: [],
|
|
20
11
|
dunningScheduleActionOptions: [],
|
|
21
|
-
manualPaymentMethodOptions: [],
|
|
22
|
-
netTermDayOptions: [],
|
|
23
|
-
paymentGatewayOptions: [],
|
|
24
|
-
taxabilityOptions: [],
|
|
25
12
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
26
13
|
subscriptionLifecycleActionOptions: [],
|
|
27
14
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -42,8 +29,6 @@ export const initialState = {
|
|
|
42
29
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
43
30
|
invoicingTosAcceptanceUserId: undefined,
|
|
44
31
|
isInvoicingSettingsSeeded: undefined,
|
|
45
|
-
createdAt: undefined,
|
|
46
|
-
updatedAt: undefined,
|
|
47
32
|
hasValidState() {
|
|
48
33
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
49
34
|
},
|
|
@@ -59,21 +44,6 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
59
44
|
code: option.code,
|
|
60
45
|
name: option.name,
|
|
61
46
|
})),
|
|
62
|
-
autoCollectionOptions: (payload.auto_collection_options ?? []).map(toInvoicingNamedOption),
|
|
63
|
-
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(toInvoicingNamedOption),
|
|
64
|
-
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(toInvoicingNamedOption),
|
|
65
|
-
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(toInvoicingNamedOption),
|
|
66
|
-
customerTypeOptions: (payload.customer_type_options ?? []).map(toInvoicingNamedOption),
|
|
67
|
-
dateFormatOptions: (payload.date_format_options ?? []).map(toInvoicingNamedOption),
|
|
68
|
-
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(toInvoicingNamedOption),
|
|
69
|
-
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(toInvoicingNamedOption),
|
|
70
|
-
discountTypeOptions: (payload.discount_type_options ?? []).map(toInvoicingNamedOption),
|
|
71
|
-
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(toInvoicingNamedOption),
|
|
72
|
-
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
73
|
-
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
74
|
-
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
75
|
-
createdAt: payload.created_at ?? undefined,
|
|
76
|
-
updatedAt: payload.updated_at ?? undefined,
|
|
77
47
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
78
48
|
code: toInvoicingDunningAction(option.code),
|
|
79
49
|
name: option.name,
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { deriveInvoicingOnboardingStatus, } from './invoicingConfigViewPayload';
|
|
2
|
+
/**
|
|
3
|
+
* Single bundled view for the invoicing config — consumers read only this.
|
|
4
|
+
* Carries the config flags, the derived onboarding `status` used for route
|
|
5
|
+
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
6
|
+
* enable action fetch states.
|
|
7
|
+
*/
|
|
2
8
|
export const getInvoicingConfigView = (state) => {
|
|
3
|
-
const
|
|
9
|
+
const configState = state.invoicingConfigViewState;
|
|
4
10
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
acceptTermsState: configState.acceptTermsFetchState,
|
|
12
|
+
auditLogEntityRouteOptions: configState.auditLogEntityRouteOptions,
|
|
13
|
+
auditLogListSortFieldOptions: configState.auditLogListSortFieldOptions,
|
|
14
|
+
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
15
|
+
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
16
|
+
enableState: configState.enableFetchState,
|
|
17
|
+
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
18
|
+
subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
|
|
19
|
+
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
20
|
+
subscriptionEditFieldOptions: configState.subscriptionEditFieldOptions,
|
|
21
|
+
subscriptionCancelTimingOptions: configState.subscriptionCancelTimingOptions,
|
|
22
|
+
subscriptionChangeOptionOptions: configState.subscriptionChangeOptionOptions,
|
|
23
|
+
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
24
|
+
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
25
|
+
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
26
|
+
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
27
|
+
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
28
|
+
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
29
|
+
error: configState.error,
|
|
30
|
+
fetchState: configState.fetchState,
|
|
31
|
+
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
32
|
+
isInvoicingTosAccepted: configState.isInvoicingTosAccepted,
|
|
8
33
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
9
34
|
};
|
|
10
35
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
4
|
import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
|
|
6
5
|
export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
|
|
@@ -13,33 +12,15 @@ export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => act
|
|
|
13
12
|
return of(retryInvoicingQboSyncTaskSuccess({
|
|
14
13
|
status: response.data?.status ?? '',
|
|
15
14
|
taskId: response.data?.task_id ?? taskId,
|
|
16
|
-
}), fetchInvoicingQboSyncHealth()
|
|
17
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
18
|
-
messageText: 'success',
|
|
19
|
-
type: 'success',
|
|
20
|
-
}));
|
|
15
|
+
}), fetchInvoicingQboSyncHealth());
|
|
21
16
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
status: response.status,
|
|
25
|
-
taskId,
|
|
26
|
-
}),
|
|
27
|
-
openSnackbar({
|
|
28
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
29
|
-
messageText: 'failed',
|
|
30
|
-
type: 'error',
|
|
31
|
-
}),
|
|
32
|
-
]);
|
|
33
|
-
}), catchError((error) => from([
|
|
34
|
-
retryInvoicingQboSyncTaskFailure({
|
|
35
|
-
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
36
|
-
JSON.stringify(error)),
|
|
17
|
+
return of(retryInvoicingQboSyncTaskFailure({
|
|
18
|
+
status: response.status,
|
|
37
19
|
taskId,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
])));
|
|
20
|
+
}));
|
|
21
|
+
}), catchError((error) => of(retryInvoicingQboSyncTaskFailure({
|
|
22
|
+
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
23
|
+
JSON.stringify(error)),
|
|
24
|
+
taskId,
|
|
25
|
+
}))));
|
|
45
26
|
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
4
|
import { fetchInvoicingQboSyncHealth, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, } from '../invoicingQboViewReducer';
|
|
6
5
|
export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startInvoicingQboBackfill.match), switchMap((action) => {
|
|
@@ -11,31 +10,9 @@ export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => act
|
|
|
11
10
|
})
|
|
12
11
|
.pipe(mergeMap((response) => {
|
|
13
12
|
if (isSuccessResponse(response)) {
|
|
14
|
-
return
|
|
15
|
-
startInvoicingQboBackfillSuccess(),
|
|
16
|
-
fetchInvoicingQboSyncHealth(),
|
|
17
|
-
openSnackbar({
|
|
18
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
19
|
-
messageText: 'success',
|
|
20
|
-
type: 'success',
|
|
21
|
-
}),
|
|
22
|
-
]);
|
|
13
|
+
return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth());
|
|
23
14
|
}
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
28
|
-
messageText: 'failed',
|
|
29
|
-
type: 'error',
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
}), catchError((error) => from([
|
|
33
|
-
startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
34
|
-
JSON.stringify(error))),
|
|
35
|
-
openSnackbar({
|
|
36
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
37
|
-
messageText: 'failed',
|
|
38
|
-
type: 'error',
|
|
39
|
-
}),
|
|
40
|
-
])));
|
|
15
|
+
return of(startInvoicingQboBackfillFailure(response.status));
|
|
16
|
+
}), catchError((error) => of(startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
17
|
+
JSON.stringify(error))))));
|
|
41
18
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
6
|
import { localDataToIssueCreditNotePayload, } from './issueCreditNotePayload';
|
|
@@ -19,28 +18,9 @@ export const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
19
18
|
updateInvoicingCreditNotes([response.data], 'merge'),
|
|
20
19
|
fetchInvoiceDetail({ invoiceId }),
|
|
21
20
|
issueCreditNoteSuccess({ creditNoteId: response.data.id }),
|
|
22
|
-
openSnackbar({
|
|
23
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
24
|
-
messageText: 'success',
|
|
25
|
-
type: 'success',
|
|
26
|
-
}),
|
|
27
21
|
];
|
|
28
22
|
}
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
33
|
-
messageText: 'failed',
|
|
34
|
-
type: 'error',
|
|
35
|
-
}),
|
|
36
|
-
]);
|
|
37
|
-
}), catchError((error) => from([
|
|
38
|
-
issueCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
39
|
-
JSON.stringify(error))),
|
|
40
|
-
openSnackbar({
|
|
41
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
42
|
-
messageText: 'failed',
|
|
43
|
-
type: 'error',
|
|
44
|
-
}),
|
|
45
|
-
])));
|
|
23
|
+
return of(issueCreditNoteFailure(response.status));
|
|
24
|
+
}), catchError((error) => of(issueCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
25
|
+
JSON.stringify(error))))));
|
|
46
26
|
}));
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
5
|
-
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
6
|
-
* that would render that stale draft next to this invoice is dropped until the
|
|
7
|
-
* screen re-seeds it for `invoiceId`.
|
|
8
|
-
*/
|
|
9
|
-
export const getIssueCreditNoteView = (state, invoiceId) => {
|
|
10
|
-
const invoiceView = getInvoiceDetail(state, invoiceId);
|
|
11
|
-
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
12
|
-
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
1
|
+
import { INVOICING_CREDIT_NOTE_REASON_CODES } from './issueCreditNoteFormConfig';
|
|
2
|
+
export const getIssueCreditNoteView = (state) => {
|
|
3
|
+
const { error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
13
4
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isDraftForInvoice &&
|
|
17
|
-
draft.lineItems.length > 0,
|
|
5
|
+
error,
|
|
6
|
+
fetchState,
|
|
18
7
|
issuedCreditNoteId,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
version: 1.0,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export const getIssueCreditNoteFormView = (state) => {
|
|
12
|
+
const { draft, error, fetchState } = state.invoicingIssueCreditNoteState;
|
|
13
|
+
return {
|
|
14
|
+
localData: draft,
|
|
22
15
|
reasonCodeValues: [...INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
fetchState: invoiceView.fetchState,
|
|
16
|
+
error,
|
|
17
|
+
fetchState,
|
|
26
18
|
version: 1.0,
|
|
27
19
|
};
|
|
28
20
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
4
4
|
import { updateInvoicingTransactions } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
6
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
8
7
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
@@ -27,30 +26,11 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
27
26
|
updateInvoices([response.data], 'merge'),
|
|
28
27
|
fetchInvoiceDetail({ invoiceId }),
|
|
29
28
|
recordPaymentSuccess({ invoiceId }),
|
|
30
|
-
openSnackbar({
|
|
31
|
-
messageSection: 'invoicing_payment_recorded',
|
|
32
|
-
messageText: 'success',
|
|
33
|
-
type: 'success',
|
|
34
|
-
}),
|
|
35
29
|
];
|
|
36
30
|
}
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
messageSection: 'invoicing_payment_recorded',
|
|
41
|
-
messageText: 'failed',
|
|
42
|
-
type: 'error',
|
|
43
|
-
}),
|
|
44
|
-
]);
|
|
45
|
-
}), catchError((error) => from([
|
|
46
|
-
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
47
|
-
JSON.stringify(error))),
|
|
48
|
-
openSnackbar({
|
|
49
|
-
messageSection: 'invoicing_payment_recorded',
|
|
50
|
-
messageText: 'failed',
|
|
51
|
-
type: 'error',
|
|
52
|
-
}),
|
|
53
|
-
])));
|
|
31
|
+
return of(recordPaymentFailure(response.status));
|
|
32
|
+
}), catchError((error) => of(recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
33
|
+
JSON.stringify(error))))));
|
|
54
34
|
}
|
|
55
35
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
56
36
|
const data = localDataToRecordPaymentPayload(draft);
|
|
@@ -69,28 +49,9 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
69
49
|
if (linkedInvoiceId != null) {
|
|
70
50
|
successActions.push(fetchInvoiceDetail({ invoiceId: linkedInvoiceId }));
|
|
71
51
|
}
|
|
72
|
-
successActions.push(openSnackbar({
|
|
73
|
-
messageSection: 'invoicing_payment_recorded',
|
|
74
|
-
messageText: 'success',
|
|
75
|
-
type: 'success',
|
|
76
|
-
}));
|
|
77
52
|
return successActions;
|
|
78
53
|
}
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
messageSection: 'invoicing_payment_recorded',
|
|
83
|
-
messageText: 'failed',
|
|
84
|
-
type: 'error',
|
|
85
|
-
}),
|
|
86
|
-
]);
|
|
87
|
-
}), catchError((error) => from([
|
|
88
|
-
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
89
|
-
JSON.stringify(error))),
|
|
90
|
-
openSnackbar({
|
|
91
|
-
messageSection: 'invoicing_payment_recorded',
|
|
92
|
-
messageText: 'failed',
|
|
93
|
-
type: 'error',
|
|
94
|
-
}),
|
|
95
|
-
])));
|
|
54
|
+
return of(recordPaymentFailure(response.status));
|
|
55
|
+
}), catchError((error) => of(recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
56
|
+
JSON.stringify(error))))));
|
|
96
57
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection, } from './settingsViewReducer';
|
|
7
6
|
export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingSettings.match), switchMap(() => {
|
|
@@ -58,32 +57,15 @@ export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => act
|
|
|
58
57
|
}));
|
|
59
58
|
export const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingSettings.match), mergeMap((action) => {
|
|
60
59
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
61
|
-
const { settings, snackbarSection } = action.payload;
|
|
62
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
63
|
-
? []
|
|
64
|
-
: [
|
|
65
|
-
openSnackbar({
|
|
66
|
-
messageSection: snackbarSection,
|
|
67
|
-
messageText,
|
|
68
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
69
|
-
}),
|
|
70
|
-
];
|
|
71
60
|
return zeniAPI
|
|
72
|
-
.putAndGetJSON(apiUrl, {
|
|
61
|
+
.putAndGetJSON(apiUrl, {
|
|
62
|
+
...action.payload,
|
|
63
|
+
})
|
|
73
64
|
.pipe(switchMap((response) => {
|
|
74
65
|
if (isSuccessResponse(response) && response.data != null) {
|
|
75
|
-
return
|
|
76
|
-
saveInvoicingSettingsSuccess(response.data),
|
|
77
|
-
...snackbar('success'),
|
|
78
|
-
]);
|
|
66
|
+
return of(saveInvoicingSettingsSuccess(response.data));
|
|
79
67
|
}
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
]);
|
|
84
|
-
}), catchError((error) => from([
|
|
85
|
-
saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
86
|
-
JSON.stringify(error))),
|
|
87
|
-
...snackbar('failed'),
|
|
88
|
-
])));
|
|
68
|
+
return of(saveInvoicingSettingsFailure(response.status));
|
|
69
|
+
}), catchError((error) => of(saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
70
|
+
JSON.stringify(error))))));
|
|
89
71
|
}));
|