@zeniai/client-epic-state 5.0.90-betaAR5 → 5.0.90-betaAS10
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/commonPayloadTypes/commonPayload.d.ts +25 -4
- package/lib/entity/approvalRule/approvalRulePayload.d.ts +5 -34
- package/lib/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/entity/approvalRule/approvalRuleSelector.d.ts +1 -25
- package/lib/entity/approvalRule/approvalRuleSelector.js +0 -40
- package/lib/entity/approvalRule/approvalRuleState.d.ts +7 -59
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/esm/entity/approvalRule/approvalRuleSelector.js +0 -35
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +12 -9
- package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +12 -109
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -140
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +7 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -34
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +40 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +86 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +55 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -6
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -80
- package/lib/index.d.ts +15 -11
- package/lib/index.js +38 -30
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -7
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +13 -110
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +0 -16
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -59
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +17 -142
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +5 -31
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -8
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +6 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +32 -33
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +4 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +150 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +38 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +43 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +27 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +96 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +24 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +59 -9
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +4 -5
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +20 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +159 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +12 -81
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +0 -12
- package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
- package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +0 -56
- package/lib/entity/approvalRule/approvalRuleConflict.js +0 -77
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +0 -74
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -54
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -61
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +0 -23
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -58
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +0 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -65
|
@@ -9,7 +9,6 @@ exports.getPaymentSection = getPaymentSection;
|
|
|
9
9
|
exports.toPaymentToOption = toPaymentToOption;
|
|
10
10
|
const get_1 = __importDefault(require("lodash/get"));
|
|
11
11
|
const has_1 = __importDefault(require("lodash/has"));
|
|
12
|
-
const approvalRuleSelector_1 = require("../../../../entity/approvalRule/approvalRuleSelector");
|
|
13
12
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
14
13
|
const bankAccountSelector_1 = require("../../../../entity/bankAccount/bankAccountSelector");
|
|
15
14
|
const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
|
|
@@ -366,14 +365,6 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
366
365
|
isDeleted,
|
|
367
366
|
showAutofill,
|
|
368
367
|
addBillAutoFields,
|
|
369
|
-
// Bill-level accounting class. Approval Rules 3.0 'department'
|
|
370
|
-
// criteria match against this. Lives on BillTransaction; not on
|
|
371
|
-
// any sub-section. Empty-string is normalised to 'undefined'
|
|
372
|
-
// so downstream readers treat "no class" uniformly regardless
|
|
373
|
-
// of whether the wire used '' or omitted the field.
|
|
374
|
-
classId: transaction?.classId != null && transaction.classId !== ''
|
|
375
|
-
? transaction.classId
|
|
376
|
-
: undefined,
|
|
377
368
|
billStage,
|
|
378
369
|
deleteStatus,
|
|
379
370
|
billActivities,
|
|
@@ -704,59 +695,12 @@ const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSe
|
|
|
704
695
|
return undefined;
|
|
705
696
|
};
|
|
706
697
|
exports.getDefaultWithdrawFromAccount = getDefaultWithdrawFromAccount;
|
|
707
|
-
const checkIfCreatorIsApprover = (billAmount, approvalRules, signedInUser
|
|
698
|
+
const checkIfCreatorIsApprover = (billAmount, approvalRules, signedInUser) => {
|
|
708
699
|
let isCreatorAlsoApprover = false;
|
|
709
|
-
// Approval Rules 3.0 — a rule applies to a bill only when all of
|
|
710
|
-
// its present criteria are satisfied. Criteria not declared on
|
|
711
|
-
// the rule are treated as "no narrowing on this axis".
|
|
712
|
-
//
|
|
713
|
-
// Strict-match semantics for vendor / department: if the rule
|
|
714
|
-
// narrows by an axis but the bill has no value on that axis, the
|
|
715
|
-
// rule does NOT apply (an absent bill-side value can't satisfy
|
|
716
|
-
// either 'is' or 'is_not'). Amount is always present on a rule
|
|
717
|
-
// (the form enforces this), but bounds may be one-sided.
|
|
718
700
|
const approvalRule = approvalRules.find((rule) => {
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
return false;
|
|
723
|
-
}
|
|
724
|
-
const includesVendor = vendorCriteria.vendorIds.includes(billVendorId);
|
|
725
|
-
if (vendorCriteria.operator === 'is' && !includesVendor) {
|
|
726
|
-
return false;
|
|
727
|
-
}
|
|
728
|
-
if (vendorCriteria.operator === 'is_not' && includesVendor) {
|
|
729
|
-
return false;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
const departmentCriteria = (0, approvalRuleSelector_1.getDepartmentCriteria)(rule.criteria);
|
|
733
|
-
if (departmentCriteria != null) {
|
|
734
|
-
if (billDepartmentId == null) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
const includesDepartment = departmentCriteria.departmentIds.includes(billDepartmentId);
|
|
738
|
-
if (departmentCriteria.operator === 'is' && !includesDepartment) {
|
|
739
|
-
return false;
|
|
740
|
-
}
|
|
741
|
-
if (departmentCriteria.operator === 'is_not' && includesDepartment) {
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
const amountCriteria = (0, approvalRuleSelector_1.getAmountCriteria)(rule.criteria);
|
|
746
|
-
if (amountCriteria == null) {
|
|
747
|
-
// The form guarantees an amount criterion on every rule, so
|
|
748
|
-
// this branch is defensive against backend drift. Keep
|
|
749
|
-
// pre-3.0 behaviour: a rule that doesn't declare amount
|
|
750
|
-
// doesn't participate here.
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
// Bounds use the wire's inclusive 'gte' / 'lte' semantics, and
|
|
754
|
-
// either side may be absent for a one-sided 'greater_than' /
|
|
755
|
-
// 'less_than' rule.
|
|
756
|
-
const { min, max } = amountCriteria;
|
|
757
|
-
const matchesMin = min == null || billAmount >= min.amount;
|
|
758
|
-
const matchesMax = max == null || billAmount <= max.amount;
|
|
759
|
-
return matchesMin && matchesMax;
|
|
701
|
+
const { max, min } = rule.criteria[0].range;
|
|
702
|
+
return (billAmount > min.amount &&
|
|
703
|
+
(max?.amount != null ? billAmount <= max?.amount : true));
|
|
760
704
|
});
|
|
761
705
|
if (approvalRule != null) {
|
|
762
706
|
const requireApprovalSteps = approvalRule.steps.filter((step) => step.action === 'require_approval');
|
|
@@ -41,10 +41,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
41
41
|
else {
|
|
42
42
|
billDetailActions.push((0, editBillViewReducer_1.updateShowAutofill)(true));
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
46
|
-
// here; tenants on v3 re-fetch through their own screen connector.
|
|
47
|
-
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, false));
|
|
44
|
+
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true));
|
|
48
45
|
}
|
|
49
46
|
else {
|
|
50
47
|
if (state.ownerListState.fetchState !== 'In-Progress' &&
|
|
@@ -87,10 +84,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
87
84
|
// While opening New Bill Refresh Approval Rules and Payment Accounts
|
|
88
85
|
if (approvalViewFetchState !== 'In-Progress' &&
|
|
89
86
|
approvalViewFetchState !== 'Completed') {
|
|
90
|
-
|
|
91
|
-
// action doesn't carry the V3 flag, so we explicitly target v1
|
|
92
|
-
// here; tenants on v3 re-fetch through their own screen connector.
|
|
93
|
-
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, false));
|
|
87
|
+
billDetailActions.push((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true));
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(billDetailActions));
|
|
@@ -2,6 +2,6 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
4
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { fetchInternationalVerificationForm,
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof
|
|
7
|
-
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>,
|
|
5
|
+
import { fetchInternationalVerificationForm, updateInternationalVerificationForm, updateVerificationFormFailure, updateVerificationFormLocalData } from '../internationalWireVerificationReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof updateVerificationFormLocalData>;
|
|
7
|
+
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,8 +4,9 @@ exports.fetchIntlVerificationFormEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
+
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
7
8
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
8
|
-
const fetchIntlVerificationFormEpic = (actions$,
|
|
9
|
+
const fetchIntlVerificationFormEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.fetchInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
9
10
|
const query = {
|
|
10
11
|
region: 'US',
|
|
11
12
|
legal_type: 'BUSINESS',
|
|
@@ -14,11 +15,14 @@ const fetchIntlVerificationFormEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
14
15
|
.getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding-fields?query=${encodeURIComponent(JSON.stringify(query))}`)
|
|
15
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
const onboardingDataFromCompanyInfo = state$.value.companyState.companiesById[action.payload.companyId]
|
|
19
|
+
?.companyBillPayInfo?.internationalWireOnboardingDetails;
|
|
20
|
+
const localData = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, response.data.labels);
|
|
17
21
|
return (0, rxjs_1.from)([
|
|
18
22
|
(0, internationalWireVerificationReducer_1.updateInternationalVerificationForm)({
|
|
19
23
|
internationalWireFormPayload: response.data.labels,
|
|
20
24
|
}),
|
|
21
|
-
(0, internationalWireVerificationReducer_1.
|
|
25
|
+
(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData),
|
|
22
26
|
]);
|
|
23
27
|
}
|
|
24
28
|
else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { fetchBillPaySetupViewSuccess } from '../../billPaySetupView/billPaySetupViewReducer';
|
|
4
5
|
import { initializeIntlVerificationForm, updateVerificationFormLocalData } from '../internationalWireVerificationReducer';
|
|
5
6
|
export type ActionType = ReturnType<typeof updateVerificationFormLocalData> | ReturnType<typeof initializeIntlVerificationForm>;
|
|
6
|
-
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType
|
|
7
|
+
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType | ReturnType<typeof fetchBillPaySetupViewSuccess>>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,41 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeIntlVerificationFormEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
7
|
+
const billPaySetupViewReducer_1 = require("../../billPaySetupView/billPaySetupViewReducer");
|
|
8
|
+
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
6
9
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const hasSavedPersonSubfieldData = (localData) => Object.keys(localData).some((key) => /^stake_holder_\d+_/.test(key) ||
|
|
11
|
+
(key.startsWith('controlling_person_') && key !== 'controlling_person'));
|
|
12
|
+
const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => internationalWireVerificationReducer_1.initializeIntlVerificationForm.match(action) ||
|
|
13
|
+
billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess.match(action)), (0, operators_1.mergeMap)((action) => {
|
|
10
14
|
const state = state$.value;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: values[0];
|
|
15
|
+
const formFieldLabels = state.internationalWireVerificationState.verificationFormFieldLabels;
|
|
16
|
+
if (Object.keys(formFieldLabels).length === 0) {
|
|
17
|
+
return (0, rxjs_1.empty)();
|
|
18
|
+
}
|
|
19
|
+
const companyId = internationalWireVerificationReducer_1.initializeIntlVerificationForm.match(action) ?
|
|
20
|
+
action.payload.companyId
|
|
21
|
+
: (0, tenantSelector_1.getCurrentTenant)(state)?.companyId;
|
|
22
|
+
if (companyId == null) {
|
|
23
|
+
return (0, rxjs_1.empty)();
|
|
24
|
+
}
|
|
25
|
+
const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId]?.companyBillPayInfo
|
|
26
|
+
?.internationalWireOnboardingDetails;
|
|
27
|
+
const localDataFromCompany = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, formFieldLabels);
|
|
28
|
+
const existingLocalData = state.internationalWireVerificationState.verificationFormLocalData;
|
|
29
|
+
if (billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess.match(action)) {
|
|
30
|
+
if (!hasSavedPersonSubfieldData(localDataFromCompany) ||
|
|
31
|
+
hasSavedPersonSubfieldData(existingLocalData)) {
|
|
32
|
+
return (0, rxjs_1.empty)();
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData));
|
|
41
|
-
return (0, rxjs_1.from)(actions);
|
|
34
|
+
}
|
|
35
|
+
return (0, rxjs_1.from)([
|
|
36
|
+
(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)({
|
|
37
|
+
...existingLocalData,
|
|
38
|
+
...localDataFromCompany,
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
42
41
|
}));
|
|
43
42
|
exports.initializeIntlVerificationFormEpic = initializeIntlVerificationFormEpic;
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const internationalWireVerificationSubmitPayload_1 = require("../internationalWireVerificationSubmitPayload");
|
|
9
10
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
10
11
|
const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
11
12
|
const { internationalWireVerificationState } = state$.value;
|
|
@@ -13,7 +14,7 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
13
14
|
const localData = internationalWireVerificationState.verificationFormLocalData;
|
|
14
15
|
if (localData != null) {
|
|
15
16
|
return zeniAPI
|
|
16
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`,
|
|
17
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, (0, internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload)(localData))
|
|
17
18
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
19
|
const actions = [];
|
|
19
20
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -58,9 +59,3 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
58
59
|
}
|
|
59
60
|
}));
|
|
60
61
|
exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
|
|
61
|
-
const toIntlWireVerificationPayload = (localData) => {
|
|
62
|
-
return {
|
|
63
|
-
is_applicant_declaration: true,
|
|
64
|
-
form_details: localData,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LabelValueCodesPayload } from '../../../../commonPayloadTypes/commonPayload';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
3
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const toVerificationFormLocalDataFromOnboardingDetails: (onboardingDetails: Record<string, LabelValueCodesPayload> | undefined, internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormLocalData;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toVerificationFormLocalDataFromOnboardingDetails = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationLocalDataHelpers_1 = require("./internationalWireVerificationLocalDataHelpers");
|
|
6
|
+
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
7
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
8
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
9
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
10
|
+
]);
|
|
11
|
+
const toValuesArray = (values) => {
|
|
12
|
+
if (values == null) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(values)) {
|
|
16
|
+
return values;
|
|
17
|
+
}
|
|
18
|
+
return [values];
|
|
19
|
+
};
|
|
20
|
+
const getCodeFromValue = (value) => {
|
|
21
|
+
if (typeof value === 'string') {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'object' &&
|
|
25
|
+
value != null &&
|
|
26
|
+
'code' in value &&
|
|
27
|
+
typeof value.code === 'string') {
|
|
28
|
+
return value.code;
|
|
29
|
+
}
|
|
30
|
+
return '';
|
|
31
|
+
};
|
|
32
|
+
const setEmptyFieldDefault = (localData, fieldKey, fieldPayload) => {
|
|
33
|
+
if (fieldPayload.type === 'enum') {
|
|
34
|
+
localData[fieldKey] =
|
|
35
|
+
fieldPayload.is_multiple_values_allowed === true ? [] : '';
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
39
|
+
if (fieldKey ===
|
|
40
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
41
|
+
localData[fieldKey] = 'false';
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (fieldKey ===
|
|
45
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
46
|
+
localData[fieldKey] = fieldPayload.default === true ? 'true' : 'false';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const parseEnumValues = (localData, fieldKey, fieldPayload, values) => {
|
|
51
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
52
|
+
localData[fieldKey] = values
|
|
53
|
+
.map(getCodeFromValue)
|
|
54
|
+
.filter((code) => code.length > 0);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
58
|
+
};
|
|
59
|
+
const parseFileValues = (localData, fieldKey, fieldPayload, values) => {
|
|
60
|
+
if (values.length > 0 &&
|
|
61
|
+
((0, internationalWireVerificationLocalDataHelpers_1.isIntlWireFileOptionLike)(values[0]) ||
|
|
62
|
+
MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey))) {
|
|
63
|
+
const fileOptions = (0, internationalWireVerificationLocalDataHelpers_1.toIntlWireFileOptionArray)(values);
|
|
64
|
+
if (fileOptions.length > 0) {
|
|
65
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWireFileOptionsToLocalData)(localData, fieldKey, fileOptions);
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const fileIds = values.filter((value) => typeof value === 'string' && value.length > 0);
|
|
70
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
71
|
+
localData[fieldKey] = fileIds;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
localData[fieldKey] = fileIds[0] ?? '';
|
|
75
|
+
};
|
|
76
|
+
const parseBooleanWithSubfieldsValues = (localData, fieldKey, fieldPayload, rawValues) => {
|
|
77
|
+
if (fieldKey ===
|
|
78
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
79
|
+
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(rawValues)) {
|
|
80
|
+
localData[fieldKey] = 'false';
|
|
81
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, rawValues);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const values = toValuesArray(rawValues);
|
|
85
|
+
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
86
|
+
localData[fieldKey] = 'false';
|
|
87
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, values[0]);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const selection = getCodeFromValue(values[0]);
|
|
91
|
+
localData[fieldKey] =
|
|
92
|
+
selection.length > 0
|
|
93
|
+
? selection
|
|
94
|
+
: fieldPayload.default === true
|
|
95
|
+
? 'true'
|
|
96
|
+
: 'false';
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (fieldKey ===
|
|
100
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
101
|
+
const values = toValuesArray(rawValues);
|
|
102
|
+
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
103
|
+
localData[fieldKey] = 'true';
|
|
104
|
+
values.forEach((person, ownerIndex) => {
|
|
105
|
+
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(person)) {
|
|
106
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, `${fieldKey}_${ownerIndex}`, person);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const selection = getCodeFromValue(values[0]);
|
|
112
|
+
localData[fieldKey] = selection.length > 0 ? selection : 'false';
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const toVerificationFormLocalDataFromOnboardingDetails = (onboardingDetails, internationalWireFormPayload) => {
|
|
116
|
+
const localData = {};
|
|
117
|
+
Object.keys(internationalWireFormPayload).forEach((fieldKey) => {
|
|
118
|
+
const fieldPayload = internationalWireFormPayload[fieldKey];
|
|
119
|
+
const rawValues = onboardingDetails?.[fieldKey]?.values;
|
|
120
|
+
if (rawValues == null) {
|
|
121
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
125
|
+
parseBooleanWithSubfieldsValues(localData, fieldKey, fieldPayload, rawValues);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const values = toValuesArray(rawValues);
|
|
129
|
+
if (values.length === 0) {
|
|
130
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
switch (fieldPayload.type) {
|
|
134
|
+
case 'enum':
|
|
135
|
+
parseEnumValues(localData, fieldKey, fieldPayload, values);
|
|
136
|
+
break;
|
|
137
|
+
case 'file':
|
|
138
|
+
parseFileValues(localData, fieldKey, fieldPayload, values);
|
|
139
|
+
break;
|
|
140
|
+
case 'date':
|
|
141
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return localData;
|
|
149
|
+
};
|
|
150
|
+
exports.toVerificationFormLocalDataFromOnboardingDetails = toVerificationFormLocalDataFromOnboardingDetails;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const InternationalWireVerificationFormFieldNames: {
|
|
2
|
+
readonly certificateOfGoodStanding: "certificate_of_good_standing";
|
|
3
|
+
readonly businessOwnership: "business_ownership";
|
|
4
|
+
readonly companyProofOfAddress: "company_proof_of_address";
|
|
5
|
+
readonly companyOfficerProofOfAddress: "company_officer_proof_of_address";
|
|
6
|
+
readonly companyRegistrationDate: "company_registration_date";
|
|
7
|
+
readonly annualTurnover: "annual_turnover";
|
|
8
|
+
readonly expectedTransactionVolume: "expected_transaction_volume";
|
|
9
|
+
readonly employeeCount: "employee_count";
|
|
10
|
+
readonly intendedUseOfAccount: "intended_use_of_account";
|
|
11
|
+
readonly transactionCountries: "transaction_countries";
|
|
12
|
+
readonly stakeHolder: "stake_holder";
|
|
13
|
+
readonly controllingPerson: "controlling_person";
|
|
14
|
+
};
|
|
15
|
+
export type InternationalWireVerificationFormFieldName = (typeof InternationalWireVerificationFormFieldNames)[keyof typeof InternationalWireVerificationFormFieldNames];
|
|
16
|
+
export declare const InternationalWireVerificationStakeHolderFieldName: "stake_holder";
|
|
17
|
+
export declare const InternationalWireVerificationControllingPersonFieldName: "controlling_person";
|
|
18
|
+
export declare const InternationalWireVerificationBooleanWithSubfieldsFieldNames: {
|
|
19
|
+
readonly stakeHolder: "stake_holder";
|
|
20
|
+
readonly controllingPerson: "controlling_person";
|
|
21
|
+
};
|
|
22
|
+
export type InternationalWireVerificationBooleanWithSubfieldsFieldName = (typeof InternationalWireVerificationBooleanWithSubfieldsFieldNames)[keyof typeof InternationalWireVerificationBooleanWithSubfieldsFieldNames];
|
|
23
|
+
export declare const InternationalWireVerificationBooleanWithSubfieldsFieldNameList: InternationalWireVerificationBooleanWithSubfieldsFieldName[];
|
|
24
|
+
export declare const InternationalWireVerificationSubfieldNames: {
|
|
25
|
+
readonly companyRole: "company_role";
|
|
26
|
+
readonly dateOfBirth: "date_of_birth";
|
|
27
|
+
readonly name: "name";
|
|
28
|
+
readonly email: "email";
|
|
29
|
+
readonly nationality: "nationality";
|
|
30
|
+
readonly ownershipPercentage: "ownership_percentage";
|
|
31
|
+
readonly proofOfIdentity: "proof_of_identity";
|
|
32
|
+
readonly proofOfAddress: "proof_of_address";
|
|
33
|
+
readonly ssn: "ssn";
|
|
34
|
+
};
|
|
35
|
+
export type InternationalWireVerificationSubfieldName = (typeof InternationalWireVerificationSubfieldNames)[keyof typeof InternationalWireVerificationSubfieldNames];
|
|
36
|
+
export declare const InternationalWireVerificationReadonlyHideableFieldNames: readonly ["stake_holder", "controlling_person", "business_ownership", "company_proof_of_address", "company_officer_proof_of_address"];
|
|
37
|
+
export type InternationalWireVerificationReadonlyHideableFieldName = (typeof InternationalWireVerificationReadonlyHideableFieldNames)[number];
|
|
38
|
+
export declare const InternationalWireVerificationReadonlyVisibilityGateFieldName: "business_ownership";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternationalWireVerificationReadonlyVisibilityGateFieldName = exports.InternationalWireVerificationReadonlyHideableFieldNames = exports.InternationalWireVerificationSubfieldNames = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNameList = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames = exports.InternationalWireVerificationControllingPersonFieldName = exports.InternationalWireVerificationStakeHolderFieldName = exports.InternationalWireVerificationFormFieldNames = void 0;
|
|
4
|
+
exports.InternationalWireVerificationFormFieldNames = {
|
|
5
|
+
certificateOfGoodStanding: 'certificate_of_good_standing',
|
|
6
|
+
businessOwnership: 'business_ownership',
|
|
7
|
+
companyProofOfAddress: 'company_proof_of_address',
|
|
8
|
+
companyOfficerProofOfAddress: 'company_officer_proof_of_address',
|
|
9
|
+
companyRegistrationDate: 'company_registration_date',
|
|
10
|
+
annualTurnover: 'annual_turnover',
|
|
11
|
+
expectedTransactionVolume: 'expected_transaction_volume',
|
|
12
|
+
employeeCount: 'employee_count',
|
|
13
|
+
intendedUseOfAccount: 'intended_use_of_account',
|
|
14
|
+
transactionCountries: 'transaction_countries',
|
|
15
|
+
stakeHolder: 'stake_holder',
|
|
16
|
+
controllingPerson: 'controlling_person',
|
|
17
|
+
};
|
|
18
|
+
exports.InternationalWireVerificationStakeHolderFieldName = exports.InternationalWireVerificationFormFieldNames.stakeHolder;
|
|
19
|
+
exports.InternationalWireVerificationControllingPersonFieldName = exports.InternationalWireVerificationFormFieldNames.controllingPerson;
|
|
20
|
+
exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames = {
|
|
21
|
+
stakeHolder: exports.InternationalWireVerificationStakeHolderFieldName,
|
|
22
|
+
controllingPerson: exports.InternationalWireVerificationControllingPersonFieldName,
|
|
23
|
+
};
|
|
24
|
+
exports.InternationalWireVerificationBooleanWithSubfieldsFieldNameList = Object.values(exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames);
|
|
25
|
+
exports.InternationalWireVerificationSubfieldNames = {
|
|
26
|
+
companyRole: 'company_role',
|
|
27
|
+
dateOfBirth: 'date_of_birth',
|
|
28
|
+
name: 'name',
|
|
29
|
+
email: 'email',
|
|
30
|
+
nationality: 'nationality',
|
|
31
|
+
ownershipPercentage: 'ownership_percentage',
|
|
32
|
+
proofOfIdentity: 'proof_of_identity',
|
|
33
|
+
proofOfAddress: 'proof_of_address',
|
|
34
|
+
ssn: 'ssn',
|
|
35
|
+
};
|
|
36
|
+
exports.InternationalWireVerificationReadonlyHideableFieldNames = [
|
|
37
|
+
exports.InternationalWireVerificationFormFieldNames.stakeHolder,
|
|
38
|
+
exports.InternationalWireVerificationFormFieldNames.controllingPerson,
|
|
39
|
+
exports.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
40
|
+
exports.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
41
|
+
exports.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
42
|
+
];
|
|
43
|
+
exports.InternationalWireVerificationReadonlyVisibilityGateFieldName = exports.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
2
|
+
export type IntlWireFileOptionLike = {
|
|
3
|
+
file_id: string;
|
|
4
|
+
option?: string;
|
|
5
|
+
};
|
|
6
|
+
export type IntlWirePersonNameLike = {
|
|
7
|
+
first_name?: string;
|
|
8
|
+
last_name?: string;
|
|
9
|
+
};
|
|
10
|
+
export type IntlWirePersonLike = {
|
|
11
|
+
company_role?: string;
|
|
12
|
+
date_of_birth?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
name?: IntlWirePersonNameLike;
|
|
15
|
+
nationality?: string;
|
|
16
|
+
ownership_percentage?: number;
|
|
17
|
+
proof_of_address?: IntlWireFileOptionLike[];
|
|
18
|
+
proof_of_identity?: IntlWireFileOptionLike[];
|
|
19
|
+
ssn?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const isIntlWireFileOptionLike: (value: unknown) => value is IntlWireFileOptionLike;
|
|
22
|
+
export declare const isIntlWirePersonLike: (value: unknown) => value is IntlWirePersonLike;
|
|
23
|
+
export declare const toIntlWireFileOptionArray: (items: unknown[]) => IntlWireFileOptionLike[];
|
|
24
|
+
export declare const appendIntlWireFileOptionsToLocalData: (localData: VerificationFormLocalData, baseKey: string, fileOptions: IntlWireFileOptionLike[]) => void;
|
|
25
|
+
export declare const appendIntlWirePersonToLocalData: (localData: VerificationFormLocalData, keyPrefix: string, person: IntlWirePersonLike) => void;
|
|
26
|
+
export declare const getStakeHolderOwnerIndicesFromLocalData: (localData: VerificationFormLocalData) => number[];
|
|
27
|
+
export declare const hasBusinessOwnershipValueInLocalData: (localData: VerificationFormLocalData) => boolean;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasBusinessOwnershipValueInLocalData = exports.getStakeHolderOwnerIndicesFromLocalData = exports.appendIntlWirePersonToLocalData = exports.appendIntlWireFileOptionsToLocalData = exports.toIntlWireFileOptionArray = exports.isIntlWirePersonLike = exports.isIntlWireFileOptionLike = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationSubmitPayload_1 = require("./internationalWireVerificationSubmitPayload");
|
|
6
|
+
const isIntlWireFileOptionLike = (value) => typeof value === 'object' &&
|
|
7
|
+
value != null &&
|
|
8
|
+
'file_id' in value &&
|
|
9
|
+
typeof value.file_id === 'string';
|
|
10
|
+
exports.isIntlWireFileOptionLike = isIntlWireFileOptionLike;
|
|
11
|
+
const isIntlWirePersonLike = (value) => {
|
|
12
|
+
if (typeof value !== 'object' || value == null || Array.isArray(value)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const person = value;
|
|
16
|
+
return (person.name != null ||
|
|
17
|
+
person.email != null ||
|
|
18
|
+
person.nationality != null ||
|
|
19
|
+
person.company_role != null ||
|
|
20
|
+
person.ssn != null ||
|
|
21
|
+
person.date_of_birth != null ||
|
|
22
|
+
person.ownership_percentage != null ||
|
|
23
|
+
person.proof_of_identity != null ||
|
|
24
|
+
person.proof_of_address != null);
|
|
25
|
+
};
|
|
26
|
+
exports.isIntlWirePersonLike = isIntlWirePersonLike;
|
|
27
|
+
const toIntlWireFileOptionArray = (items) => items.filter(exports.isIntlWireFileOptionLike);
|
|
28
|
+
exports.toIntlWireFileOptionArray = toIntlWireFileOptionArray;
|
|
29
|
+
const appendIntlWireFileOptionsToLocalData = (localData, baseKey, fileOptions) => {
|
|
30
|
+
const [front, back] = fileOptions;
|
|
31
|
+
if (front?.file_id != null && front.file_id !== '') {
|
|
32
|
+
localData[baseKey] = front.file_id;
|
|
33
|
+
if (front.option != null && front.option !== '') {
|
|
34
|
+
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`] = front.option;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (back?.file_id != null && back.file_id !== '') {
|
|
38
|
+
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`] =
|
|
39
|
+
back.file_id;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.appendIntlWireFileOptionsToLocalData = appendIntlWireFileOptionsToLocalData;
|
|
43
|
+
const appendIntlWirePersonToLocalData = (localData, keyPrefix, person) => {
|
|
44
|
+
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
45
|
+
if (person.name?.first_name != null) {
|
|
46
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameFirst}`] = person.name.first_name;
|
|
47
|
+
}
|
|
48
|
+
if (person.name?.last_name != null) {
|
|
49
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameLast}`] = person.name.last_name;
|
|
50
|
+
}
|
|
51
|
+
const assignStringField = (subfieldName, fieldValue) => {
|
|
52
|
+
if (fieldValue != null && fieldValue !== '') {
|
|
53
|
+
localData[`${keyPrefix}_${subfieldName}`] = fieldValue;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, person.nationality);
|
|
57
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, person.email);
|
|
58
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, person.company_role);
|
|
59
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, person.ssn);
|
|
60
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, person.date_of_birth);
|
|
61
|
+
if (person.ownership_percentage != null) {
|
|
62
|
+
localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`] = person.ownership_percentage;
|
|
63
|
+
}
|
|
64
|
+
if (person.proof_of_identity != null) {
|
|
65
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_identity));
|
|
66
|
+
}
|
|
67
|
+
if (person.proof_of_address != null) {
|
|
68
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_address));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.appendIntlWirePersonToLocalData = appendIntlWirePersonToLocalData;
|
|
72
|
+
const getStakeHolderOwnerIndicesFromLocalData = (localData) => {
|
|
73
|
+
const indices = new Set();
|
|
74
|
+
Object.keys(localData).forEach((key) => {
|
|
75
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
76
|
+
if (match != null) {
|
|
77
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
81
|
+
};
|
|
82
|
+
exports.getStakeHolderOwnerIndicesFromLocalData = getStakeHolderOwnerIndicesFromLocalData;
|
|
83
|
+
const hasBusinessOwnershipValueInLocalData = (localData) => {
|
|
84
|
+
const baseKey = internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
85
|
+
const frontFileId = localData[baseKey];
|
|
86
|
+
if (typeof frontFileId === 'string' && frontFileId !== '') {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
const backFileId = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
90
|
+
if (typeof backFileId === 'string' && backFileId !== '') {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
const documentOption = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
94
|
+
return typeof documentOption === 'string' && documentOption !== '';
|
|
95
|
+
};
|
|
96
|
+
exports.hasBusinessOwnershipValueInLocalData = hasBusinessOwnershipValueInLocalData;
|