@zeniai/client-epic-state 4.11.5 → 4.11.7
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
- package/lib/entity/tenant/clearAllEpic.js +0 -4
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/index.d.ts +2 -7
- package/lib/index.js +9 -18
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/view/companyView/selector/companyManagementViewSelector.js +11 -8
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -6
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +0 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -6
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -1
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +20 -7
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.js +2 -9
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.d.ts +0 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewState.d.ts +0 -4
- package/lib/view/subscriptionView/subscriptionViewSelector.js +3 -1
- package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +4 -1
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +21 -11
- package/package.json +1 -2
- package/lib/entity/cardPayment/cardPaymentPayload.d.ts +0 -26
- package/lib/entity/cardPayment/cardPaymentPayload.js +0 -28
- package/lib/entity/cardPayment/cardPaymentReducer.d.ts +0 -11
- package/lib/entity/cardPayment/cardPaymentReducer.js +0 -59
- package/lib/entity/cardPayment/cardPaymentSelector.d.ts +0 -6
- package/lib/entity/cardPayment/cardPaymentSelector.js +0 -27
- package/lib/entity/cardPayment/cardPaymentState.d.ts +0 -28
- package/lib/entity/cardPayment/cardPaymentState.js +0 -2
- package/lib/view/cardPayment/cardPaymentViewPayload.d.ts +0 -37
- package/lib/view/cardPayment/cardPaymentViewPayload.js +0 -2
- package/lib/view/cardPayment/cardPaymentViewReducer.d.ts +0 -32
- package/lib/view/cardPayment/cardPaymentViewReducer.js +0 -125
- package/lib/view/cardPayment/cardPaymentViewSelector.d.ts +0 -16
- package/lib/view/cardPayment/cardPaymentViewSelector.js +0 -24
- package/lib/view/cardPayment/cardPaymentViewState.d.ts +0 -19
- package/lib/view/cardPayment/cardPaymentViewState.js +0 -2
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +0 -34
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.js +0 -76
- package/lib/view/cardPayment/epic/confirmCardSetupEpic.d.ts +0 -25
- package/lib/view/cardPayment/epic/confirmCardSetupEpic.js +0 -50
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +0 -27
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.js +0 -62
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +0 -31
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.js +0 -69
|
@@ -30,10 +30,9 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
30
30
|
return zeniAPI
|
|
31
31
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${action.payload.transactionId.id}/categorize`, preparePayload(transactionState, vendorState, transactionDetailState, action.payload.transactionId, action.payload.transactionSaveUpdates))
|
|
32
32
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
33
|
-
var _a, _b
|
|
34
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
35
|
-
const transactionIdResp = (0, transactionIDPayload_1.toTransactionID)(response.data.transaction
|
|
36
|
-
);
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
35
|
+
const transactionIdResp = (0, transactionIDPayload_1.toTransactionID)(response.data.transaction);
|
|
37
36
|
const transactionDetailKeyForResponse = (0, transactionDetailState_1.getTransactionDetailKey)(transactionIdResp);
|
|
38
37
|
const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKeyForResponse, undefined);
|
|
39
38
|
const tranVendorUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.vendorUpdates;
|
|
@@ -54,22 +53,21 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
const actions = [];
|
|
57
|
-
if (
|
|
56
|
+
if (response.data.vendors != null) {
|
|
58
57
|
actions.push((0, vendorReducer_1.updateVendors)(response.data.vendors, 'merge'));
|
|
59
58
|
}
|
|
60
|
-
actions.push((0, transactionReducer_1.updateTransaction)(transactionDetailKeyForResponse,
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
-
response.data.transaction));
|
|
59
|
+
actions.push((0, transactionReducer_1.updateTransaction)(transactionDetailKeyForResponse, response.data.transaction));
|
|
63
60
|
actions.push((0, transactionDetailReducer_1.initializeTransactionDetailLocalData)({
|
|
64
61
|
transactionId: transactionIdResp,
|
|
65
|
-
vendorId: (
|
|
62
|
+
vendorId: (_b = (_a = response.data.vendors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.vendor_id,
|
|
66
63
|
}));
|
|
67
64
|
actions.push((0, transactionDetailReducer_1.updateTransactionDetailSaveStatus)(transactionIdResp, 'Completed'));
|
|
68
65
|
let callMarkTransactionAsNotMiscategorized = true;
|
|
69
66
|
// NOTE: If tran is vendorType transaction and there is no vendor chosen on this tranaction while saving,
|
|
70
67
|
// then we need to skip mark-miscategorized-as-correct api call
|
|
71
|
-
if ((0, transactionType_1.toVendorTransactionTypeStrict)(
|
|
72
|
-
|
|
68
|
+
if ((0, transactionType_1.toVendorTransactionTypeStrict)(response.data.transaction.transaction_type) != null) {
|
|
69
|
+
const isAnyClassMissing = checkIfClassMissingForAnyLineItem(response.data.transaction);
|
|
70
|
+
if ((vendorUpdates === null || vendorUpdates === void 0 ? void 0 : vendorUpdates.id) == null || isAnyClassMissing == true) {
|
|
73
71
|
callMarkTransactionAsNotMiscategorized = false;
|
|
74
72
|
}
|
|
75
73
|
}
|
|
@@ -196,6 +194,18 @@ const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
|
196
194
|
return (0, transactionPayload_1.toTransactionPayload)(transaction);
|
|
197
195
|
}
|
|
198
196
|
};
|
|
197
|
+
const checkIfClassMissingForAnyLineItem = (transactionPayload) => {
|
|
198
|
+
let isAnyClassMissing = false;
|
|
199
|
+
if ((transactionPayload === null || transactionPayload === void 0 ? void 0 : transactionPayload.lines) != null) {
|
|
200
|
+
transactionPayload.lines.forEach((line) => {
|
|
201
|
+
var _a;
|
|
202
|
+
if (((_a = line.line_detail) === null || _a === void 0 ? void 0 : _a.class.accounting_class_id) == null) {
|
|
203
|
+
isAnyClassMissing = true;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return isAnyClassMissing;
|
|
208
|
+
};
|
|
199
209
|
const toEntityUpdatePayload = (entityUpdates) => {
|
|
200
210
|
const entityUpdatesPayload = [];
|
|
201
211
|
let entityKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.7",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@reduxjs/toolkit": "^1.6.2",
|
|
51
|
-
"@stripe/stripe-js": "^4.1.0",
|
|
52
51
|
"cross-fetch": "^3.1.2",
|
|
53
52
|
"date-holidays": "^3.23.8",
|
|
54
53
|
"dayjs": "^1.10.7",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CardPayment, BankAccount } from './cardPaymentState';
|
|
2
|
-
export interface CardPaymentPayload {
|
|
3
|
-
id: string;
|
|
4
|
-
status: string;
|
|
5
|
-
brand: string;
|
|
6
|
-
expiry_month: number;
|
|
7
|
-
expiry_year: number;
|
|
8
|
-
first_name: string;
|
|
9
|
-
last4: string;
|
|
10
|
-
last_name: string;
|
|
11
|
-
masked_number: string;
|
|
12
|
-
}
|
|
13
|
-
export interface BankAccountPayload {
|
|
14
|
-
id: string;
|
|
15
|
-
status: string;
|
|
16
|
-
last4: string;
|
|
17
|
-
name_on_account: string;
|
|
18
|
-
first_name: string;
|
|
19
|
-
direct_debit_scheme: string;
|
|
20
|
-
bank_name: string;
|
|
21
|
-
account_type: string;
|
|
22
|
-
account_holder_type: string;
|
|
23
|
-
email: string;
|
|
24
|
-
}
|
|
25
|
-
export declare const mapCardPaymentPayloadToCardPayment: (payload: CardPaymentPayload) => CardPayment;
|
|
26
|
-
export declare const mapBankAccountPayloadToBankAccount: (payload: BankAccountPayload) => BankAccount;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapBankAccountPayloadToBankAccount = exports.mapCardPaymentPayloadToCardPayment = void 0;
|
|
4
|
-
const mapCardPaymentPayloadToCardPayment = (payload) => ({
|
|
5
|
-
cardId: payload.id,
|
|
6
|
-
status: payload.status,
|
|
7
|
-
brand: payload.brand,
|
|
8
|
-
expiryMonth: payload.expiry_month,
|
|
9
|
-
expiryYear: payload.expiry_year,
|
|
10
|
-
firstName: payload.first_name,
|
|
11
|
-
last4: payload.last4,
|
|
12
|
-
lastName: payload.last_name,
|
|
13
|
-
maskedNumber: payload.masked_number,
|
|
14
|
-
});
|
|
15
|
-
exports.mapCardPaymentPayloadToCardPayment = mapCardPaymentPayloadToCardPayment;
|
|
16
|
-
const mapBankAccountPayloadToBankAccount = (payload) => ({
|
|
17
|
-
bankAccountId: payload.id,
|
|
18
|
-
status: payload.status,
|
|
19
|
-
last4: payload.last4,
|
|
20
|
-
nameOnAccount: payload.name_on_account,
|
|
21
|
-
firstName: payload.first_name,
|
|
22
|
-
directDebitScheme: payload.direct_debit_scheme,
|
|
23
|
-
bankName: payload.bank_name,
|
|
24
|
-
accountType: payload.account_type,
|
|
25
|
-
accountHolderType: payload.account_holder_type,
|
|
26
|
-
email: payload.email,
|
|
27
|
-
});
|
|
28
|
-
exports.mapBankAccountPayloadToBankAccount = mapBankAccountPayloadToBankAccount;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UpdateType } from '../../commonStateTypes/common';
|
|
2
|
-
import { CardPaymentPayload, BankAccountPayload } from './cardPaymentPayload';
|
|
3
|
-
import { CardPaymentState } from './cardPaymentState';
|
|
4
|
-
export declare const initialState: CardPaymentState;
|
|
5
|
-
export declare const updateCardPayments: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cardPayments: CardPaymentPayload[], updateType?: UpdateType | undefined], CardPaymentPayload[], string, never, {
|
|
6
|
-
updateType: UpdateType;
|
|
7
|
-
}>, removeCardPayment: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, updateBankAccountsPaymentSources: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cardPayments: BankAccountPayload[], updateType?: UpdateType | undefined], BankAccountPayload[], string, never, {
|
|
8
|
-
updateType: UpdateType;
|
|
9
|
-
}>, clearAllCardPayments: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
10
|
-
declare const _default: import("@reduxjs/toolkit").Reducer<CardPaymentState, import("@reduxjs/toolkit").AnyAction>;
|
|
11
|
-
export default _default;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAllCardPayments = exports.updateBankAccountsPaymentSources = exports.removeCardPayment = exports.updateCardPayments = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const cardPaymentPayload_1 = require("./cardPaymentPayload");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
cardByID: {},
|
|
9
|
-
bankAccountByID: {},
|
|
10
|
-
};
|
|
11
|
-
const cardPayment = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'cardPayment',
|
|
13
|
-
initialState: exports.initialState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateCardPayments: {
|
|
16
|
-
reducer(draft, action) {
|
|
17
|
-
action.payload.forEach((cardPaymentPayload) => {
|
|
18
|
-
const latestCardPayment = (0, cardPaymentPayload_1.mapCardPaymentPayloadToCardPayment)(cardPaymentPayload);
|
|
19
|
-
if (action.meta.updateType === 'merge') {
|
|
20
|
-
draft.cardByID[latestCardPayment.cardId] = latestCardPayment;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
prepare(cardPayments, updateType = 'merge') {
|
|
25
|
-
return {
|
|
26
|
-
payload: cardPayments,
|
|
27
|
-
meta: { updateType },
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
removeCardPayment(draft, action) {
|
|
32
|
-
delete draft.cardByID[action.payload];
|
|
33
|
-
},
|
|
34
|
-
//TODO: bank account related actions
|
|
35
|
-
updateBankAccountsPaymentSources: {
|
|
36
|
-
reducer(draft, action) {
|
|
37
|
-
action.payload.forEach((bankAccountPayload) => {
|
|
38
|
-
const latestBankAccount = (0, cardPaymentPayload_1.mapBankAccountPayloadToBankAccount)(bankAccountPayload);
|
|
39
|
-
if (action.meta.updateType === 'merge') {
|
|
40
|
-
draft.bankAccountByID[latestBankAccount.bankAccountId] =
|
|
41
|
-
latestBankAccount;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
prepare(cardPayments, updateType = 'merge') {
|
|
46
|
-
return {
|
|
47
|
-
payload: cardPayments,
|
|
48
|
-
meta: { updateType },
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
clearAllCardPayments(draft) {
|
|
53
|
-
draft.cardByID = {};
|
|
54
|
-
draft.bankAccountByID = {};
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
_a = cardPayment.actions, exports.updateCardPayments = _a.updateCardPayments, exports.removeCardPayment = _a.removeCardPayment, exports.updateBankAccountsPaymentSources = _a.updateBankAccountsPaymentSources, exports.clearAllCardPayments = _a.clearAllCardPayments;
|
|
59
|
-
exports.default = cardPayment.reducer;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { CardPaymentState, CardPayment } from './cardPaymentState';
|
|
3
|
-
export declare function getCardById(cardState: CardPaymentState, cardId: ID): CardPayment | undefined;
|
|
4
|
-
export declare function getCardsByIds(cardState: CardPaymentState, cardIds: ID[]): CardPayment[];
|
|
5
|
-
export declare function getBankAccountById(cardState: CardPaymentState, bankAccountId: ID): import("./cardPaymentState").BankAccount;
|
|
6
|
-
export declare function getBankAccountsByIds(cardState: CardPaymentState, bankAccountIds: ID[]): import("./cardPaymentState").BankAccount[];
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBankAccountsByIds = exports.getBankAccountById = exports.getCardsByIds = exports.getCardById = void 0;
|
|
7
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
-
function getCardById(cardState, cardId) {
|
|
9
|
-
return (0, get_1.default)(cardState.cardByID, cardId);
|
|
10
|
-
}
|
|
11
|
-
exports.getCardById = getCardById;
|
|
12
|
-
function getCardsByIds(cardState, cardIds) {
|
|
13
|
-
return cardIds
|
|
14
|
-
.map((cardId) => getCardById(cardState, cardId))
|
|
15
|
-
.filter((value) => value != null);
|
|
16
|
-
}
|
|
17
|
-
exports.getCardsByIds = getCardsByIds;
|
|
18
|
-
function getBankAccountById(cardState, bankAccountId) {
|
|
19
|
-
return (0, get_1.default)(cardState.bankAccountByID, bankAccountId);
|
|
20
|
-
}
|
|
21
|
-
exports.getBankAccountById = getBankAccountById;
|
|
22
|
-
function getBankAccountsByIds(cardState, bankAccountIds) {
|
|
23
|
-
return bankAccountIds
|
|
24
|
-
.map((bankAccountId) => getBankAccountById(cardState, bankAccountId))
|
|
25
|
-
.filter((value) => value != null);
|
|
26
|
-
}
|
|
27
|
-
exports.getBankAccountsByIds = getBankAccountsByIds;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
export interface CardPayment {
|
|
3
|
-
cardId: string;
|
|
4
|
-
status: string;
|
|
5
|
-
brand: string;
|
|
6
|
-
expiryMonth: number;
|
|
7
|
-
expiryYear: number;
|
|
8
|
-
firstName: string;
|
|
9
|
-
last4: string;
|
|
10
|
-
lastName: string;
|
|
11
|
-
maskedNumber: string;
|
|
12
|
-
}
|
|
13
|
-
export interface BankAccount {
|
|
14
|
-
bankAccountId: string;
|
|
15
|
-
status: string;
|
|
16
|
-
last4: string;
|
|
17
|
-
nameOnAccount: string;
|
|
18
|
-
firstName: string;
|
|
19
|
-
directDebitScheme: string;
|
|
20
|
-
bankName: string;
|
|
21
|
-
accountType: string;
|
|
22
|
-
accountHolderType: string;
|
|
23
|
-
email: string;
|
|
24
|
-
}
|
|
25
|
-
export interface CardPaymentState {
|
|
26
|
-
cardByID: Record<ID, CardPayment>;
|
|
27
|
-
bankAccountByID: Record<ID, BankAccount>;
|
|
28
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { CardPaymentPayload, BankAccountPayload } from '../../entity/cardPayment/cardPaymentPayload';
|
|
2
|
-
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
|
-
import { SetupIntentData } from './cardPaymentViewState';
|
|
4
|
-
export declare type DeleteCardPaymentResponse = ZeniAPIResponse<FetchCardSetupIntentPayload>;
|
|
5
|
-
export interface FetchCardSetupIntentPayload {
|
|
6
|
-
client_secret: string;
|
|
7
|
-
id: string;
|
|
8
|
-
}
|
|
9
|
-
export interface FetchConfirmCardSetupError {
|
|
10
|
-
code: string;
|
|
11
|
-
message: string;
|
|
12
|
-
param: string;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
export interface FetchConfirmCardSetupResponse {
|
|
16
|
-
setupIntent?: SetupIntentData;
|
|
17
|
-
error?: FetchConfirmCardSetupError;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
20
|
-
export interface ConfirmSetupIntentPayload {
|
|
21
|
-
payment_method_types: string[];
|
|
22
|
-
}
|
|
23
|
-
export declare type FetchCardSetupIntentResponse = ZeniAPIResponse<FetchCardSetupIntentPayload>;
|
|
24
|
-
export interface AddCardPaymentSourcePayload {
|
|
25
|
-
type: string;
|
|
26
|
-
processor_token: string;
|
|
27
|
-
payment_source_type: string;
|
|
28
|
-
}
|
|
29
|
-
export interface CardsOrBanksType {
|
|
30
|
-
cards?: CardPaymentPayload[];
|
|
31
|
-
bank_accounts?: BankAccountPayload[];
|
|
32
|
-
}
|
|
33
|
-
export interface AddCardPaymentSourceResponse {
|
|
34
|
-
companies: unknown[];
|
|
35
|
-
payment_sources: CardsOrBanksType;
|
|
36
|
-
}
|
|
37
|
-
export declare type FetchAddCardPaymentSourceResponse = ZeniAPIResponse<AddCardPaymentSourceResponse>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { CardPaymentViewState, SetupIntentData } from './cardPaymentViewState';
|
|
2
|
-
import { FetchState } from '../../commonStateTypes/common';
|
|
3
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
-
import { AddCardPaymentSourceResponse, CardsOrBanksType } from './cardPaymentViewPayload';
|
|
5
|
-
export declare const initialState: CardPaymentViewState;
|
|
6
|
-
export declare const createCardSetupIntent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentsMethod: string[]], {
|
|
7
|
-
paymentsMethod: string[];
|
|
8
|
-
}, string, never, never>, updateCardSetupIntentStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
-
fetchState: FetchState;
|
|
10
|
-
clientSecret: string;
|
|
11
|
-
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
12
|
-
}, string>, confirmCardSetupIntent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[setupIntentData: any], {
|
|
13
|
-
setupIntentData: any;
|
|
14
|
-
}, string, never, never>, updateConfirmCardSetupIntentStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
15
|
-
fetchState: FetchState;
|
|
16
|
-
setupIntentData?: SetupIntentData | undefined;
|
|
17
|
-
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
18
|
-
}, string>, addCardPaymentSource: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[type: "card" | "direct_debit", paymentSourceType: string, setupIntentId: string], {
|
|
19
|
-
type: "card" | "direct_debit";
|
|
20
|
-
paymentSourceType: string;
|
|
21
|
-
setupIntentId: string;
|
|
22
|
-
}, string, never, never>, updateAddCardPaymentSourceStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
23
|
-
fetchState: FetchState;
|
|
24
|
-
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
25
|
-
payment_sources?: CardsOrBanksType | undefined;
|
|
26
|
-
}, string>, fetchPaymentSources: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updatePaymentSources: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
27
|
-
fetchState: FetchState;
|
|
28
|
-
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
29
|
-
response?: AddCardPaymentSourceResponse | undefined;
|
|
30
|
-
}, string>, clearCardPaymentView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
31
|
-
declare const _default: import("@reduxjs/toolkit").Reducer<CardPaymentViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
32
|
-
export default _default;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearCardPaymentView = exports.updatePaymentSources = exports.fetchPaymentSources = exports.updateAddCardPaymentSourceStatus = exports.addCardPaymentSource = exports.updateConfirmCardSetupIntentStatus = exports.confirmCardSetupIntent = exports.updateCardSetupIntentStatus = exports.createCardSetupIntent = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
exports.initialState = {
|
|
7
|
-
cardPaymentsIDs: [],
|
|
8
|
-
bankAccountIDs: [],
|
|
9
|
-
clientSecret: '',
|
|
10
|
-
fetchState: 'Not-Started',
|
|
11
|
-
error: undefined,
|
|
12
|
-
cardDeleteStatusById: {},
|
|
13
|
-
cardSetupIntentStatus: {
|
|
14
|
-
fetchState: 'Not-Started',
|
|
15
|
-
error: undefined,
|
|
16
|
-
},
|
|
17
|
-
cardSetupConfirmStatus: {
|
|
18
|
-
fetchState: 'Not-Started',
|
|
19
|
-
error: undefined,
|
|
20
|
-
},
|
|
21
|
-
addCardPaymentSourceStatus: {
|
|
22
|
-
fetchState: 'Not-Started',
|
|
23
|
-
error: undefined,
|
|
24
|
-
},
|
|
25
|
-
hasValidState() {
|
|
26
|
-
return this.fetchState == 'Completed';
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
const cardPaymentView = (0, toolkit_1.createSlice)({
|
|
30
|
-
name: 'cardPaymentView',
|
|
31
|
-
initialState: exports.initialState,
|
|
32
|
-
reducers: {
|
|
33
|
-
createCardSetupIntent: {
|
|
34
|
-
reducer(draft) {
|
|
35
|
-
draft.cardSetupIntentStatus = {
|
|
36
|
-
fetchState: 'In-Progress',
|
|
37
|
-
error: undefined,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
prepare(paymentsMethod) {
|
|
41
|
-
return {
|
|
42
|
-
payload: { paymentsMethod }, // Add the payload property
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
updateCardSetupIntentStatus(draft, action) {
|
|
47
|
-
draft.clientSecret = action.payload.clientSecret;
|
|
48
|
-
draft.cardSetupIntentStatus = {
|
|
49
|
-
fetchState: action.payload.fetchState,
|
|
50
|
-
error: action.payload.error,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
confirmCardSetupIntent: {
|
|
54
|
-
reducer(draft) {
|
|
55
|
-
draft.cardSetupConfirmStatus = {
|
|
56
|
-
fetchState: 'In-Progress',
|
|
57
|
-
error: undefined,
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
prepare(setupIntentData) {
|
|
61
|
-
return {
|
|
62
|
-
payload: { setupIntentData },
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
updateConfirmCardSetupIntentStatus(draft, action) {
|
|
67
|
-
if (action.payload.setupIntentData != null) {
|
|
68
|
-
draft.setupIntentData = action.payload.setupIntentData;
|
|
69
|
-
}
|
|
70
|
-
draft.cardSetupConfirmStatus = {
|
|
71
|
-
fetchState: action.payload.fetchState,
|
|
72
|
-
error: action.payload.error,
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
addCardPaymentSource: {
|
|
76
|
-
reducer(draft) {
|
|
77
|
-
draft.addCardPaymentSourceStatus = {
|
|
78
|
-
fetchState: 'In-Progress',
|
|
79
|
-
error: undefined,
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
prepare(type, paymentSourceType, setupIntentId) {
|
|
83
|
-
return {
|
|
84
|
-
payload: { type, paymentSourceType, setupIntentId },
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
updateAddCardPaymentSourceStatus(state, action) {
|
|
89
|
-
var _a;
|
|
90
|
-
state.addCardPaymentSourceStatus.fetchState = action.payload.fetchState;
|
|
91
|
-
state.addCardPaymentSourceStatus.error = action.payload.error;
|
|
92
|
-
const paymentMethods = action.payload.payment_sources;
|
|
93
|
-
if (paymentMethods != null) {
|
|
94
|
-
const cardIds = (_a = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.cards) === null || _a === void 0 ? void 0 : _a.map((card) => card.id);
|
|
95
|
-
if (cardIds) {
|
|
96
|
-
state.cardPaymentsIDs = cardIds;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
fetchPaymentSources(state) {
|
|
101
|
-
state.fetchState = 'In-Progress';
|
|
102
|
-
},
|
|
103
|
-
updatePaymentSources(state, action) {
|
|
104
|
-
var _a, _b, _c;
|
|
105
|
-
state.addCardPaymentSourceStatus.fetchState = action.payload.fetchState;
|
|
106
|
-
state.addCardPaymentSourceStatus.error = action.payload.error;
|
|
107
|
-
const paymentMethods = (_a = action.payload.response) === null || _a === void 0 ? void 0 : _a.payment_sources;
|
|
108
|
-
if (paymentMethods) {
|
|
109
|
-
const cardIds = (_b = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.cards) === null || _b === void 0 ? void 0 : _b.map((card) => card.id);
|
|
110
|
-
if (cardIds) {
|
|
111
|
-
state.cardPaymentsIDs = cardIds;
|
|
112
|
-
}
|
|
113
|
-
const bankAccountIds = (_c = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.bank_accounts) === null || _c === void 0 ? void 0 : _c.map((bankAccount) => bankAccount.id);
|
|
114
|
-
if (bankAccountIds) {
|
|
115
|
-
state.bankAccountIDs = bankAccountIds;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
clearCardPaymentView(draft) {
|
|
120
|
-
Object.assign(draft, exports.initialState);
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
_a = cardPaymentView.actions, exports.createCardSetupIntent = _a.createCardSetupIntent, exports.updateCardSetupIntentStatus = _a.updateCardSetupIntentStatus, exports.confirmCardSetupIntent = _a.confirmCardSetupIntent, exports.updateConfirmCardSetupIntentStatus = _a.updateConfirmCardSetupIntentStatus, exports.addCardPaymentSource = _a.addCardPaymentSource, exports.updateAddCardPaymentSourceStatus = _a.updateAddCardPaymentSourceStatus, exports.fetchPaymentSources = _a.fetchPaymentSources, exports.updatePaymentSources = _a.updatePaymentSources, exports.clearCardPaymentView = _a.clearCardPaymentView;
|
|
125
|
-
exports.default = cardPaymentView.reducer;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { BankAccount, CardPayment } from '../../entity/cardPayment/cardPaymentState';
|
|
4
|
-
import { RootState } from '../../reducer';
|
|
5
|
-
import { SetupIntentData } from './cardPaymentViewState';
|
|
6
|
-
export interface CardPaymentSelectorView extends SelectorView {
|
|
7
|
-
cardsList: CardPayment[];
|
|
8
|
-
bankAccountsList: BankAccount[];
|
|
9
|
-
cardDeleteStatusById: Record<ID, FetchStateAndError>;
|
|
10
|
-
addCardPaymentSourceStatus: FetchStateAndError;
|
|
11
|
-
cardSetupConfirmStatus: FetchStateAndError;
|
|
12
|
-
cardSetupIntentStatus: FetchStateAndError;
|
|
13
|
-
clientSecret?: string;
|
|
14
|
-
setupIntentData?: SetupIntentData;
|
|
15
|
-
}
|
|
16
|
-
export declare const getAllCardsAndBankPaymentMethods: (state: RootState) => CardPaymentSelectorView;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllCardsAndBankPaymentMethods = void 0;
|
|
4
|
-
const cardPaymentSelector_1 = require("../../entity/cardPayment/cardPaymentSelector");
|
|
5
|
-
const getAllCardsAndBankPaymentMethods = (state) => {
|
|
6
|
-
var _a, _b, _c;
|
|
7
|
-
const { cardPaymentState, cardPaymentViewState } = state;
|
|
8
|
-
const cardList = (0, cardPaymentSelector_1.getCardsByIds)(cardPaymentState, (_a = cardPaymentViewState.cardPaymentsIDs) !== null && _a !== void 0 ? _a : []);
|
|
9
|
-
const bankAccountList = (0, cardPaymentSelector_1.getBankAccountsByIds)(cardPaymentState, (_b = cardPaymentViewState.bankAccountIDs) !== null && _b !== void 0 ? _b : []);
|
|
10
|
-
return {
|
|
11
|
-
cardsList: cardList,
|
|
12
|
-
bankAccountsList: bankAccountList,
|
|
13
|
-
fetchState: cardPaymentViewState.fetchState,
|
|
14
|
-
clientSecret: (_c = cardPaymentViewState.clientSecret) !== null && _c !== void 0 ? _c : '',
|
|
15
|
-
setupIntentData: cardPaymentViewState.setupIntentData,
|
|
16
|
-
addCardPaymentSourceStatus: cardPaymentViewState.addCardPaymentSourceStatus,
|
|
17
|
-
cardDeleteStatusById: cardPaymentViewState.cardDeleteStatusById,
|
|
18
|
-
cardSetupConfirmStatus: cardPaymentViewState.cardSetupConfirmStatus,
|
|
19
|
-
cardSetupIntentStatus: cardPaymentViewState.cardSetupIntentStatus,
|
|
20
|
-
error: undefined,
|
|
21
|
-
version: 0,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
exports.getAllCardsAndBankPaymentMethods = getAllCardsAndBankPaymentMethods;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PaymentMethod } from '@stripe/stripe-js';
|
|
2
|
-
import { FetchedState, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
|
-
export interface CardPaymentViewState extends FetchedState {
|
|
4
|
-
cardPaymentsIDs: ID[];
|
|
5
|
-
bankAccountIDs: ID[];
|
|
6
|
-
cardSetupConfirmStatus: FetchStateAndError;
|
|
7
|
-
cardSetupIntentStatus: FetchStateAndError;
|
|
8
|
-
addCardPaymentSourceStatus: FetchStateAndError;
|
|
9
|
-
cardDeleteStatusById: Record<ID, FetchStateAndError>;
|
|
10
|
-
setupIntentData?: SetupIntentData;
|
|
11
|
-
clientSecret?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface SetupIntentData {
|
|
14
|
-
id: string;
|
|
15
|
-
status: string;
|
|
16
|
-
paymentMethod: string | null | PaymentMethod;
|
|
17
|
-
clientSecret?: string | null;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
3
|
-
import { RootState } from '../../../reducer';
|
|
4
|
-
import { addCardPaymentSource, fetchPaymentSources, updateAddCardPaymentSourceStatus } from '../cardPaymentViewReducer';
|
|
5
|
-
import { updateOnboardingCustomerViewUIState } from '../../onboardingView/customerView/onboardingCustomerViewReducer';
|
|
6
|
-
import { updateZeniAccountSetupViewUIState } from '../../spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer';
|
|
7
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
|
-
export declare type ActionType = ReturnType<typeof addCardPaymentSource> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateAddCardPaymentSourceStatus> | ReturnType<typeof fetchPaymentSources> | ReturnType<typeof updateZeniAccountSetupViewUIState> | ReturnType<typeof updateOnboardingCustomerViewUIState>;
|
|
9
|
-
export declare const addCardPaymentSourceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
10
|
-
payload: undefined;
|
|
11
|
-
type: string;
|
|
12
|
-
} | {
|
|
13
|
-
payload: Partial<import("../../spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewState").ZeniAccountSetupViewUIState>;
|
|
14
|
-
type: string;
|
|
15
|
-
} | {
|
|
16
|
-
payload: {
|
|
17
|
-
messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_setup_intent" | "confirm_card_setup_intent" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification";
|
|
18
|
-
messageText: "failed" | "success" | "notification";
|
|
19
|
-
type: import("../../..").SnackbarMessageType;
|
|
20
|
-
showStatusIcon?: boolean | undefined;
|
|
21
|
-
variables?: {
|
|
22
|
-
variableName: string;
|
|
23
|
-
variableValue: string;
|
|
24
|
-
}[] | undefined;
|
|
25
|
-
};
|
|
26
|
-
type: string;
|
|
27
|
-
} | {
|
|
28
|
-
payload: {
|
|
29
|
-
fetchState: import("../../..").FetchState;
|
|
30
|
-
error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
31
|
-
payment_sources?: import("../cardPaymentViewPayload").CardsOrBanksType | undefined;
|
|
32
|
-
};
|
|
33
|
-
type: string;
|
|
34
|
-
}>;
|