0% found this document useful (0 votes)
7 views22 pages

TD Issue Logs

The document outlines the implementation of a package body for handling card interactions, including procedures for debugging, requesting PINs, and simulating time deposits. It includes error handling and database interactions to manage customer data and card management events. The procedures are designed to ensure data integrity and provide feedback on processing outcomes.

Uploaded by

jgrrajujgr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views22 pages

TD Issue Logs

The document outlines the implementation of a package body for handling card interactions, including procedures for debugging, requesting PINs, and simulating time deposits. It includes error handling and database interactions to manage customer data and card management events. The procedures are designed to ensure data integrity and provide feedback on processing outcomes.

Uploaded by

jgrrajujgr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 22

CREATE OR REPLACE PACKAGE BODY cdpks_obdx_cd_interactions IS

--
-- Purpose: Briefly explain the functionality of the package body
--
-- MODIFICATION HISTORY
-- Person Date Comments
-- --------- ------ ------------------------------------------
-- Enter procedure, function bodies as shown below

PROCEDURE dbg (p_msg IN varchar2) IS


BEGIN
dbms_output.put_line('cdpks_obdx_cd_interactions =>'||p_msg);
--debug.pr_debug(module=> 'AC', line=> 'cdpks_obdx_cd_interactions =>'||
p_msg);
EXCEPTION
WHEN others THEN
null;
END;

/* procedure pr_request_pin(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_delivery_branch in varchar2,
p_method in varchar2 default 'S',
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_add_fname fccchms.cdtb_card_mgmt_events.add_first_name%type;
l_add_lname fccchms.cdtb_card_mgmt_events.add_last_name%type;
l_count number;
l_card cdtb_card_persons.card_no%type;
l_mobile cdtb_card_persons.phone_no%type;
l_method varchar2(3) := 'NO';
l_national_id varchar2(100);
l_reissue_pin varchar2(3) := 'Y';
begin
global.pr_init(p_branch_code, 'MANREKA');
p_err_param:=null;
p_err_code:=null;
select
a.first_name_on_card,
a.last_name_on_card
into
l_add_fname,
l_add_lname
from
fccchms.cdtb_card_persons a
where
card_ref_no = p_card_ref_no
and cust_no = p_cust_no
and card_seq = p_card_seq;

select
count(1)
into
l_count
from
fccchms.cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = 'P'
and action = 'R'
and status = 'R'
and record_stat='O';
if l_count > 0 then
p_err_code := 'ER-RP02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TO_CHAR (GLOBAL.application_date,


'YYDDD')|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL, '0000'));
insert into fccchms.cdtb_card_mgmt_events (
reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'P', 'R',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y',p_method, p_delivery_branch,
p_cust_no, l_add_fname, l_add_lname, l_appli_id);

select
nvl(b.p_national_id, c.c_national_id)
into
l_national_id
from
sttm_customer a,
sttm_cust_personal b,
sttm_cust_corporate c
where
a.customer_no = b.customer_no(+)
and a.customer_no = c.customer_no(+)
and a.customer_no = p_cust_no
and a.record_stat='O';

select
card_no, phone_no
into
l_card, l_mobile
from
cdtb_card_persons
where card_ref_no=p_card_ref_no
and cust_no=p_cust_no
and card_seq = p_card_seq;
dbg ('l_mobile: '||l_mobile);

--fccchms.cdpks_paylink.pr_generate_av(l_card, l_mobile, p_method,


l_national_id, p_card_ref_no,l_reissue_pin);

EXCEPTION
when no_data_found then
p_err_code := 'ER-RP01';
p_err_param := 'There was a problem with the application';
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
p_err_code := 'ER-RP00';
p_err_param := 'There was some problem processing the request';
end;
*/

function fn_simmulate_td(
p_account_class in varchar2,
p_customer_no in varchar2,
p_ccy in varchar2,
p_start_date in date,
p_amount in number,
p_language in varchar2,
p_rates out varchar2,
p_conditions out varchar2,
p_mat_amt out number,
p_mat_date out date,
p_err_code out varchar2,
p_err_param out varchar2
) return varchar2 is
l_prod varchar2(10);
begin
if p_account_class = 'DIGI35' then
if p_language = 'ALB' then
p_conditions := '1. Normat e interesit te depozitave: Janë të shprehura
me bazë vjetore (365 ose 366 ditë).' || chr(13) ||
'2. Mënyra e llogaritjes së interesit: InteresiBruto =
(Shuma e depozitës * norma e interesit * numrin e ditëve) / 365 (ose 366) ditë.' ||
chr(13) ||
'3. Interesi i depozitave 35-mujore përfitoh...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
else
p_conditions := '1. Interest rates for deposits are expressed on an
annual basis (365 or 366 days).' || chr(13) ||
'2. Interest calculation method: GrossInterest =
(Deposit amount * interest rate * number of days) / 365 (or 366) days.' || chr(13)
||
'3. 35-month deposit interest is earned at the end of
the period. If the deposit is canceled within 12 months, no interest is earned.
After 12 months...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
end if;
elsif p_account_class = 'DIGI25' then
if p_language = 'ALB' then
p_conditions := '1. Normat e interesit te depozitave: Janë të shprehura
me bazë vjetore (365 ose 366 ditë).' || chr(13) ||
'2. Mënyra e llogaritjes së interesit: InteresiBruto =
(Shuma e depozitës * norma e interesit * numrin e ditëve) / 365 (ose 366) ditë.' ||
chr(13) ||
'3. Interest for the 25-month deposit...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
else
p_conditions := '1. Interest rates for deposits are expressed on an
annual basis (365 or 366 days).' || chr(13) ||
'2. Interest calculation method: GrossInterest =
(Deposit amount * interest rate * number of days) / 365 (or 366) days.' || chr(13)
||
'3. Interest for the 25-month deposit...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
end if;
else
if p_language = 'ALB' then
p_conditions := '1. Normat e interesit te depozitave: Janë të shprehura
me bazë vjetore (365 ose 366 ditë).' || chr(13) ||
'2. Mënyra e llogaritjes së interesit: InteresiBruto =
(Shuma e depozitës * norma e interesit * numrin e ditëve) / 365 (ose 366) ditë.' ||
chr(13) ||
'3. Standard deposits do not earn interest...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
else
p_conditions := '1. Interest rates for deposits are expressed on an
annual basis (365 or 366 days).' || chr(13) ||
'2. Interest calculation method: GrossInterest =
(Deposit amount * interest rate * number of days) / 365 (or 366) days.' || chr(13)
||
'3. Standard deposits do not earn interest...';
p_rates := '3.2%';
p_mat_amt := 317498.589041096;
p_mat_date := TO_DATE('03/05/2026', 'DD/MM/YYYY');
end if;
end if;

return 'SUCCESS';
end fn_simmulate_td;

procedure pr_request_pin(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_delivery_branch in varchar2,
p_method in varchar2 default 'S',
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_add_fname cdtb_card_mgmt_events.add_first_name%type;
l_add_lname cdtb_card_mgmt_events.add_last_name%type;
l_count number;
l_card cdtb_card_persons.card_no%type;
l_mobile cdtb_card_persons.phone_no%type;
l_method varchar2(3) := 'YES';
l_national_id varchar2(100);
l_reissue_pin varchar2(3) := 'Y';
begin
--global.pr_init(p_branch_code, 'MANREKA');
p_err_param:=null;
p_err_code:=null;

select
a.first_name_on_card,
a.last_name_on_card
into
l_add_fname,
l_add_lname
from
cdtb_card_persons a
where
card_ref_no = p_card_ref_no
and cust_no = p_cust_no
and card_seq = p_card_seq;

select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = 'P'
and action = 'R'
and status = 'R'
and record_stat='O';

if l_count > 0 then


p_err_code := 'ER-RP02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

insert into cdtb_card_mgmt_events (


reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'P', 'R',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', decode(l_method,'YES','S','E'),
p_delivery_branch,
p_cust_no, l_add_fname, l_add_lname, l_appli_id);

select
nvl(b.p_national_id, c.c_national_id)
into
l_national_id
from
FLEXC146.sttm_customer a,
FLEXC146.sttm_cust_personal b,
FLEXC146.sttm_cust_corporate c
where
a.customer_no = b.customer_no(+)
and a.customer_no = c.customer_no(+)
and a.customer_no = p_cust_no
and a.record_stat='O';

select
card_no, phone_no
into
l_card, l_mobile
from
cdtb_card_persons
where card_ref_no=p_card_ref_no
and cust_no=p_cust_no
and card_seq = p_card_seq;

dbg ('l_mobile: '||l_mobile);

--cdpks_paylink.pr_generate_av(l_card, l_mobile, l_method,


l_national_id, p_card_ref_no,l_reissue_pin);

EXCEPTION
when no_data_found then
p_err_code := 'ER-RP01';
p_err_param := 'There was a problem with the application';
WHEN others THEN
p_err_code := 'ER-RP00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_request_pin(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_delivery_branch in varchar2,
--p_method in varchar2 default 'S',
p_err_code out varchar2,
p_err_param out varchar2) is
l_req_ref_no varchar2(20);
begin
pr_request_pin(
p_customer_no => p_customer_no,
p_branch_code => p_branch_code,
p_card_ref_no => p_card_ref_no,
p_cust_no => p_cust_no,
p_card_seq => p_card_seq,
p_delivery_branch => p_delivery_branch,
-- p_method => p_method,
p_req_ref_no => l_req_ref_no,
p_err_code => p_err_code,
p_err_param => p_err_param);
end;

procedure pr_request_pin_22(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_delivery_branch in varchar2,
p_method in varchar2 default 'S',
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_add_fname cdtb_card_mgmt_events.add_first_name%type := 'SHIVA';
l_add_lname cdtb_card_mgmt_events.add_last_name%type := 'S';
l_count number;
l_card cdtb_card_persons.card_no%type;
l_mobile cdtb_card_persons.phone_no%type;
l_method varchar2(3) := p_method;
l_national_id varchar2(100);
l_reissue_pin varchar2(3) := 'Y';
begin
--global.pr_init(p_branch_code, 'MANREKA');
p_err_param:=null;
p_err_code:=null;

select
a.first_name_on_card,
a.last_name_on_card
into
l_add_fname,
l_add_lname
from
cdtb_card_persons a
where
card_ref_no = p_card_ref_no
and cust_no = p_cust_no
and card_seq = p_card_seq;

select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = 'P'
and action = 'R'
and status = 'R'
and record_stat='O';

if l_count > 0 then


p_err_code := 'ER-RP02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

insert into cdtb_card_mgmt_events (


reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'P', 'R',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', l_method, p_delivery_branch,
p_cust_no, l_add_fname, l_add_lname, l_appli_id);

select
nvl(b.p_national_id, c.c_national_id)
into
l_national_id
from
FLEXC146.sttm_customer a,
FLEXC146.sttm_cust_personal b,
FLEXC146.sttm_cust_corporate c
where
a.customer_no = b.customer_no(+)
and a.customer_no = c.customer_no(+)
and a.customer_no = p_cust_no
and a.record_stat='O';

select
card_no, phone_no
into
l_card, l_mobile
from
cdtb_card_persons
where card_ref_no=p_card_ref_no
and cust_no=p_cust_no
and card_seq = p_card_seq;

dbg ('l_mobile: '||l_mobile);

--fccchms.cdpks_paylink.pr_generate_av(l_card, l_mobile, l_method,


l_national_id, p_card_ref_no,l_reissue_pin);

EXCEPTION
when no_data_found then
p_err_code := 'ER-RP01';
p_err_param := 'There was a problem with the application';
WHEN others THEN
p_err_code := 'ER-RP00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_block_card(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_reason in varchar2, --D/L/S
p_new_card in char, --Y/N
p_delivery_branch in varchar2,
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_action_type cdtb_card_mgmt_events.action_type%type;
l_action cdtb_card_mgmt_events.action%type;
l_count number;
l_first_name varchar2(105) := 'SHIVA';
l_last_name varchar2(105) := 'S';
--POSMS
l_posms boolean:= false;
l_card cdtb_card_persons.card_no%type;
l_mobile cdtb_card_persons.phone_no%type;
l_reissue_pin varchar2(3) := 'N';
l_national_id varchar2(100);
l_method varchar2(3):='YES';

begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;

if p_new_card = 'N' then


if p_reason not in ('L', 'S') then
l_action_type := 'C';
l_action := 'B';
else
l_action_type := 'C';
l_action := 'S';
end if;
else
if p_reason not in ('L', 'S') then
l_action_type := 'C';--'L' Nuk Do te behen me requeste Reissue
Card/Plastic fxhelili
l_action := 'L'; --'R'
l_posms:=true;
elsif p_reason in ('L', 'S') then
l_action_type := 'C';
l_action := 'L';
l_posms:=true;
end if;
end if;

select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = l_action_type
and action = l_action
and record_stat='O'
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-BL02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

insert into cdtb_card_mgmt_events (


reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, l_action_type,
l_action,
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'S' -- 'E' fxhelili method POSMS
, nvl(p_delivery_branch, p_branch_code),
p_cust_no, l_first_name, l_last_name, l_appli_id);

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

if l_action_type = 'C' and l_action = 'L' then


insert into cdtb_card_mgmt_events (
reference_no,
customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'P', 'N',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'S', --'E' fxhelili method POSMS
nvl(p_delivery_branch, p_branch_code),
p_cust_no, l_first_name, l_last_name, l_appli_id);
end if;

dbg('Before POSMS');

if l_posms then
dbg('Entered for POSMS');
dbg('l_national_id => ' || l_national_id || ' l_card=> '||l_card||'
l_mobile=> '|| l_mobile);

select
nvl(b.p_national_id, c.c_national_id)
into
l_national_id
from
FLEXC146.sttm_customer a,
FLEXC146.sttm_cust_personal b,
FLEXC146.sttm_cust_corporate c
where
a.customer_no = b.customer_no(+)
and a.customer_no = c.customer_no(+)
and a.customer_no = p_cust_no
and a.record_stat='O';

select
card_no, phone_no
into
l_card, l_mobile
from
cdtb_card_persons
where card_ref_no=p_card_ref_no
and cust_no=p_cust_no
and card_seq = p_card_seq;

dbg('l_national_id => ' || l_national_id || ' l_card=> '||l_card||'


l_mobile=> '|| l_mobile);

--fccchms.cdpks_paylink.pr_generate_av(l_card, l_mobile, l_method,


l_national_id, p_card_ref_no,l_reissue_pin);
end if;

EXCEPTION
WHEN others THEN
p_err_code := 'ER-BL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_temp_block_card(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_reason in varchar2, --D/L/S
p_new_card in char, --Y/N
p_delivery_branch in varchar2,
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_action_type cdtb_card_mgmt_events.action_type%type;
l_action cdtb_card_mgmt_events.action%type;
l_count number;
l_first_name varchar2(105) := 'SHIVA';
l_last_name varchar2(105) := 'S';

begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;

if p_new_card = 'N' then


if p_reason not in ('L', 'S') then
l_action_type := 'C';
l_action := 'B';
else
l_action_type := 'C';
l_action := 'S';
end if;
else
if p_reason not in ('L', 'S') then
l_action_type := 'C';--'L' Nuk Do te behen me requeste Reissue
Card/Plastic fxhelili
l_action := 'L'; --'R'
elsif p_reason in ('L', 'S') then
l_action_type := 'C';
l_action := 'L';
end if;
end if;

select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = l_action_type
and action = l_action
and record_stat='O'
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-BL02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));
insert into cdtb_card_mgmt_events (
reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, l_action_type,
l_action,
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', nvl(p_delivery_branch, p_branch_code),
p_cust_no, l_first_name, l_last_name, l_appli_id);

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

if l_action_type = 'C' and l_action = 'L' then


insert into cdtb_card_mgmt_events (
reference_no,
customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'P', 'N',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', nvl(p_delivery_branch,
p_branch_code),
p_cust_no, l_first_name, l_last_name, l_appli_id);
end if;

EXCEPTION
WHEN others THEN
p_err_code := 'ER-BL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_unblock_card(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_req_ref_no out varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_action_type cdtb_card_mgmt_events.action_type%type;
l_action cdtb_card_mgmt_events.action%type;
l_count number;
l_first_name varchar2(105) := 'SHIVA';
l_last_name varchar2(105) := 'S';

begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and action_type = 'C'
and record_stat='O'
and action = 'U'
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-BL02';
p_err_param := 'There same request already exists';
return;
end if;

p_req_ref_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR (CDSQ_ALL.NEXTVAL,


'0000'));

insert into cdtb_card_mgmt_events (


reference_no, customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, add_first_name, add_last_name, last_name_on_card)
values(
p_req_ref_no, p_customer_no, p_card_ref_no, p_card_seq, 'C', 'U',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', p_branch_code,
p_cust_no, l_first_name, l_last_name, l_appli_id);

EXCEPTION
WHEN others THEN
p_err_code := 'ER-BL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_update_email_statement (
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_e_mail_stmt in varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
update cdtb_card_data set e_mail_stmt = p_e_mail_stmt where card_ref_no =
p_card_ref_no;

EXCEPTION
WHEN others THEN
p_err_code := 'ER-BL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_block_card(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_reason in varchar2,
p_new_card in char,
p_delivery_branch in varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_req_ref_no varchar2(20);
begin
pr_block_card(
p_customer_no => p_customer_no,
p_branch_code => p_branch_code,
p_card_ref_no => p_card_ref_no,
p_cust_no => p_cust_no,
p_card_seq => p_card_seq,
p_reason => p_reason,
p_new_card => p_new_card,
p_delivery_branch => p_delivery_branch,
p_req_ref_no => l_req_ref_no,
p_err_code => p_err_code,
p_err_param => p_err_param);
end;

procedure pr_temp_block_card(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_reason in varchar2,
p_new_card in char,
p_delivery_branch in varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_req_ref_no varchar2(20);
begin
pr_temp_block_card(
p_customer_no => p_customer_no,
p_branch_code => p_branch_code,
p_card_ref_no => p_card_ref_no,
p_cust_no => p_cust_no,
p_card_seq => p_card_seq,
p_reason => p_reason,
p_new_card => p_new_card,
p_delivery_branch => p_delivery_branch,
p_req_ref_no => l_req_ref_no,
p_err_code => p_err_code,
p_err_param => p_err_param);
end;

procedure pr_set_internet_limit(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_internet_limit in number,
p_err_code out varchar2,
p_err_param out varchar2) is
l_reference_no varchar2(50) := '';
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_count number;
begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
if p_internet_limit >= 0 then
if p_internet_limit > 0 then
update cdtb_card_data set internet_use = 'Y' where card_ref_no =
p_card_ref_no;
else
update cdtb_card_data set internet_use = 'N' where card_ref_no =
p_card_ref_no;
end if;
select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and record_stat='O'
and action_type = 'C'
and action = 'I'
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-IL02';
p_err_param := 'There same request already exists';
return;
end if;

l_reference_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR


(CDSQ_ALL.NEXTVAL, '0000'));
insert into cdtb_card_mgmt_events (
reference_no,
customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, first_name_on_card, last_name_on_card)
values(
l_reference_no, p_customer_no, p_card_ref_no, p_card_seq, 'C', 'I',
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', p_branch_code,
p_cust_no, p_internet_limit, l_appli_id);
elsif p_internet_limit = -1 then
update cdtb_card_data set internet_use = 'Y' where card_ref_no =
p_card_ref_no;
end if;
-- commit;
EXCEPTION
WHEN others THEN
p_err_code := 'ER-IL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_set_cash_limit(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_cash_limit in number,
p_err_code out varchar2,
p_err_param out varchar2) is
l_reference_no varchar2(50) := '';
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_count number;
begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
if p_cash_limit >= 0 then
select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and record_stat='O'
and action_type = 'C'
and action = 'X' ---Cash
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-IL02';
p_err_param := 'There same request already exists';
return;
end if;
l_reference_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR
(CDSQ_ALL.NEXTVAL, '0000'));
insert into cdtb_card_mgmt_events (
reference_no,
customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, first_name_on_card, last_name_on_card)
values(
l_reference_no, p_customer_no, p_card_ref_no, p_card_seq, 'C',
'X' /*CASH*/,
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', p_branch_code,
p_cust_no, p_cash_limit, l_appli_id);
else
p_err_code := 'ER-IL00';
p_err_param := 'There was some problem processing the request';
end if;
-- commit;
EXCEPTION
WHEN others THEN
p_err_code := 'ER-IL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_set_POS_limit(
p_customer_no in varchar2,
p_branch_code in varchar2,
p_card_ref_no in varchar2,
p_cust_no in varchar2,
p_card_seq in varchar2,
p_POS_limit in number,
p_err_code out varchar2,
p_err_param out varchar2) is
l_reference_no varchar2(50) := '';
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_count number;
begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
if p_POS_limit >= 0 then
select
count(1)
into
l_count
from
cdtb_card_mgmt_events
where
card_ref_no = p_card_ref_no
and customer_no = p_customer_no
and add_cust_no = p_cust_no
and card_holder = p_card_seq
and record_stat='O'
and action_type = 'C'
and action = 'P' --POS
and status = 'R';

if l_count > 0 then


p_err_code := 'ER-IL02';
p_err_param := 'There same request already exists';
return;
end if;

l_reference_no := p_branch_code||'CDAC'|| TRIM (TO_CHAR


(cdsq_pl_appli.NEXTVAL, '0000'));
insert into cdtb_card_mgmt_events (
reference_no,
customer_no,card_ref_no,card_holder,action_type,action,
status,branch_code,agency,record_stat,mod_no,maker_id,checker_id,

maker_dt_stamp,checker_dt_stamp,auth_stat,once_auth,method,delivery_agency,
add_cust_no, first_name_on_card, last_name_on_card)
values(
l_reference_no, p_customer_no, p_card_ref_no, p_card_seq, 'C',
'P' /*POS*/,
'R', p_branch_code, p_branch_code, 'O', 1, 'FCATOP', 'FCATOP',
sysdate, sysdate, 'A', 'Y', 'E', p_branch_code,
p_cust_no, p_POS_limit, l_appli_id);
else
p_err_code := 'ER-IL00';
p_err_param := 'There was some problem processing the request';
end if;
-- commit;
EXCEPTION
WHEN others THEN
p_err_code := 'ER-IL00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_set_auto_pay(
p_card_ref_no in varchar2,
p_auto_pay in char /*N/M/F*/,
p_auto_pay_account in varchar2,
p_err_code out varchar2,
p_err_param out varchar2) is
l_reference_no varchar2(50) := '';
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_count number;
begin
--global.pr_init('110', 'FCATOP');
p_err_param:=null;
p_err_code:=null;
select
count(1)
into
l_count
from
cdtb_card_data
where
card_ref_no = p_card_ref_no
and status = 'Pending';

if l_count > 0 then


p_err_code := 'ER-AP02';
p_err_param := 'There same request already exists';
return;
end if;

select
count(1)
into
l_count
from
cdtb_card_data
where
card_ref_no = p_card_ref_no
and record_stat = 'O'
and auth_stat = 'A';

if l_count = 0 then
p_err_code := 'ER-AP03';
p_err_param := 'User card data not found';
return;
end if;

if p_auto_pay = 'N' then


update cdtb_card_data set stand_ord_flag = 'N', status = 'Pending',
maker_id = 'FCATOP', checker_id = 'FCATOP', maker_dt_stamp = sysdate,
checker_dt_stamp = sysdate, mod_no = mod_no + 1 where card_ref_no = p_card_ref_no;
else
select
count(1)
into
l_count
from
FLEXC146.sttm_cust_account p,
cdtb_card_data q
where
p.account_type = 'U'
and p.account_class <> 'CDCARD'
and p.record_stat = 'O'
and p.cust_no = q.customer_no
and q.card_ref_no = p_card_ref_no;
if l_count = 0 then
p_err_code := 'ER-AP01';
p_err_param := 'This account cannot be used for Auto Pay';
return;
end if;
if p_auto_pay = 'M' then
update cdtb_card_data set stand_ord_flag = 'Y', stand_ord_type =
'M', cust_ac_no_1 = p_auto_pay_account, status = 'Pending', maker_id = 'FCATOP',
checker_id = 'FCATOP', maker_dt_stamp = sysdate, checker_dt_stamp = sysdate, mod_no
= mod_no + 1 where card_ref_no = p_card_ref_no;
elsif p_auto_pay = 'F' then
update cdtb_card_data set stand_ord_flag = 'Y', stand_ord_type =
'F', cust_ac_no_1 = p_auto_pay_account, status = 'Pending', maker_id = 'FCATOP',
checker_id = 'FCATOP', maker_dt_stamp = sysdate, checker_dt_stamp = sysdate, mod_no
= mod_no + 1 where card_ref_no = p_card_ref_no;
end if;
-- commit;
end if;
exception
WHEN others THEN
p_err_code := 'ER-AP00';
p_err_param := 'There was some problem processing the request';
end;

procedure pr_req_add_card(
p_card_ref_no in varchar2,
p_add_nat_id in varchar2,
p_name_on_card in varchar2,
p_father_name in varchar2,
p_date_of_birth in date,
p_credit_limit in number,
p_ecomerce_limit in number,
p_err_code out varchar2,
p_err_param out varchar2) is
l_reference_no varchar2(50) := '';
l_appli_id cdtb_card_mgmt_events.last_name_on_card%type :=
cdsq_pl_appli.NEXTVAL;
l_cust_no FLEXC146.sttm_customer.customer_no%type;
l_card_seq cdtb_card_persons.card_seq%type;
l_first_name cdtb_card_persons.first_name_on_card%type;
l_last_name cdtb_card_persons.last_name_on_card%type;
l_phone_no cdtb_card_persons.phone_no%type;
l_count number;
begin
--global.pr_init('110', 'FCATOP');
begin
select
a.customer_no, b.first_name, b.last_name,
decode(substr(b.mobile_number, 1, 2), '67', '355', '68', '355', '69', '355', '')||
b.mobile_number mobile_no
into
l_cust_no, l_first_name, l_last_name, l_phone_no
from
FLEXC146.sttm_customer a,
FLEXC146.sttm_cust_personal b
where
a.customer_no = b.customer_no
and a.record_stat = 'O'
and b.p_national_id = p_add_nat_id;
exception
when no_data_found then
p_err_code := 'ER-AC01';
p_err_param := 'The person with National ID '||p_add_nat_id||' has
not been registered in the bank!';
return;
end;

if upper(translate(l_first_name||l_last_name, 'a ', 'a')) <>


upper(translate(p_name_on_card, 'a ', 'a')) then
p_err_code := 'ER-AC04';
p_err_param := 'The given name does not match with the customer name';
return;
end if;

select
count(1)
into
l_count
from
cdtb_card_persons
where
card_ref_no = p_card_ref_no
and cust_no = l_cust_no
and processed = 'N';

if l_count > 0 then


p_err_code := 'ER-AC02';
p_err_param := 'There same request already exists';
return;
end if;

begin
select
max(card_seq) + 1
into
l_card_seq
from
cdtb_card_persons
where
card_ref_no = p_card_ref_no;
exception
when no_data_found then
l_card_seq := 1;
end;
insert into cdtb_card_persons values (p_card_ref_no, l_cust_no,
l_first_name, l_last_name, null, null, l_card_seq, null, 'Y', 'N', 'S',
l_phone_no);
for rec in (
select b.*
from
cdtb_card_data a,
cdtb_card_accounts b
where
a.card_ref_no = p_card_ref_no
and a.card_ref_no = b.card_ref_no
and a.customer_no = b.cust_no
and b.card_seq = 1) loop
insert into cdtb_card_accounts values (rec.card_ref_no, l_cust_no,
rec.branch_code, rec.cust_ac_no, rec.ccy, l_card_seq, rec.def_atm, rec.def_pos,
rec.open, 'N');
end loop;

update cdtb_card_data set status = 'Pending', ANNUAL_FEE_FIRST_TYP =


decode(ccy_code, '02', '02', null),card_delivery_flag='S' --fxhelili posms
where card_ref_no = p_card_ref_no;

p_err_param:=null;
p_err_code:=null;
EXCEPTION
WHEN others THEN
p_err_code := 'ER-AC00';
p_err_param := 'There was some problem processing the request';
end;

END cdpks_obdx_cd_interactions;

You might also like