Direct Debit
The Direct Debit functionality helps users to handle direct debit payment operations.
Below are the journeys, entities, libraries and scripts related to this functionality:
Entity FTOS_PYMT_DIDE with all attributes.
Entity FTOS_PYMT_DirectDebitConfirmation with all attributes.
Entity FTOS_PYMT_DirectDebitConfirmationDetail with all attributes.
Entity FTOS_PYMT_DirectDebitMandate with all attributes.
Entity FTOS_PYMT_DirectDebitMandateBuffer with all attributes.
Entity FTOS_PYMT_DirectDebitNotification with all attributes.
Digital Journeys
Journey DirectDebitNotification
General description: After uploading and importing the data from the Notification file, the user is redirected to the direct debit mandate Registration form. This form has to steps(tabs). In the first tab, the user finds information about the notification file - the name of the file and the import date. In the second tab, the user can see the direct debit mandates buffer activated by that specific notification file.
Journey DirectDebitNotificationInsert
General description: This is an user journey aimed at implementing the Notification Manual Insert functionality. The journey has a form that allows the user to upload a Notification file by pressing the Import Data button.
Journey FTOS_PYMT_DirectDebitMandate
General description: This form is used to see all the details about the direct debit mandates registered, on step 1 and the history of changes logged on the selected mandate, on step 2.
This form is used to see all the details about the direct debit mandates notified.
Journey FTOS_PYMT_DirectDebitConfirmationInsert form
This form is used to manually upload a direct debit payments confirmation file by pressing the Import Data upload button.
Journey FTOS_PYMT_DirectDebitConfirmation form
After uploading and importing the data from the confirmation file, the user is redirected to this form which represents the registration of the payments confirmation of direct debit mandates.
This form has to steps (tabs). In the first tab, the user finds information about the confirmation file: the name of the file and the import date. In the second tab, the user can see a view with the payments confirmation records by that specific confirmation file.
View Default
This view is used to see the list of all the direct debit payments confirmation files uploaded. From this view, the user can select any file by double clicking the FTOS_PYMT_DirectDebitConfirmation form, in order to see the file details.
Journey DirectDebitConfirmationDetail _ReadOnly form
This form is used to see all the details about the payments confirmation records from the payments confirmation file.
View Default
This view displays the list of payments confirmation files. From this view, the user can select any file, by double clicking the DirectDebitConfirmationDetail _ReadOnly form, in order to see the file details.
Journey FTOS_PYMT_DIDEReadOnly form
This form displayes details (file name and date of generation) about the DIDE instruction files generated by the FTOS_PYMT_DIDEInstructionFile scheduled job. Also, from this form the user can download the generated file.
View FTOS_PYMT_DIDEReadOnly
This view displays the list of all the DIDE instruction files generated by the FTOS_PYMT_DIDEInstructionFile scheduled job. From this view, the user can select any file, by double clicking the FTOS_PYMT_DIDEReadOnly form, in order to see the file details.
On Demand Server Automation Scripts
On demand script that is triggered when a file is uploaded inside the DirectDebitNotificationInsert journey. After the user presses the Import Data button, the script validates that the file is in .txt format. It also restricts the upload to only one .txt file.
Input parameters: file
- The file that needs to be validated.
Output parameters: fileValidation
(boolean) - The result of the validation (true/ false).
This on demand script calls changeMandateBusinessStatus(mandateId)
function from FTOS_PYMT_Mandate server side library. The mandateId
parameter is passed as null value in order to run the status changes for all the mandates.
Input parameters: N/A.
Output parameters: N/A.
This on demand script calls the runDIDEInstructionFile()
function from the FTOS_PYMT_DIDE server side script library, in order to generate the instructions file for the direct debit payments.
Input parameters: N/A.
Output parameters: N/A.
Business Workflow Configuration Actions
Business Workflow: FTOS_PYMT_DirectDebitMandate
Transition | Description |
---|---|
_proposal | The initial status of any mandate issued into the system. |
active_cancelled | The cancellation of a direct debit mandate triggers the automatic change of the payment type on the policy, from Direct Debit to Bank Transfer (OP). |
active_expired | When the current date passed the end date of the mandate. The expiration triggers the automatic change of the payment type on the policy, from Direct Debit to Bank Transfer (OP). |
active_versionClosed | When a version of the mandate is closed. |
approved_active | When a version of the mandate is approved and the current date is the begin date or is passed the begin date, already. |
approved_draft | When a new mandate version is created. While in Draft, the new payment type is Bank Transfer (OP). |
approved_expired | When the current date passed the end date of the mandate. The expiration triggers the automatic change of the payment type on the policy, from Direct Debit to Bank Transfer (OP). |
draft_active | When the current date is the begin date. The automatic transition is triggered by the FTOS_PYMT_DirectDebitMandateStatusChange job, which verifies if the current date is the begin date and changes the status to Active for all eligible mandates. |
draft_cancelled | When the mandate stage D instruction (where D is the value for Delete) is received in the notification file. |
draft_expired | When the current date passed the end date of the mandate. The expiration triggers the automatic change of the payment type on the policy, from Direct Debit to Bank Transfer (OP). |
draft_versionDraft | When a version of the mandate is initiated. |
proposal_active | When the current date is the begin date of the mandate or when the mandate is registered after its begin date, already. |
proposal_draft | When the direct debit mandate has not reached the begin date, yet. |
proposal_expired | When the current date passed the end date of the mandate. The expiration triggers the automatic change of the payment type on the policy, from Direct Debit to Bank Transfer (OP). |
versionDraft_approved | When a version of the mandate is approved. |
versionDraft_versionUnapproved | When a version of the mandate is not approved. |
Processors
FTOS_PYMT_DIDEProcessor
This processor sets the followings parameters:
-
numberOfDaysInAdvance
- The file is generated with N days before the invoice's due date - for example 3 or 5 or 10 etc. -
runningOnBankHolidays
- Set to true if the DIDE instruction file is generated on a bank holiday. -
excludeWeekDays
- Sets the week days in which the DIDE instruction file is not generated.
Sequencers
FTOS_PYMT_DIDE sequencer
This sequencer is used to set the Order Number
value used for generating DIDE instruction files.
-
Range Min = 1
-
Range Max = 999,999,999
Server Side Script Libraries
From the FTOS_PYMT_Mandate library, the following functions are used:
This function wraps a series of functions which perform actions on the FTOS_PYMT_DirectDebitMandateBuffer entity or interpret data received by it. Inside the PYMT_Buffer()
function, the following functions are used:
This function updates the directDebitMandateId
attribute on a buffer that triggers an action for a mandate (insertion, deletion or modification).
Input parameters:
-
bufferId
- The Id of the buffer on which the update needs to be implemented. -
mandateId
- The Id of the mandate on which the buffer performed an action.
Output parameters: N/A.
This function detects which type of action any buffer needs to perform on a mandate based on the stageId
that the buffer has. If there is no stageId
set on the buffer, the function throws an exception, with an error message.
Input parameters: bufferObj
- The object containing the data added in the buffer.
Output parameters: N/A.
Inside the PYMT_Mandate()
function, the following functions are used:
This function gets the stage of the mandate - that is whether the mandate is N(New), M(Modified) or D(Deleted).
Input parameters: mandateId
- The mandate unique identifier.
Output parameters: N/A.
This function updates the mandate business status according to the logic from the getMandateNewBusinessStatus()
function (see below).
Input parameters: mandateId
- The mandate unique identifier.
Output parameters: N/A.
This function updates the mandate business status.
Input parameters:
-
mandateId
- The mandate unique identifier. -
statusId
- The business status unique identifier.
Output parameters: N/A.
This function returns the Id of the new business status according to the logic between begin date, end date and current date.
Input parameters:
-
beginDate
- The beginning date for the mandate. -
endDate
- The ending date for the mandate.
Output parameters: Returns the newBusinessStatusId
.
This function returns the mandate details based on the reference.
Input parameters: reference
- The mandate reference (expected policy number).
Output parameters: Returns the fetch.
This function updates the mandate business status to Cancelled.
Input parameters:
-
mandateRef
- The mandate reference (expected policy number). -
stageId
- The mandate stage.
Output parameters: N/A.
This function returns the Id of the currency based on the code.
Input parameters: currencyCode
- The currency code.
Output parameters: The currencyId
or null
.
This function updates the business status of a mandate to Cancelled, as well as the stageId
attribute to the one received from the buffer. It also calls the updateBufferMandateId
function to update the directDebitMandateId
attribute of the buffer. If no mandate is found based on the reference, the function throws an error.
Input parameters: bufferObj
- The object containing the data added in the buffer.
Output parameters: N/A.
This function receives a date in a string format. Next, the function converts the date to a date object, with the correct server time.
Input parameters: date
- The string containing a date.
Output parameters: dateWithOffset
- The date object.
This function inserts a new mandate record, filling in with the data received from the buffer. It also calls the updateBufferMandateId
function to update the directDebitMandateId
attribute of the buffer. If a mandate with the same reference from the data object already exists in the system, the function throws an error.
Input parameters: bufferObj
- The object containing the data added in the buffer.
Output parameters: N/A.
This function fetches from the FTOS_PYMT_DirectDebitMandate entity the Id of the last version for a specified mandate.
Input parameters: mandateId
- The Id of the mandate the last version.
Output parameters: buffers
- The mandate list that has been found.
This function executes the following:
-
Creates a new version for a mandate with a specific reference.
-
Updates the mandate with the new data received from the buffer.
-
Changes the business status of the new version, depending on the
beginDate
andendDate
attributes. -
Changes the business status of the old version of the mandate with the
versionClosed
status. -
Calls the
updateBufferMandateId
function to update thedirectDebitMandateId
attribute of the buffer.
Input parameters: bufferObj
- The object containing the data added in the buffer.
Output parameters: N/A.
From the FTOS_PYMT_DirectDebitMandateConfirmation library, the following functions are used:
This function inserts a payment confirmation record into the FTOS_PYMT_DirectDebitMandateConfirmation entity.
Input parameters: input
- The object containing details about the new payment confirmation.
Output parameters: directDebitMandateConfirmationId
- The Id of the newly inserted payment confirmation.
This function saves the contents of the uploaded payments confirmation file.
Input parameters:
-
fileArr
- The object containing the payments confirmation file. -
confirmationObj
- The object containing the Id of the new file inserted and details about the user who performed the insert of the file.
Output parameters: N/A.
Also, inside this function, the following functions are used:
-
getTabularDataFromFile()
- To get data from the payments confirmation file. -
saveToTemporaryTable
- To save the values in a temporary table called DirectDebitConfirmationTempTable.
The contents of the file are saved with the FTOS_InsertDirectDebitConfirmationDetail stored procedure which returns an array of payments confirmation from the FTOS_PYMT_DirectDebitConfirmationDetail entity.
From the FTOS_PYMT_DIDE library, the DIDE()
function is used.
This function wraps wraps a series of functions which perform actions on the FTOS_PYMT_DIDE and FTOS_PYMT_DIDEDetail entities, generate and validate some data or generate .txt files, as follows:
This function executes the following:
It verifies that the DIDE instruction file can be generated according the rules defined in the FTOS_PYMT_DIDEProcessor processor (runningOnBankHolidays
and excludeWeekDays
).
-
It generates the details needed for making the DIDE instruction file.
-
It saves the
statementId
anddirectDebitMandateId
details into the FTOS_PYMT_DIDEDetail entity. -
It generates the .txt DIDE instruction file.
-
It saves the file into the FTOS_PYMT_DIDE entity.
-
It also saves the file on the server UploadEBS folder.
This function uses all the functions mentioned below.
Input parameters: N/A.
Output parameters: N/A.
This function gets the configuration details of a processor.
Input parameters:
-
flowSettingsName
- The name of the flow setting. -
processorSettingsType
- The type of the Digital Processor Type. -
processorSettingsName
- The name of the processor setting.
Output parameters: processorDetails
- An object containing the processor settings runningOnBankHolidays
, excludeWeekDays
and numberOfDaysInAdvance
.
This function returns the name of a weekday.
Input parameters: date
- The date parameter.
Output parameters: dayName
- The name of the week day.
This function verifies if the current day is defined in the FTOS_PYMT_DIDEProcessor. If one condition is meet the function returns a true value.
Input parameters: settings
- The object with the processor settings - runningOnBankHolidays
, excludeWeekDays
and numberOfDaysInAdvance
.
Output parameters: True
or false
.
This function returns statements (invoices) for the DIDE instruction file based on the following conditions:
-
businessStatus
of the statement =Generated
-
paymentType
of the statement =directDebit
-
businessStatus
of the direct debit mandate =active
-
scheduledDate
of the statement =null
-
dueDate
of the statement <= current date +numberOfDaysInAdvance
-
businessStatus
of the policy =Enforced
orSuspended
Input parameters: numberOfDaysInAdvance
- The SGDAY parameter. This parameter sets the day for generating an invoice (for a policy installment), in advance with a number of days before the due date for the payment.
Output parameters: resultStatements
- The returns the fetch.
This function executes the following:
-
It inspects the results of the
getStatementsDetails()
function. -
It inserts the
statementID
,directDebitMandateId
andname
details into the FTOS_PYMT_DIDEDetail entity. -
It populates the
CSVContentArray
with all the details necessary for the generation of the DIDE instruction file. -
It updates the
scheduledDate
from the FTOS_PYMT_Statement entity.
Input parameters:
-
result
- The fetch result of thegetStatementsDetails()
function. -
CSVContentArray
- The empty array.
Output parameters: N/A.
This function executes the following:
-
It generates the .txt DIDE instruction file based on CSVContentArray populated by the
processPaymentsInstruction()
function. -
It saves the file into the FTOS_PYMT_DIDE entity.
-
It saves the file on the UploadEBS folder, from the portal.
Input parameters: CSVContentArray
- The array with all the records for direct debit instructions.
Output parameters: idInstructionFile
- The Id of the new file inserted into the FTOS_PYMT_DIDE entity.
This function searches all the records from FTOS_PYMT_DIDEDetail entity which have dideId
(id of the DIDE instruction file) with null values and updates them with the Id of the new generated DIDE instruction file.
Input parameters: instructionFileId
- The Id of the new DIDE instruction file generated.
Output parameters: N/A.
From the FTOS_PYMT_DirectDebitDenied library, the following functions are used.
This function wraps smaller functions which perform actions necessary for the process of importing the payments denied file in the system.
This function updates the status of the mandates found by the getMandateDetailsByReference
function to Cancelled.
Input parameters: operationReference
- The reference of a mandate.
Output parameters: N/A.
This function fetches the statements (invoices) with the Generated or Unpaid business statuses from a policy, selected by its specific policy number.
Input parameters: policyNo
- The number of the policy.
Output parameters: statements
- The list of the statements (invoices) found.
This function updates the scheduledDate
attribute of a statement (invoice).
Input parameters: policyNo
- The number of the policy.
Output parameters: N/A.
This function updates the mandates and the statements (invoices) found based on the operation references received inside an object.
Input parameters: dideDeniedDetails
- The object containing the operation references.
Output parameters: N/A.
Scheduled jobs
This job is scheduled to run every day at 5:00 AM, to update mandate statuses according to the begin date and end date of the mandates.
Schedule Services: FTOS_PYMT_DirectDebitMandateStatusChange - on demand server automation script.
The job is scheduled to run every day at 3:00 AM to generate the .txt DIDE instruction file.
Schedule Services: FTOS_PYMT_DIDEInstructionFile - on demand server automation script.