@tap-payments/auth-jsconnect 2.1.2-test → 2.1.3-test
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.
|
@@ -78,14 +78,21 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
78
78
|
leadResponse = undefined;
|
|
79
79
|
brandInfo = undefined;
|
|
80
80
|
boardResponse = undefined;
|
|
81
|
+
countryIso2 = undefined;
|
|
81
82
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 18];
|
|
83
|
+
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
84
|
+
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
85
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
86
|
+
}
|
|
82
87
|
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 18];
|
|
83
88
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
84
89
|
case 2:
|
|
85
90
|
leadResponse = _h.sent();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
if (!countryIso2) {
|
|
92
|
+
countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
|
|
93
|
+
if (countryIso2)
|
|
94
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
95
|
+
}
|
|
89
96
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
|
|
90
97
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
91
98
|
}
|
|
@@ -821,10 +828,10 @@ export var businessSlice = createSlice({
|
|
|
821
828
|
state.error = null;
|
|
822
829
|
})
|
|
823
830
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
824
|
-
var _a, _b, _c, _d
|
|
831
|
+
var _a, _b, _c, _d;
|
|
825
832
|
state.loading = false;
|
|
826
833
|
state.error = null;
|
|
827
|
-
var
|
|
834
|
+
var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo, leadData = _e.leadData;
|
|
828
835
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
829
836
|
if (description) {
|
|
830
837
|
state.error = description;
|
|
@@ -832,11 +839,11 @@ export var businessSlice = createSlice({
|
|
|
832
839
|
}
|
|
833
840
|
state.data.otpData = formData;
|
|
834
841
|
state.data.otpData.responseBody = data;
|
|
835
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody),
|
|
836
|
-
var
|
|
842
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: leadData === null || leadData === void 0 ? void 0 : leadData.flows });
|
|
843
|
+
var _f = leadData || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
|
|
837
844
|
var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
|
|
838
845
|
? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
|
|
839
|
-
: (
|
|
846
|
+
: (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
840
847
|
if (!!issuingDate) {
|
|
841
848
|
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
842
849
|
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
@@ -851,13 +858,13 @@ export var businessSlice = createSlice({
|
|
|
851
858
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
852
859
|
state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
|
|
853
860
|
if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
|
|
854
|
-
var licenseNumber_2 = (
|
|
855
|
-
var
|
|
861
|
+
var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
|
|
862
|
+
var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
|
|
856
863
|
var licenseList = (responseBody || {}).licenseList;
|
|
857
864
|
var selectedLicenseData = selectedLicense;
|
|
858
865
|
if (!!licenseNumber_2) {
|
|
859
866
|
selectedLicenseData =
|
|
860
|
-
((
|
|
867
|
+
((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
|
|
861
868
|
var license = _a.license;
|
|
862
869
|
return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
|
|
863
870
|
})) ||
|
|
@@ -54,7 +54,7 @@ import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
|
54
54
|
import moment from 'moment';
|
|
55
55
|
import { convertNumbers2English } from '../../../utils';
|
|
56
56
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId,
|
|
57
|
+
var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, info, hasEntityCompleted;
|
|
58
58
|
var _a, _b, _c, _d;
|
|
59
59
|
return __generator(this, function (_e) {
|
|
60
60
|
switch (_e.label) {
|
|
@@ -66,8 +66,13 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
66
66
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
67
67
|
case 1:
|
|
68
68
|
data = (_e.sent()).data;
|
|
69
|
-
|
|
69
|
+
countryIso2 = undefined;
|
|
70
70
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
|
|
71
|
+
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
72
|
+
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
73
|
+
if (countryIso2)
|
|
74
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
75
|
+
}
|
|
71
76
|
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
|
|
72
77
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
73
78
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
@@ -90,9 +95,11 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
90
95
|
entityData = _e.sent();
|
|
91
96
|
_e.label = 7;
|
|
92
97
|
case 7:
|
|
93
|
-
countryIso2
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
if (!countryIso2) {
|
|
99
|
+
countryIso2 = entityData.country;
|
|
100
|
+
if (countryIso2)
|
|
101
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
102
|
+
}
|
|
96
103
|
info = boardInfoData.info;
|
|
97
104
|
hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
|
|
98
105
|
if (hasEntityCompleted) {
|
|
@@ -68,6 +68,10 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
68
68
|
boardInfoData = undefined;
|
|
69
69
|
countries = settings.data.countries;
|
|
70
70
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
|
|
71
|
+
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
72
|
+
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
73
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
74
|
+
}
|
|
71
75
|
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
|
|
72
76
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
73
77
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
@@ -89,9 +93,11 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
89
93
|
boardData = _f.sent();
|
|
90
94
|
_f.label = 6;
|
|
91
95
|
case 6:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
if (!countryCode) {
|
|
97
|
+
countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
|
|
98
|
+
if (countryCode)
|
|
99
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
100
|
+
}
|
|
95
101
|
info = boardInfoData.info;
|
|
96
102
|
hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
|
|
97
103
|
if (!hasIndividualCompleted) return [3, 7];
|