ffc-pay-schemes
v1.1.0
Published
Module for defining and providing details for the payment schemes supported by the Payment Hub.
Readme
ffc-pay-schemes
Module for defining and providing details for the payment schemes supported by the Payment Hub.
Usage
Installation
npm install --save ffc-pay-schemesAvailable functions
const {
createInvoiceNumber,
createSplitInvoiceNumber,
getAccountCodeMap,
getBatchSequenceFromFileName,
getJournalSourceFromPillar,
getPillarFromSchemeId,
getPillars,
getReportingDataFilter,
getSchemeBatchProperties,
getSchemeFromBatchFileName,
getSchemeIdFromPillar,
getSchemeIdFromSourceSystem,
getSchemeIds,
getSchemeNameFromSchemeId,
getSchemeNames,
getSchemeProperties,
getSchemes,
getSourceSystemFromSchemeId,
getSourceSystems,
isFRPS,
isSitiAgri,
isValidSchemeId,
schemeDoesNotRequirePPAs,
schemeProvidesAccountingValues
} = require('ffc-pay-schemes')createInvoiceNumber(paymentRequest)creates an invoice number for a givenpaymentRequest.createSplitInvoiceNumber(paymentRequest)creates a split invoice number for a givenpaymentRequest.getAccountCodeMap(schemeId)returns the account code mapping used for a givenschemeId.getBatchSequenceFromFileName(schemeId, fileName)returns the sequence as identified in the suppliedfileName, checking the correct position using theschemeId.getJournalSourceFromPillar(schemeId, source, pillar)returns the appropriate manual source used in Payment journals for manual schemes, based on the suppliedpillar. IfschemeIdis not the MANUAL scheme, or a match is not found, the suppliedsourcewill be returned.getPillarFromSchemeId(schemeId)returns the pillar name for a givenschemeId.getPillars()returns all supported pillars.getReportingDataFilter(schemeId)returns the fields which should be added to any data filters applied in reporting checks, for a givenschemeId.getSchemeBatchProperties(schemeId)returns the batch processing properties for a givenschemeId.getSchemeFromBatchFileName(fileName)returns the supported scheme details based on the expected file mask matching the suppliedfileName.getSchemeIdFromPillar(pillar)returns the scheme ID for a givenpillar.getSchemeIdFromSourceSystem(sourceSystem)returns the scheme ID for a givensourceSystem.getSchemeIds()returns all supported scheme IDs.getSchemeNameFromSchemeId(schemeId)returns the scheme name for a givenschemeId.getSchemeNames()returns all supported scheme names.getSchemeProperties(schemeId, sourceSystem, pillar)returns the default payment properties for a scheme. A scheme can be identified by its ID or source system. The optionalpillarcan be used for manual payments.getSchemes()returns all supported schemes as an array of objects containingschemeId,schemeName,sourceSystemandpillar.getSourceSystemFromSchemeId(schemeId)returns the source system name for a givenschemeId.getSourceSystems()returns all supported source systems.isFRPS(schemeId)returnstrueif the scheme ID comes from FRPS, orfalseif not.isSitiAgri(schemeId)returnstrueif the scheme ID comes from Siti Agri, orfalseif not.isValidSchemeId(schemeId)returnstrueif the scheme ID is recognised, orfalseif not, including converting the scheme ID to a numeric value first if required.schemeDoesNotRequirePPAs(schemeId)returnstrueif Payment Hub does not support Post Payment Adjustments (PPAs) for a givenschemeId; otherwise, it returnsfalse.schemeProvidesAccountingValues(schemeId)returnstrueif a givenschemeIdprovides accounting values within its payment requests; otherwise, it returnsfalse.
Examples
const {
getSchemes,
getSchemeIds,
getSchemeProperties,
schemeDoesNotRequirePPAs,
schemeProvidesAccountingValues
} = require('ffc-pay-schemes')
const schemes = getSchemes()
const { BPS } = getSchemeIds()
const scheme = getSchemeProperties(BPS)
const doesNotRequirePPAs = schemeDoesNotRequirePPAs(BPS)
const providesAccountingValues = schemeProvidesAccountingValues(BPS)Payment Hub usage
The following services are intended to be used with the ffc-pay-schemes package:
- ffc-pay-alerting
- ffc-pay-batch-processor
- ffc-pay-enrichment
- ffc-pay-event-hub
- ffc-pay-gateway
- ffc-pay-injection
- ffc-pay-processing
- ffc-pay-request-editor
- ffc-pay-responses
- ffc-pay-submission
- ffc-pay-tracking
- ffc-pay-web
In the event a new payment scheme is added to the package, all of the above services must be bumped to the latest package version to ensure that Payment Hub can process associated payments.
Scheme onboarding process
See the linked PR for an example of how to onboard a payment scheme with batch files to the ffc-pay-schemes package:
https://github.com/DEFRA/ffc-pay-schemes/pull/16
The below breakdown details all steps required for a general scheme onboarding:
- Add the scheme's pillar name to
app/constants/pillars.js- this allows the pillar to be recognised for manual payments inffc-pay-injection - Add the manual source name for the scheme to
app/constants/manual-sources.js- this defines thesourcename to use in D365 journals for manual payments for the scheme, created byffc-pay-submission - Add the scheme batch properties to
app/constants/scheme-batch-properties.js- this defines the naming convention for D365 journals for the scheme, created byffc-pay-submission - Add the new scheme ID to
app/constants/scheme-ids.js- this is the glue that holds payment processing together - Add the scheme name to
app/constants/scheme-names.js- this is how the scheme will be referred to in all frontend services, and in system logs - Add the default scheme properties to
app/constants/schemes.js- this is the primary driver for scheme defaults as read byffc-pay-enrichment - Add the source system to
app/constants/source-systems.js- this is how the scheme will be recognised byffc-pay-enrichment, and allow the scheme ID to be determined - Add the scheme ID to the correct function in
app/create-invoice-number/index.js- this is how the D365 formatted invoice number will be calculated inffc-pay-enrichment - Add the scheme ID to the mapping in
app/get-account-code-map/index.js- this is how account codes will be assigned to invoice lines with different description codes inffc-pay-processing- this is only usually called for PPAs, but for good practice it should be determined for all schemes
For all schemes supporting batch file ingestion:
- Add details of the file mask to
app/constants/file-masks.js- this should be the file mask as read byffc-pay-batch-processor, and allows the service to recognise the file to be processed. - Add the file mask to the default scheme properties in
app/constants/schemes.js- this is referenced byffc-pay-batch-processor - Add the position of the sequence number within the payment file to
app/constants/sequence-positions.js- as used byffc-pay-batch-processorto determine the correct sequence number of the file for processing
Remember that ffc-pay-gateway must still be updated with the inbound file path, server name, and other configuration. See https://github.com/DEFRA/ffc-pay-gateway/pull/78 for an example.
For all schemes delivered via FRPS:
- Add the scheme ID to
app/constants/frps-schemes.js- this allows services to understand if it has been delivered by FRPS, helping with numerous helpers for FRPS specific behaviours
For all schemes delivered via Siti Agri:
- Add the scheme ID to
app/constants/siti-agri-schemes.js- this allows services to understand if it has been delivered by Siti Agri, helping with numerous helpers for Siti Agri specific behaviours
For all schemes which do not support PPAs:
- Add the scheme ID to
app/constants/schemes-not-requiring-ppas.js- this tellsffc-pay-processingnot to calculate PPAs
For all schemes which provide accounting values:
- Add the scheme ID to
app/constants/schemes-providing-account-values.js- this tellsffc-pay-enrichmentto mark the payment request as providing accounting values, and enables correct value reporting in Payment Hub reports
Completing all of these steps as required should allow Payment Hub to support payments for a new payment scheme, assuming there are no specific behaviours that differ from a general payment scheme.
Licence
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
The following attribution statement MUST be cited in your products and applications when using this information.
Contains public sector information licensed under the Open Government license v3
About the licence
The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.
