@zeniai/client-epic-state 5.1.81-betaAK1 → 5.1.81-betaAK3
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/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +24 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +23 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { localDataToCreateCreditNotePayload, } from './createCreditNotePayload';
|
|
6
7
|
import { createCreditNoteFailure, createCreditNoteSuccess, submitCreateCreditNote, } from './createCreditNoteReducer';
|
|
@@ -15,9 +16,28 @@ export const createCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
15
16
|
return [
|
|
16
17
|
updateInvoicingCreditNotes([response.data], 'merge'),
|
|
17
18
|
createCreditNoteSuccess({ creditNoteId: response.data.id }),
|
|
19
|
+
openSnackbar({
|
|
20
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
21
|
+
messageText: 'success',
|
|
22
|
+
type: 'success',
|
|
23
|
+
}),
|
|
18
24
|
];
|
|
19
25
|
}
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
return from([
|
|
27
|
+
createCreditNoteFailure(response.status),
|
|
28
|
+
openSnackbar({
|
|
29
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
30
|
+
messageText: 'failed',
|
|
31
|
+
type: 'error',
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
}), catchError((error) => from([
|
|
35
|
+
createCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Create credit note REST API call errored out ' +
|
|
36
|
+
JSON.stringify(error))),
|
|
37
|
+
openSnackbar({
|
|
38
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
39
|
+
messageText: 'failed',
|
|
40
|
+
type: 'error',
|
|
41
|
+
}),
|
|
42
|
+
])));
|
|
23
43
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
import { addInvoiceToList } from '../invoiceList/invoiceListReducer';
|
|
8
9
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess, } from './createInvoiceReducer';
|
|
@@ -22,9 +23,28 @@ export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
|
|
|
22
23
|
status: response.data.status,
|
|
23
24
|
}),
|
|
24
25
|
createInvoiceSuccess({ invoiceId: response.data.id }),
|
|
26
|
+
openSnackbar({
|
|
27
|
+
messageSection: 'invoicing_invoice_saved',
|
|
28
|
+
messageText: 'success',
|
|
29
|
+
type: 'success',
|
|
30
|
+
}),
|
|
25
31
|
];
|
|
26
32
|
}
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
return from([
|
|
34
|
+
createInvoiceFailure(response.status),
|
|
35
|
+
openSnackbar({
|
|
36
|
+
messageSection: 'invoicing_invoice_saved',
|
|
37
|
+
messageText: 'failed',
|
|
38
|
+
type: 'error',
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
41
|
+
}), catchError((error) => from([
|
|
42
|
+
createInvoiceFailure(createZeniAPIStatus('Unexpected Error', 'Create invoice REST API call errored out ' +
|
|
43
|
+
JSON.stringify(error))),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'invoicing_invoice_saved',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}),
|
|
49
|
+
])));
|
|
30
50
|
}));
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { forkJoin,
|
|
1
|
+
import { forkJoin, from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { mergeInvoicingPlanSubFamily, updateInvoicingPlans, } from '../../../entity/invoicing/plan/planReducer';
|
|
4
4
|
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
7
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
7
8
|
import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
@@ -38,7 +39,14 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
38
39
|
const failedProductResponse = productResponses.find((productResponse) => !isSuccessResponse(productResponse) ||
|
|
39
40
|
productResponse.data == null);
|
|
40
41
|
if (failedProductResponse != null) {
|
|
41
|
-
return
|
|
42
|
+
return from([
|
|
43
|
+
submitInvoicingCatalogItemFormFailure(failedProductResponse.status),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
42
50
|
}
|
|
43
51
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
44
52
|
const resultActions = [
|
|
@@ -65,6 +73,11 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
65
73
|
: 'plan';
|
|
66
74
|
resultActions.push(addInvoicingCatalogItem({ id: savedItem.id, type: itemType }));
|
|
67
75
|
}
|
|
76
|
+
resultActions.push(openSnackbar({
|
|
77
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
78
|
+
messageText: 'success',
|
|
79
|
+
type: 'success',
|
|
80
|
+
}));
|
|
68
81
|
return resultActions;
|
|
69
82
|
};
|
|
70
83
|
const productUpdates = saveInvoicingCatalogItem.match(action)
|
|
@@ -75,7 +88,21 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
75
88
|
}
|
|
76
89
|
return forkJoin(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe(mergeMap(completeSave));
|
|
77
90
|
}
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
return from([
|
|
92
|
+
submitInvoicingCatalogItemFormFailure(response.status),
|
|
93
|
+
openSnackbar({
|
|
94
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
95
|
+
messageText: 'failed',
|
|
96
|
+
type: 'error',
|
|
97
|
+
}),
|
|
98
|
+
]);
|
|
99
|
+
}), catchError((error) => from([
|
|
100
|
+
submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
101
|
+
JSON.stringify(error))),
|
|
102
|
+
openSnackbar({
|
|
103
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
104
|
+
messageText: 'failed',
|
|
105
|
+
type: 'error',
|
|
106
|
+
}),
|
|
107
|
+
])));
|
|
81
108
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
6
7
|
import { localDataToSaveInvoicingCouponPayload, } from './editInvoicingCouponDetailViewPayload';
|
|
@@ -43,8 +44,27 @@ export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
43
44
|
status: couponPayload.status,
|
|
44
45
|
}));
|
|
45
46
|
}
|
|
47
|
+
resultActions.push(openSnackbar({
|
|
48
|
+
messageSection: 'invoicing_coupon_saved',
|
|
49
|
+
messageText: 'success',
|
|
50
|
+
type: 'success',
|
|
51
|
+
}));
|
|
46
52
|
return resultActions;
|
|
47
53
|
}
|
|
48
|
-
return
|
|
49
|
-
|
|
54
|
+
return from([
|
|
55
|
+
submitInvoicingCouponFormFailure(response.status),
|
|
56
|
+
openSnackbar({
|
|
57
|
+
messageSection: 'invoicing_coupon_saved',
|
|
58
|
+
messageText: 'failed',
|
|
59
|
+
type: 'error',
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
}), catchError((error) => from([
|
|
63
|
+
submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))),
|
|
64
|
+
openSnackbar({
|
|
65
|
+
messageSection: 'invoicing_coupon_saved',
|
|
66
|
+
messageText: 'failed',
|
|
67
|
+
type: 'error',
|
|
68
|
+
}),
|
|
69
|
+
])));
|
|
50
70
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -45,9 +46,28 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
45
46
|
status: response.data.status,
|
|
46
47
|
}));
|
|
47
48
|
}
|
|
49
|
+
resultActions.push(openSnackbar({
|
|
50
|
+
messageSection: 'invoicing_customer_saved',
|
|
51
|
+
messageText: 'success',
|
|
52
|
+
type: 'success',
|
|
53
|
+
}));
|
|
48
54
|
return resultActions;
|
|
49
55
|
}
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
return from([
|
|
57
|
+
submitInvoicingCustomerFormFailure(response.status),
|
|
58
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
53
73
|
}));
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -38,7 +39,14 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
38
39
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
39
40
|
return request$.pipe(mergeMap((response) => {
|
|
40
41
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
41
|
-
return [
|
|
42
|
+
return [
|
|
43
|
+
submitInvoicingSubscriptionFormFailure(response.status),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'invoicing_subscription_saved',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}),
|
|
49
|
+
];
|
|
42
50
|
}
|
|
43
51
|
const saved = response.data;
|
|
44
52
|
const couponChanged = id != null &&
|
|
@@ -78,7 +86,19 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
78
86
|
status: saved.status,
|
|
79
87
|
}));
|
|
80
88
|
}
|
|
89
|
+
resultActions.push(openSnackbar({
|
|
90
|
+
messageSection: 'invoicing_subscription_saved',
|
|
91
|
+
messageText: 'success',
|
|
92
|
+
type: 'success',
|
|
93
|
+
}));
|
|
81
94
|
return resultActions;
|
|
82
|
-
}), catchError((error) =>
|
|
83
|
-
|
|
95
|
+
}), catchError((error) => from([
|
|
96
|
+
submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
97
|
+
JSON.stringify(error))),
|
|
98
|
+
openSnackbar({
|
|
99
|
+
messageSection: 'invoicing_subscription_saved',
|
|
100
|
+
messageText: 'failed',
|
|
101
|
+
type: 'error',
|
|
102
|
+
}),
|
|
103
|
+
])));
|
|
84
104
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
1
|
+
import { EMPTY, from, 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -39,7 +40,14 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
39
40
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
40
41
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
41
42
|
if (!removeResult.success) {
|
|
42
|
-
return
|
|
43
|
+
return from([
|
|
44
|
+
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
+
openSnackbar({
|
|
46
|
+
messageSection: 'invoicing_subscription_saved',
|
|
47
|
+
messageText: 'failed',
|
|
48
|
+
type: 'error',
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
43
51
|
}
|
|
44
52
|
const applyStep$ = next === ''
|
|
45
53
|
? of({
|
|
@@ -51,6 +59,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
51
59
|
if (!applyResult.success) {
|
|
52
60
|
return [
|
|
53
61
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
+
openSnackbar({
|
|
63
|
+
messageSection: 'invoicing_subscription_saved',
|
|
64
|
+
messageText: 'failed',
|
|
65
|
+
type: 'error',
|
|
66
|
+
}),
|
|
54
67
|
];
|
|
55
68
|
}
|
|
56
69
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -58,7 +71,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
58
71
|
if (couponUpdated != null) {
|
|
59
72
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
60
73
|
}
|
|
61
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
74
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE), openSnackbar({
|
|
75
|
+
messageSection: 'invoicing_subscription_saved',
|
|
76
|
+
messageText: 'success',
|
|
77
|
+
type: 'success',
|
|
78
|
+
}));
|
|
62
79
|
return resultActions;
|
|
63
80
|
}));
|
|
64
81
|
}));
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
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
|
+
};
|
|
8
15
|
export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => runInvoicingInvoiceAction.match(action) &&
|
|
9
16
|
action.payload.action !== 'issue-credit-note'), mergeMap((action) => {
|
|
10
17
|
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
|
+
];
|
|
11
28
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
12
29
|
return zeniAPI
|
|
13
30
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -17,17 +34,24 @@ export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
17
34
|
updateInvoices([response.data], 'merge'),
|
|
18
35
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
19
36
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
37
|
+
...snackbar('success'),
|
|
20
38
|
];
|
|
21
39
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
40
|
+
return from([
|
|
41
|
+
runInvoicingInvoiceActionFailure({
|
|
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)),
|
|
24
51
|
invoiceId,
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSON.stringify(error)),
|
|
29
|
-
invoiceId,
|
|
30
|
-
}))));
|
|
52
|
+
}),
|
|
53
|
+
...snackbar('failed'),
|
|
54
|
+
])));
|
|
31
55
|
}));
|
|
32
56
|
export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateInvoicingInvoice.match), mergeMap((action) => {
|
|
33
57
|
const { data, invoiceId } = action.payload;
|
|
@@ -40,15 +64,34 @@ export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => action
|
|
|
40
64
|
updateInvoices([response.data], 'merge'),
|
|
41
65
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
42
66
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
67
|
+
openSnackbar({
|
|
68
|
+
messageSection: 'invoicing_invoice_saved',
|
|
69
|
+
messageText: 'success',
|
|
70
|
+
type: 'success',
|
|
71
|
+
}),
|
|
43
72
|
];
|
|
44
73
|
}
|
|
45
|
-
return
|
|
46
|
-
|
|
74
|
+
return from([
|
|
75
|
+
runInvoicingInvoiceActionFailure({
|
|
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)),
|
|
47
89
|
invoiceId,
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
90
|
+
}),
|
|
91
|
+
openSnackbar({
|
|
92
|
+
messageSection: 'invoicing_invoice_saved',
|
|
93
|
+
messageText: 'failed',
|
|
94
|
+
type: 'error',
|
|
95
|
+
}),
|
|
96
|
+
])));
|
|
54
97
|
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
1
|
+
import { from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
5
|
import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
|
|
5
6
|
export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
|
|
@@ -12,15 +13,33 @@ export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => act
|
|
|
12
13
|
return of(retryInvoicingQboSyncTaskSuccess({
|
|
13
14
|
status: response.data?.status ?? '',
|
|
14
15
|
taskId: response.data?.task_id ?? taskId,
|
|
15
|
-
}), fetchInvoicingQboSyncHealth()
|
|
16
|
+
}), fetchInvoicingQboSyncHealth(), openSnackbar({
|
|
17
|
+
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
18
|
+
messageText: 'success',
|
|
19
|
+
type: 'success',
|
|
20
|
+
}));
|
|
16
21
|
}
|
|
17
|
-
return
|
|
18
|
-
|
|
22
|
+
return from([
|
|
23
|
+
retryInvoicingQboSyncTaskFailure({
|
|
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)),
|
|
19
37
|
taskId,
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
}),
|
|
39
|
+
openSnackbar({
|
|
40
|
+
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
41
|
+
messageText: 'failed',
|
|
42
|
+
type: 'error',
|
|
43
|
+
}),
|
|
44
|
+
])));
|
|
26
45
|
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
1
|
+
import { from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
5
|
import { fetchInvoicingQboSyncHealth, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, } from '../invoicingQboViewReducer';
|
|
5
6
|
export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startInvoicingQboBackfill.match), switchMap((action) => {
|
|
@@ -10,9 +11,27 @@ export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => act
|
|
|
10
11
|
})
|
|
11
12
|
.pipe(mergeMap((response) => {
|
|
12
13
|
if (isSuccessResponse(response)) {
|
|
13
|
-
return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth()
|
|
14
|
+
return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth(), openSnackbar({
|
|
15
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
16
|
+
messageText: 'success',
|
|
17
|
+
type: 'success',
|
|
18
|
+
}));
|
|
14
19
|
}
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
return from([
|
|
21
|
+
startInvoicingQboBackfillFailure(response.status),
|
|
22
|
+
openSnackbar({
|
|
23
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
24
|
+
messageText: 'failed',
|
|
25
|
+
type: 'error',
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
}), catchError((error) => from([
|
|
29
|
+
startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
30
|
+
JSON.stringify(error))),
|
|
31
|
+
openSnackbar({
|
|
32
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
33
|
+
messageText: 'failed',
|
|
34
|
+
type: 'error',
|
|
35
|
+
}),
|
|
36
|
+
])));
|
|
18
37
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
6
7
|
import { localDataToIssueCreditNotePayload, } from './issueCreditNotePayload';
|
|
@@ -18,9 +19,28 @@ export const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
18
19
|
updateInvoicingCreditNotes([response.data], 'merge'),
|
|
19
20
|
fetchInvoiceDetail({ invoiceId }),
|
|
20
21
|
issueCreditNoteSuccess({ creditNoteId: response.data.id }),
|
|
22
|
+
openSnackbar({
|
|
23
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
24
|
+
messageText: 'success',
|
|
25
|
+
type: 'success',
|
|
26
|
+
}),
|
|
21
27
|
];
|
|
22
28
|
}
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
return from([
|
|
30
|
+
issueCreditNoteFailure(response.status),
|
|
31
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
26
46
|
}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
5
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
7
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
8
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
@@ -26,11 +27,30 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
26
27
|
updateInvoices([response.data], 'merge'),
|
|
27
28
|
fetchInvoiceDetail({ invoiceId }),
|
|
28
29
|
recordPaymentSuccess({ invoiceId }),
|
|
30
|
+
openSnackbar({
|
|
31
|
+
messageSection: 'invoicing_payment_recorded',
|
|
32
|
+
messageText: 'success',
|
|
33
|
+
type: 'success',
|
|
34
|
+
}),
|
|
29
35
|
];
|
|
30
36
|
}
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
return from([
|
|
38
|
+
recordPaymentFailure(response.status),
|
|
39
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
34
54
|
}
|
|
35
55
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
36
56
|
const data = localDataToRecordPaymentPayload(draft);
|
|
@@ -49,9 +69,28 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
49
69
|
if (linkedInvoiceId != null) {
|
|
50
70
|
successActions.push(fetchInvoiceDetail({ invoiceId: linkedInvoiceId }));
|
|
51
71
|
}
|
|
72
|
+
successActions.push(openSnackbar({
|
|
73
|
+
messageSection: 'invoicing_payment_recorded',
|
|
74
|
+
messageText: 'success',
|
|
75
|
+
type: 'success',
|
|
76
|
+
}));
|
|
52
77
|
return successActions;
|
|
53
78
|
}
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
return from([
|
|
80
|
+
recordPaymentFailure(response.status),
|
|
81
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
57
96
|
}));
|