Assignment 2

advertisement
Database Programming and Administration
Assignment 2
Luke Randall
Rob Howard
Thomas McGannon
10185864
10100000
10181651
Oracle Username: ljrandal
Luke Randall/Rob Howard/Thomas McGannon
Page 1 of 13
Table of Contents
1. Instructions ............................................................................................................................................ 3
1.1 Running the Program ...................................................................................................................... 3
1.2 Modifying Parameters ..................................................................................................................... 5
2. Overview of Task .................................................................................................................................. 6
3. Design of the Solution........................................................................................................................... 8
3.1 Overview ......................................................................................................................................... 8
3.2 Function Diagrams ........................................................................................................................ 10
3.3 Assumptions .................................................................................................................................. 11
3.4 Functions and Procedures ............................................................................................................. 11
3.5 Views ............................................................................................................................................ 12
3.6 Entity-Relationship Diagram ........................................................................................................ 13
Luke Randall/Rob Howard/Thomas McGannon
Page 2 of 13
1. Instructions
1.1 Running the Program
Logging In
1. To login using iSQL Plus, navigate to http://smaug.it.uts.edu.au:7777/isqlplus) and enter
your username and password.
2. You should now see the screen in Figure 1. You can now proceed to enter commands.
Figure 1 - iSQL Plus
Running a Daily Settlement
1. To run the daily settlement for today, run FSS_Settlement.DailySettlement with no
parameters. This can be accomplished from iSQL Plus by typing in the commands
below and then pressing the execute button. Ideally this should be scheduled.
Note: To run the daily settlement for a past date, pass that date to the DailySettlement
procedure in the format DDMONYYYY, for example 10JUN2006.
BEGIN
exec FSS_Settlement.DailySettlement;
END;
Luke Randall/Rob Howard/Thomas McGannon
Page 3 of 13
2. The daily deskbank file will now have been produced in the storage directory specified
in the reference table.
Running a Monthly Settlement
1. To run the monthly settlement for the specified month, run the commands listed below.
Note that the parameter must be in the format MONYYYY, for example JUN2006.
BEGIN
exec FSS_Settlement.MonthlySettlement(MONYYYY);
END;
2. The monthly deskbank file will now have been produced in the storage directory
specified in the reference table.
Running the Daily Banking Summary
1. To run the daily banking summary, run the commands listed below. Note that the
parameter must be in the format DDMONYYYY, for example 10JUN2006.
BEGIN
exec FSS_Settlement.DailyBankingSummary (DDMONYYYY);
END;
2. The daily banking summary will now have been created in the storage directory
Running the Monthly Banking Summary
1. To run the monthly banking summary, run the commands listed below. Note that the
parameter must be in the format MONYYYY, for example JUN2006.
BEGIN
exec FSS_Settlement.MonthlyBankingSummary (MONYYYY);
END;
2. The monthly banking summary will now have been created in the storage directory.
Luke Randall/Rob Howard/Thomas McGannon
Page 4 of 13
Running the Monthly Client Statements
1. To generate the monthly statement for a particular client, run the commands listed
below. Note that the date parameter must be in the format MONYYYY, for example
JUN2006. The ClientID parameter should be numeric.
BEGIN
exec FSS_Settlement.MonthlyClientStatement (MONYYYY, ClientID);
END;
2. The monthly client statement for the selected client will now be created in the storage
directory.
Running the Fraud Report
1. To generate a fraud report, run the command listed below.
BEGIN
exec FSS_Settlement.FraudReport;
END;
1.2 Modifying Parameters
The program can be modified in a number of ways simply through the database environment.
These modifications are done in the FSS_ALL_REFERENCE view. This view consists of a
ReferenceID (which must be unique), a reference name, a reference value and a comment.
To modify single values (eg: the storage directory), modify the Reference value.
The following is a sample list of parameters that can be modified from this table:

Holiday Run Flag: This is either Y or N, which refers to whether or not the program
is to be run on holidays (as defined by FSS_HOLIDAYS) and weekends.

DIR: This is the full path to the storage directory where all output files (deskbank
files and reports) will be stored.

FEE1: This refers to the percentage of total turnover charged to merchants on
transactions.
Luke Randall/Rob Howard/Thomas McGannon
Page 5 of 13
2. Overview of Task
The task at hand is to implement a Financial Settlement System for a Smartcard Transaction
Centre. A limited trial deployment of a Smartcard System has been underway for some time now,
and this deployment is now moving into the next phase of deployment.
The next phase will involve the number of merchants being increased. This means that there is a
requirement that the settlement process be automated in order to maximise efficiency and
minimise delay. During the trial period the merchants were reimbursed manually, but this is no
longer feasible or desired.
During the initial phase merchants were also not charged any fee on Smartcard transactions. There
is a requirement that fees are now implemented, so that merchants will be automatically debited a
set percentage fee at the end of each month.
At the end of each day, assuming the transactions for each merchant are above the minimum
settlement amount, they will be settled. This involves a daily Deskbank file being created – which
is sent to the bank in order to credit the merchants accounts with the required amount. A daily
settlement report must also be able to be produced for the accountants. This is simply a humanreadable version of the daily Deskbank file.
At the end of each month, all outstanding transactions will be settled (ie: those which were below
the minimum settlement amount), as well as fees will be debited from the merchants’ accounts. A
monthly Deskbank file must be produced containing these transactions. Again, a human-readable
monthly settlement report must also be produced for the accountants.
To ensure accountability and traceability, monthly statement reports will be generated for each
merchant at the end of each month. These statements will show the deposits into their bank
accounts during the month as well as the amount of fees for the service.
Finally, to aid in fraud detection a fraud report will be able to be created. This will list those cards
Luke Randall/Rob Howard/Thomas McGannon
Page 6 of 13
(and the transactions from those cards) where the old value of the current transaction is greater
than the new value of the previous transaction.
Luke Randall/Rob Howard/Thomas McGannon
Page 7 of 13
3. Design of the Solution
3.1 Overview
The daily settlement procedure works by looping through all the non-settled transactions
from the beginning of the month to the date given. If a non-settled transaction is found, then
the program will loop through all unsettled transactions of that client and produce a total
transaction amount. If the total transaction amount is greater then the minimum required
amount the transactions are marked as settled and inserted into the daily settlement table.
As the loop continues, if another transaction of the same client is found, it will be ignored as
the previous settlement would have marked it as settled.
By the end of the procedure, any non-settled transactions which have a transaction total
above the minimum amount will be settled.
The daily deskbank file and daily bank summary will then be printed to a file.
The monthly settlement procedure is similar to the daily settlement, however captures the
total transaction amounts of all settled and non-settled transactions. If an account has not
been settled it will deduct the monthly fee from the total which it must CREDIT the
merchant. Otherwise it will DEBIT the merchant the monthly fee.
The monthly deskbank file and monthly bank summary will then be printed to a file.
Both the daily and monthly procedures check to see if they are already running before they
start. If they are already running, the procedures will exit without performing any tasks.
The Deskbank files are generated completely using Dynamic SQL. The layout of the
Deskbank file is defined in the ljrandal.FSS_DESKBANK_REF table. This table defined the
padding, justification, order, field size, field name/value and datasource of each field. The
RecordType field is used to indicate whether the field is for the Header , Footer (7) or the
data rows (1). If text is in the FieldValue field, it is assumed that this is hardcoded. If this
field is NULL then it is assumed that the field listed in the FieldName is used from the table
specified in the DataSource Field. Note that only one table can be used as a data source.
The TimeFrame field determines whether the field applies for the daily Deskbank ('D'), the
monthly Deskbank ('M'), or both ('B'). Modifying any of these fields will take effect in all
Luke Randall/Rob Howard/Thomas McGannon
Page 8 of 13
future generated Deskbank files.
Luke Randall/Rob Howard/Thomas McGannon
Page 9 of 13
3.2 Function Diagrams
Luke Randall/Rob Howard/Thomas McGannon
Page 10 of 13
3.3 Assumptions

A month is defined by a Gregorian month, not a 30 day period.

The program can be run more than once per day. If this assumption is incorrect, when
the value of "ONCPD" in fss_local_reference (named "Once Per Day Only") is
changed to 'Y', the program will be disallowed from executing more than once per
day.
3.4 Functions and Procedures
Public
dailySettlement
monthlySettlement
…
…
Luke Randall/Rob Howard/Thomas McGannon
Page 11 of 13
dailyBankSummary
monthlyBankSummary
monthlyClientStatement
outputDailyDeskbank
outputMonthlyDeskbank
fraudReport
…
…
…
…
…
…
Private
getReferenceValue
setReferenceValue
canExecute
getNewTransactions
cleanUp
addLog
printSummaryFooter
printSummaryHeader
outputDBHeaderFooter
outputDeskbankContent
…
…
…
…
…
…
…
…
…
…
3.5 Views
Luke Randall/Rob Howard/Thomas McGannon
Page 12 of 13
3.6 Entity-Relationship Diagram
FSS_ALL_REFERENCE
FSS_MONTHLY_SETTLEMENT
FK1
CLIENTID
CLIENTNAME
CLIENTBANKBSB
CLIENTBANKACCNR
CLIENTTOTAL
DOWNLOADDATE
LODGEMENTREF
TRANSACTIONTYPE
SETTLEMENTDATE
MERCHANTID
REFERENCEID
REFERENCENAME
REFERENCEVALUE
REFCOMMENT
NUMBER
VARCHAR2(85)
VARCHAR2(6)
VARCHAR2(10)
NUMBER
DATE
VARCHAR2(15)
VARCHAR2(15)
DATE
NUMBER
VARCHAR2(5)
VARCHAR2(25)
VARCHAR2(50)
VARCHAR2(255)
FSS_LOCAL_REFERENCE
PK
REFERENCEID
FSS_REFERENCE
VARCHAR2(5)
PK
REFERENCENAME VARCHAR2(25)
REFERENCEVALUE VARCHAR2(50)
REFCOMMENT
VARCHAR2(255)
REFERENCEID
VARCHAR2(5)
REFERENCENAME VARCHAR2(25)
REFERENCEVALUE VARCHAR2(50)
REFCOMMENT
VARCHAR2(255)
FSS_DAILY_SETTLEMENT
FSS_MERCHANT
PK
MERCHANTID
NUMBER
MERCHANTFIRSTNAME
MERCHANTLASTNAME
MERCHANTSTREETNR
MERCHANTSTREETNAME
MERCHANTSUBURB
MERCHANTSTATE
MERCHANTPOSTCODE
MERCHANTTELEPHONENR
MERCHANTFAXNR
MERCHANTBANKBSB
MERCHANTBANKACCNR
MERCHANTACCOUNTTITLE
MERCHANTSTATUS
VARCHAR2(35)
VARCHAR2(50)
VARCHAR2(15)
VARCHAR2(35)
VARCHAR2(35)
VARCHAR2(3)
VARCHAR2(4)
VARCHAR2(15)
VARCHAR2(15)
VARCHAR2(6)
VARCHAR2(10)
VARCHAR2(32)
VARCHAR2(1)
FK1
CLIENTID
CLIENTNAME
CLIENTBANKBSB
CLIENTBANKACCNR
CLIENTTOTAL
DOWNLOADDATE
LODGEMENTREF
TRANSACTIONTYPE
SETTLEMENTDATE
MERCHANTID
NUMBER
VARCHAR2(85)
VARCHAR2(6)
VARCHAR2(10)
NUMBER
DATE
VARCHAR2(15)
VARCHAR2(15)
DATE
NUMBER
FSS_DESKBANK_REF
FSS_DAILY_TRANSACTIONS_VIEW
TRANSACTIONNR
CLIENTID
CLIENTNAME
CLIENTBANKBSB
CLIENTBANKACCNR
CLIENTTOTAL
DOWNLOADDATE
TERMINALID
PROCESSED
PROCESSEDDATE
RECORDTYPE
FIELDNAME
FIELDVALUE
FIELDSIZE
FIELDORDER
TIMEFRAME
PADDINGCHAR
JUSTIFICATION
DATASOURCE
NUMBER
NUMBER
VARCHAR2(86)
VARCHAR2(6)
VARCHAR2(10)
NUMBER
DATE
VARCHAR2(10)
CHAR(1)
DATE
VARCHAR2(1)
VARCHAR2(50)
VARCHAR2(100)
NUMBER
NUMBER
CHAR(1)
CHAR(4)
VARCHAR2(4)
VARCHAR2(30)
FSS_ORGANISATION
FSS_RUN_TABLE
FSS_HOLIDAY
PK
FSS_DAILY_TRANSACTIONS_VIEW
TRANSACTIONNR
DOWNLOADDATE
TERMINALID
CARDID
TRANSACTIONDATE
CARDOLDVALUE
TRANSACTIONAMOUNT
CARDNEWVALUE
TRANSACTIONSTATUS
ERRORCODE
MERCHANTID
MERCHANTNAME
MERCHANTBANKBSB
MERCHANTBANKACCNR
NUMBER
DATE
VARCHAR2(10)
VARCHAR2(17)
DATE
NUMBER
NUMBER
NUMBER
VARCHAR2(1)
VARCHAR2(25)
NUMBER
VARCHAR2(86)
VARCHAR2(6)
VARCHAR2(10)
RUNID
TERMINALID
FSS_TERMINAL_TYPE
VARCHAR2(10)
PK
FK2
FK1
TERMINALTYPE
SAMID
TERMINALSTATUS
MERCHANTID
TYPENAME
VARCHAR2(3)
VARCHAR2(10)
VARCHAR2(1)
NUMBER
VARCHAR2(3)
TYPENAME
VARCHAR2(3)
TYPEDESCRIPTION
TERMINALPREFIX
TYPESTATUS
MINTRANAMT
MAXTRANAMT
CREATEDBY
CREATEDDATE
VARCHAR2(50)
CHAR(24)
VARCHAR2(1)
NUMBER
NUMBER
VARCHAR2(10)
DATE
FSS_TRANSACTION
PK
FSS_SMARTCARD
PK
DATE
DATE
VARCHAR2(15)
VARCHAR2(255)
FSS_TERMINAL
PK
CARDID
VARCHAR2(17)
DATEISSUED
ISSUEVALUE
CARDSTATUS
CURRENTVALUE
DATE
NUMBER
VARCHAR2(1)
NUMBER
FK2
FK3
TRANSACTIONNR
NUMBER
DOWNLOADDATE
TERMINALID
CARDID
TRANSACTIONDATE
CARDOLDVALUE
TRANSACTIONAMOUNT
CARDNEWVALUE
TRANSACTIONSTATUS
ERRORCODE
DATE
VARCHAR2(10)
VARCHAR2(17)
DATE
NUMBER
NUMBER
NUMBER
VARCHAR2(1)
VARCHAR2(25)
Luke Randall/Rob Howard/Thomas McGannon
ORGNR
NUMBER
ORGNAME
ORGSTREETNR
ORGSTREET
ORGSUBURB
ORGSTATE
ORGPOSTCODE
ORGPHONENR
ORGENQUIRYNR
ORGBSBNR
ORGBANKACCOUNT
ORGACCOUNTITLE
COMMENTS
VARCHAR2(50)
VARCHAR2(25)
VARCHAR2(50)
VARCHAR2(35)
VARCHAR2(3)
VARCHAR2(6)
VARCHAR2(18)
VARCHAR2(12)
VARCHAR2(6)
VARCHAR2(10)
VARCHAR2(26)
VARCHAR2(255)
VARCHAR2(10)
RUNSTART
RUNEND
RUNOUTCOME
REMARKS
HOLIDAY_DATE DATE
PK
FSS_DAILY_TRANSACTIONS
PK
TRANSACTIONNR
NUMBER
DOWNLOADDATE
TERMINALID
CARDID
TRANSACTIONDATE
CARDOLDVALUE
TRANSACTIONAMOUNT
CARDNEWVALUE
TRANSACTIONSTATUS
ERRORCODE
PROCESSED
PROCESSEDDATE
DATE
VARCHAR2(10)
VARCHAR2(17)
DATE
NUMBER
NUMBER
NUMBER
VARCHAR2(1)
VARCHAR2(25)
CHAR(1)
DATE
FSS_LOG
OCCURRED
COMPONENT
SEVERITY
MESSAGE
DATE
VARCHAR2(100)
VARCHAR2(50)
VARCHAR2(300)
Page 13 of 13
Download