karafarin commited on
Commit
3f0ea4e
1 Parent(s): 4c20c4a

Upload New 12.txt

Browse files
Files changed (1) hide show
  1. New 12.txt +275 -0
New 12.txt ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FUNCTION validation (p_acct IN VARCHAR2,
2
+ p_id IN OUT VARCHAR2,
3
+ p_error_code OUT VARCHAR2,
4
+ p_error_desc OUT VARCHAR2)
5
+ RETURN BOOLEAN
6
+ IS
7
+ v_tran_date DATE;
8
+ v_acct_internal_key NUMBER;
9
+ v_dbtr_name fm_client.client_name%TYPE;
10
+ v_client_no rb_acct.client_no%TYPE;
11
+ v_id_type fm_client.global_id_type%TYPE;
12
+ v_client_type fm_client.client_type%TYPE;
13
+ v_country fm_client.country_citizen%TYPE;
14
+ v_id_cor VARCHAR2 (15);
15
+ v_id_nid VARCHAR2 (15);
16
+ v_id VARCHAR2 (12);
17
+ v_check_national_id VARCHAR2 (250) := NULL;
18
+ v_check_corporation_id VARCHAR2 (250) := NULL;
19
+ v_step VARCHAR2 (4);
20
+ BEGIN
21
+ v_step := '1';
22
+
23
+ p_error_code := '000000';
24
+ v_tran_date := get_run_date;
25
+ v_id := p_id;
26
+
27
+ BEGIN
28
+ SELECT internal_key,
29
+ a.client_no,
30
+ b.client_type,
31
+ b.global_id_type,
32
+ b.client_name,
33
+ b.country_citizen
34
+ INTO v_acct_internal_key,
35
+ v_client_no,
36
+ v_client_type,
37
+ v_id_type,
38
+ v_dbtr_name,
39
+ v_country
40
+ FROM rb_acct a, fm_client b
41
+ WHERE a.client_no = b.client_no AND acct_no = p_acct;
42
+ EXCEPTION
43
+ WHEN OTHERS
44
+ THEN
45
+ BEGIN
46
+ SELECT internal_key,
47
+ a.client_no,
48
+ b.client_type,
49
+ b.global_id_type,
50
+ b.client_name,
51
+ b.country_citizen
52
+ INTO v_acct_internal_key,
53
+ v_client_no,
54
+ v_client_type,
55
+ v_id_type,
56
+ v_dbtr_name,
57
+ v_country
58
+ FROM rb_acct a, fm_client b
59
+ WHERE a.client_no = b.client_no
60
+ AND b.client_no = p_acct
61
+ AND ROWNUM = 1;
62
+ EXCEPTION
63
+ WHEN OTHERS
64
+ THEN
65
+ p_error_code := '300395'; -- invalid client number;
66
+ RETURN FALSE;
67
+ END;
68
+ END;
69
+
70
+ v_step := '2';
71
+
72
+ IF v_id IS NULL OR v_id = ''
73
+ THEN
74
+ BEGIN
75
+ IF v_client_type = '1'
76
+ THEN
77
+ SELECT NVL (national_id, '0')
78
+ INTO v_id_nid
79
+ FROM fm_client_indvl
80
+ WHERE client_no = v_client_no;
81
+ ELSE
82
+ SELECT NVL (corporation_id, '0')
83
+ INTO v_id_cor
84
+ FROM fm_client_corporate
85
+ WHERE client_no = v_client_no;
86
+ END IF;
87
+ EXCEPTION
88
+ WHEN NO_DATA_FOUND
89
+ THEN
90
+ v_step := '3';
91
+
92
+ BEGIN
93
+ SELECT NVL (global_id, '0')
94
+ INTO v_id
95
+ FROM fm_client
96
+ WHERE client_no = v_client_no;
97
+
98
+ IF v_client_type = '1'
99
+ THEN
100
+ v_id_nid := v_id;
101
+ ELSE
102
+ v_id_cor := v_id;
103
+ END IF;
104
+ EXCEPTION
105
+ WHEN OTHERS
106
+ THEN
107
+ p_error_code := '104045';
108
+ RETURN FALSE;
109
+ END;
110
+ END;
111
+
112
+ v_step := '4';
113
+
114
+ IF v_client_type = '1'
115
+ THEN
116
+ IF v_id_type = 'FIN'
117
+ OR (v_id_type = 'PPT' AND v_country <> 'IR')
118
+ THEN
119
+ v_step := '5';
120
+
121
+ SELECT NVL (global_id, '0')
122
+ INTO v_id
123
+ FROM fm_client
124
+ WHERE client_no = v_client_no;
125
+
126
+ v_id := SUBSTR (v_id, 1, 15);
127
+ ELSE
128
+ v_step := '6';
129
+ v_check_national_id := validate_national_id (v_id_nid);
130
+
131
+ IF v_check_national_id IS NULL
132
+ OR v_check_national_id <> '829204'
133
+ THEN
134
+ v_id := v_id_nid;
135
+ ELSE
136
+ p_error_code := '104045';
137
+ RETURN FALSE;
138
+ END IF;
139
+ END IF;
140
+ ELSE
141
+ v_step := '7';
142
+ v_check_corporation_id := validate_cor_id (v_id_cor);
143
+
144
+ IF v_check_corporation_id IS NULL
145
+ OR v_check_corporation_id <> '829205'
146
+ THEN
147
+ v_id := v_id_cor;
148
+ ELSE
149
+ p_error_code := '104045';
150
+ RETURN FALSE;
151
+ END IF;
152
+ END IF;
153
+ ELSE
154
+ v_step := '8';
155
+
156
+ --v_id := p_id;
157
+
158
+ IF v_client_type = '1'
159
+ THEN
160
+ IF v_id_type = 'FIN'
161
+ OR (v_id_type = 'PPT' AND v_country <> 'IR')
162
+ THEN
163
+ NULL;
164
+ ELSE
165
+ v_step := '9';
166
+ v_check_national_id := validate_national_id (v_id);
167
+
168
+ IF v_check_national_id = '829204'
169
+ THEN
170
+ p_error_code := '104045';
171
+ p_error_desc :=
172
+ error_desc (NVL (p_error_code, '000000'));
173
+ RETURN FALSE;
174
+ END IF;
175
+ END IF;
176
+ ELSE
177
+ v_step := '10';
178
+ v_check_corporation_id := validate_cor_id (v_id);
179
+
180
+ IF NVL (v_check_corporation_id, '~') = '829205'
181
+ THEN
182
+ p_error_code := '104045';
183
+ p_error_desc := error_desc (NVL (p_error_code, '000000'));
184
+ RETURN FALSE;
185
+ END IF;
186
+ END IF;
187
+ END IF;
188
+
189
+ BEGIN
190
+ IF v_client_type = '1'
191
+ THEN
192
+ SELECT NVL (national_id, '0')
193
+ INTO v_id_nid
194
+ FROM fm_client_indvl
195
+ WHERE client_no = v_client_no AND national_id = v_id;
196
+ ELSE
197
+ SELECT NVL (corporation_id, '0')
198
+ INTO v_id_cor
199
+ FROM fm_client_corporate
200
+ WHERE client_no = v_client_no AND corporation_id = v_id;
201
+ END IF;
202
+ EXCEPTION
203
+ WHEN NO_DATA_FOUND
204
+ THEN
205
+ v_step := '3';
206
+
207
+ /*BEGIN
208
+ SELECT NVL (global_id, '0')
209
+ INTO v_id
210
+ FROM fm_client
211
+ WHERE client_no = v_client_no;
212
+
213
+ IF v_client_type = '1'
214
+ THEN
215
+ v_id_nid := v_id;
216
+ ELSE
217
+ v_id_cor := v_id;
218
+ END IF;
219
+ EXCEPTION
220
+ WHEN OTHERS
221
+ THEN*/
222
+ p_error_code := '111221';
223
+ RETURN FALSE;
224
+ --END;
225
+ END;
226
+
227
+
228
+
229
+ P_id := v_id;
230
+ p_error_desc := error_desc (NVL (p_error_code, '000000'));
231
+
232
+ IF NVL (p_error_code, 0) = 0
233
+ THEN
234
+ p_error_code := '000000';
235
+ END IF;
236
+
237
+ RETURN TRUE;
238
+ EXCEPTION
239
+ WHEN OTHERS
240
+ THEN
241
+ BEGIN
242
+ /*IF p_error_code IN (0, '000000')
243
+ THEN
244
+ p_error_code := '000000';
245
+ p_error_desc := error_desc (p_error_code);
246
+ ELS*/
247
+ IF p_error_code NOT IN (0, '000000')
248
+ AND p_error_code IS NOT NULL
249
+ THEN
250
+ p_error_desc := error_desc (p_error_code);
251
+ ELSE
252
+ p_error_code := SQLCODE;
253
+ p_error_desc := SQLERRM;
254
+ END IF;
255
+ END;
256
+
257
+ ROLLBACK;
258
+
259
+ insert_log (
260
+ p_acct,
261
+ p_id, --v_seq_no_coi,
262
+ 'CL_OPENBANKING',
263
+ 'VALIDATION',
264
+ SQLCODE,
265
+ 'CL',
266
+ 'step : ['
267
+ || v_step
268
+ || ']'
269
+ || ' SQLCODE : ['
270
+ || p_error_code
271
+ || ']'
272
+ || ' SQLERRM : ['
273
+ || p_error_desc
274
+ || ']');
275
+ END validation;