FUNCTIONisauthforeft(inpersonidINNUMBER,incustomertypecodeINVARCHAR2,inauthtypecodeINVARCHAR2,indateINDATE,inIncludePendingINVARCHAR2)RETURNNUMBERASv_paymentauthorizationseqnumNUMBER:=0;v_returnNUMBER:=-10;v_pending_flagNUMBER:=0;CURSORgeteftauthISSELECTpayment_authorization_seq_numFROMpayment_authorizationJOINbank_accountusing(bank_account_seq_num)WHEREcustomer_second_id=TO_CHAR(inpersonid)ANDcustomer_type_code=incustomertypecodeANDauthorization_type_code=inauthtypecodeANDtrunc(auth_date)<=indateANDrevoke_dateISNULLAND(v_pending_flag=1OR(v_pending_flag=0ANDbank_account_status_codein('NEW','VALID')AND(prenote_required_flag='N'ORprenote_required_flag='Y'andprenote_success_dateisnotnull)));BEGINIFinIncludePending='TRUE'THENv_pending_flag:=1;ENDIF;OPENgeteftauth;FETCHgeteftauthINTOv_paymentauthorizationseqnum;IFgeteftauth%FOUNDTHENv_return:=v_paymentauthorizationseqnum;ENDIF;CLOSEgeteftauth;RETURNv_return;END;FUNCTIONisauthorizedforeft(inclaimnumINVARCHAR2,inpersonidINNUMBER,incustomertypecodeINVARCHAR2,inauthtypecodeINVARCHAR2,indateINDATE:=SYSDATE,inIncludePendingINVARCHAR2:='FALSE')RETURNNUMBERAS-- create and initialize local variablesv_returnNUMBER:=-40;BEGINv_return:=isauthforeft(inpersonid,incustomertypecode,inauthtypecode,indate,inIncludePending);RETURNv_return;END;FUNCTIONisauthorizedforeft(inclaimidINNUMBER,inpersonidINNUMBER,incustomertypecodeINVARCHAR2,inauthtypecodeINVARCHAR2,indateINDATE:=SYSDATE,inIncludePendingINVARCHAR2:='FALSE')RETURNNUMBERAS-- create and initialize local variablesv_returnNUMBER:=-50;BEGINv_return:=isauthforeft(inpersonid,incustomertypecode,inauthtypecode,indate,inIncludePending);RETURNv_return;END;FUNCTIONisbeneficiaryauthforeft(inbeneidINNUMBER,inauthtypecodeINVARCHAR2,indateINDATE:=SYSDATE)RETURNNUMBERASv_paymentauthorizationseqnumNUMBER:=0;v_returnNUMBER:=-222;CURSORgeteftauthISSELECTpayment_authorization_seq_numFROMpayment_authorizationJOINbank_accountusing(bank_account_seq_num)WHEREcustomer_second_id=TO_CHAR(inbeneid)ANDauthorization_type_code=inauthtypecodeANDtrunc(auth_date)<=indateANDrevoke_dateISNULLANDbank_account_status_codein('NEW','VALID');BEGINOPENgeteftauth;FETCHgeteftauthINTOv_paymentauthorizationseqnum;IFgeteftauth%FOUNDTHENv_return:=v_paymentauthorizationseqnum;ENDIF;CLOSEgeteftauth;RETURNv_return;END;FUNCTIONisproviderauthforeft(inprovidernumINNUMBER,incustomertypecodeINVARCHAR2:='PROV',inauthtypecodeINVARCHAR2:='PRDD',indateINDATE:=SYSDATE,inIncludePendingINVARCHAR2)RETURNNUMBERAS-- create and initialize local variablesv_paymentauthorizationseqnumNUMBER:=0;v_returnNUMBER:=-55;v_pending_flagNUMBER:=0;CURSORgeteftauthISSELECTpayment_authorization_seq_numFROMpayment_authorizationJOINbank_accountusing(bank_account_seq_num)WHEREcustomer_id=TO_CHAR(inprovidernum)ANDcustomer_type_code=incustomertypecodeANDauthorization_type_code=inauthtypecodeANDtrunc(auth_date)<=indateANDrevoke_dateISNULLAND(v_pending_flag=1OR(v_pending_flag=0ANDbank_account_status_codein('NEW','VALID')AND(prenote_required_flag='N'ORprenote_required_flag='Y'andprenote_success_dateisnotnull)));BEGINIFinIncludePending='TRUE'THENv_pending_flag:=1;ENDIF;OPENgeteftauth;FETCHgeteftauthINTOv_paymentauthorizationseqnum;IFgeteftauth%FOUNDTHENv_return:=v_paymentauthorizationseqnum;ENDIF;CLOSEgeteftauth;RETURNv_return;END;FUNCTIONActiveAuthCountByPerson(inpersonidINVARCHAR2,incustomertypecodeINVARCHAR2,inauthtypecodeINVARCHAR2:='CLDC',indateINDATE:=SYSDATE,inIncludePendingINVARCHAR2:='FALSE')RETURNNUMBERAS-- create and initialize local variablesv_returnNUMBER:=0;v_pending_flagNUMBER:=0;CURSORgetauthcountISSELECTcount(*)FROMpayment_authorizationpaJOINbank_accountusing(bank_account_seq_num)WHEREcustomer_second_id=inpersonidANDcustomer_type_code=incustomertypecodeANDauthorization_type_code=inauthtypecodeANDtrunc(auth_date)<=indateANDrevoke_dateISNULLAND(v_pending_flag=1OR(v_pending_flag=0ANDbank_account_status_codein('NEW','VALID')AND(prenote_required_flag='N'ORprenote_required_flag='Y'andprenote_success_dateisnotnull)));BEGINIFinIncludePending='TRUE'THENv_pending_flag:=1;ENDIF;-- get authorization count for person and auth type codeOPENgetauthcount;FETCHgetauthcountINTOv_return;CLOSEgetauthcount;RETURNv_return;END;FUNCTIONCardEnrollmentCountByPerson(inpersonidINVARCHAR2)RETURNNUMBERAS-- create and initialize local variablesv_returnNUMBER:=0;CURSORgetcardcountISSELECTcount(*)FROMdebit_card_enrollment_requestWHEREcardholder_id_num=inpersonidANDcard_term_dateisnull;BEGIN-- get card enrollment count for personOPENgetcardcount;FETCHgetcardcountINTOv_return;CLOSEgetcardcount;RETURNv_return;END;