What I did for ACH is to write the mapping, the validation, the processing, requirements as rules and then my Parser loops through it and handles it. Kind of like MetaFX that just parses .jsonc files.
There is 1 BAQ that has it all Mapped it just calls that. But what is the hard part is the exception handling, what if SFTP is down, what if you didn’t have disk space and it couldn’t upload, how do you create a self-serve kiosk for them to track what’s sent, what’s not and how can they resend it? etc…
This is the Positive Pay one, the ACH one is huge. Technically this could have been a UD Table, but future problem, easier to hard-code now 
//
// Positive Pay Schema for Unique Bank Inc
//
this.oSchema = new DataSet("PositivePay")
{
Tables =
{
new DataTable("BankLines")
{
Columns =
{
new DataColumn("ParentSysRowID", typeof(Guid)),
new DataColumn("FileSysRowID", typeof(Guid)),
new DataColumn("FileName", typeof(string)),
new DataColumn("LineNum", typeof(int)) { AutoIncrement = true, AutoIncrementSeed = 1 },
new DataColumn("LineRecordType", typeof(string)),
new DataColumn("Line", typeof(string)),
new DataColumn("Errors", typeof(string)),
}
},
new DataTable("FileHeader")
{
Columns =
{
new DataColumn("FileSysRowID", typeof(Guid)),
new DataColumn("KeyFileName", typeof(string)),
new DataColumn("KeySysRowID", typeof(Guid)),
new DataColumn("KeyCompanyID", typeof(string)),
new DataColumn("KeyOurBankID", typeof(string)),
new DataColumn("KeyPositivePayRemoteID", typeof(string)),
new DataColumn("RecordTypeCode", typeof(string)) { DefaultValue = "1" }
}
},
// ================================================================================================
// Entry Detail Record
// ================================================================================================
new DataTable("EntryDetailPositivePay")
{
Columns =
{
new DataColumn("FileSysRowID", typeof(Guid)),
new DataColumn("ParentSysRowID", typeof(Guid)),
new DataColumn("KeySysRowID", typeof(Guid)),
new DataColumn("KeyDetailNumber", typeof(string)),
new DataColumn("KeyCheckNumber", typeof(string)),
// 1. Record Type Code
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Record Type Code | '6' | 01-01 | 1 | '6' (only valid value) | Identifies the type of record; '6' for Entry Detail. |
* | | | | | | Example: '6' |
*/
new DataColumn("RecordTypeCode", typeof(string)) {
DefaultValue = "6",
ExtendedProperties = {
{ "Caption", "Record Type Code" },
{ "Description", "Identifies the type of record; '6' for Entry Detail." },
{ "Explanation", "Marks the record as a detail record in the file." },
{ "Example", "6" },
{ "Position", 1 },
{ "Length", 1 },
{ "Required", true },
{ "Contents", "6" },
{ "PadChar", "" },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^6$" }
}
},
// 2. Status Code
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Status Code | Numeric | 02-02 | 1 | '2' - Add, '4' - Void | Indicates the status of the record. |
* | | | | | | '2' for Add Issue, '4' for Void Issue. |
* | | | | | | Example: '2' |
*/
new DataColumn("StatusCode", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Status Code" },
{ "Description", "Indicates the status of the record." },
{ "Explanation", "'2' for Add Issue, '4' for Void Issue." },
{ "Example", "2" },
{ "Position", 2 },
{ "Length", 1 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "" },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^[24]$" }
}
},
// 3. Account Number Length
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Account Number Length | Numeric | 03-04 | 2 | '17' | Length of the account number field. |
* | | | | | | Indicates that the account number is 17 characters long. |
* | | | | | | Example: '17' |
*/
new DataColumn("AccountNumberLength", typeof(string)) {
DefaultValue = "17",
ExtendedProperties = {
{ "Caption", "Account Number Length" },
{ "Description", "Length of the account number field." },
{ "Explanation", "Indicates that the account number is 17 characters long." },
{ "Example", "17" },
{ "Position", 3 },
{ "Length", 2 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^17$" }
}
},
// 4. Reserved 1
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Reserved 1 | Blank | 05-08 | 4 | Blank | Reserved for future use. |
* | | | | | | These positions are left as spaces. |
* | | | | | | Example: ' ' |
*/
new DataColumn("Reserved1", typeof(string)) {
DefaultValue = "",
ExtendedProperties = {
{ "Caption", "Reserved 1" },
{ "Description", "Reserved for future use." },
{ "Explanation", "These positions are left as spaces." },
{ "Example", "" },
{ "Position", 5 },
{ "Length", 4 },
{ "Required", false },
{ "Contents", "Blank" },
{ "PadChar", " " },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^[ ]{4}$" }
}
},
// 5. Bank Number (Identifier)
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Bank Number | Alphameric | 09-12 | 4 | | Identifies the bank. A unique number assigned to the bank. |
* | | | | | | Example: '6098' |
*/
new DataColumn("BankNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Bank Number" },
{ "Description", "Identifies the bank number." },
{ "Explanation", "Specific identifier for the bank." },
{ "Example", "6098" },
{ "Position", 9 },
{ "Length", 4 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^[0-9]{4}$" }
}
},
// 6. Reserved 2
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Reserved 2 | Blank | 13-22 | 10 | Blank | Reserved for future use. |
* | | | | | | These positions are left as spaces. |
* | | | | | | Example: ' ' |
*/
new DataColumn("Reserved2", typeof(string)) {
DefaultValue = "",
ExtendedProperties = {
{ "Caption", "Reserved 2" },
{ "Description", "Reserved for future use." },
{ "Explanation", "These positions are left as spaces." },
{ "Example", "" },
{ "Position", 13 },
{ "Length", 10 },
{ "Required", false },
{ "Contents", "Blank" },
{ "PadChar", " " },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^\\s{10}$" }
}
},
// 7. Account Number
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Account Number | Numeric | 23-39 | 17 | | The account number associated with the transaction. |
* | | | | | | Must be 17 characters long, right justified and zero filled. |
* | | | | | | Example: '00000000000001234' |
*/
new DataColumn("AccountNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Account Number" },
{ "Description", "The account number, right justified and zero filled." },
{ "Explanation", "Should be right justified, zero filled, no dashes." },
{ "Example", "00000000000001234" },
{ "Position", 23 },
{ "Length", 17 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^[0-9]{17}$" }
}
},
// 8. Serial Number (Check Number)
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Serial Number (Check Number) | Numeric | 40-49 | 10 | | The check number, right justified and zero filled no dashes. |
* | | | | | | Example: '0000012345' |
*/
new DataColumn("SerialNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Serial Number (Check Number)" },
{ "Description", "The check number, right justified and zero filled." },
{ "Explanation", "Should be right justified, zero filled, no dashes." },
{ "Example", "0000012345" },
{ "Position", 40 },
{ "Length", 10 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^[0-9]{10}$" }
}
},
// 9. Issue Amount
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Issue Amount | $$$$$$$$cc | 50-59 | 10 | | The amount issued, in cents. No decimals, last two positions are cents. |
* | | | | | | Example: '0000123456' |
*/
new DataColumn("IssueAmount", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Issue Amount" },
{ "Description", "The amount issued, in cents." },
{ "Explanation", "No decimals, last two positions are cents." },
{ "Example", "0000123456" },
{ "Position", 50 },
{ "Length", 10 },
{ "Required", true },
{ "Contents", "$$$$$$$$cc" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "ConvertToCents" },
{ "Regexp", "^[0-9]{10}$" }
}
},
// 10. Issue Date
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Issue Date | YYMMDD | 60-65 | 6 | | The date of issue. |
* | | | | | | Format is YYMMDD. |
* | | | | | | Example: '230525' |
*/
new DataColumn("IssueDate", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Issue Date" },
{ "Description", "The date of issue." },
{ "Explanation", "Format is YYMMDD." },
{ "Example", "230525" },
{ "Position", 60 },
{ "Length", 6 },
{ "Required", true },
{ "Contents", "YYMMDD" },
{ "PadChar", "0" },
{ "PadLeft", false },
{ "SpecialFormat", "FormatDate" },
{ "Regexp", "^[0-9]{6}$" }
}
},
// 11. Reserved 3
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Reserved 3 | Blank | 66-80 | 15 | Blank | Reserved for future use. |
* | | | | | | These positions are left as spaces. |
* | | | | | | Example: ' ' |
*/
new DataColumn("Reserved3", typeof(string)) {
DefaultValue = "",
ExtendedProperties = {
{ "Caption", "Reserved 3" },
{ "Description", "Reserved for future use." },
{ "Explanation", "These positions are left as spaces." },
{ "Example", "" },
{ "Position", 66 },
{ "Length", 15 },
{ "Required", false },
{ "Contents", "Blank" },
{ "PadChar", " " },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^[ ]{15}$" }
}
}
}
},
// ================================================================================================
// Addenda Record
// ================================================================================================
new DataTable("AddendaRecordPositivePay")
{
Columns =
{
new DataColumn("FileSysRowID", typeof(Guid)),
new DataColumn("ParentSysRowID", typeof(Guid)),
new DataColumn("KeySysRowID", typeof(Guid)),
new DataColumn("KeyDetailNumber", typeof(string)),
new DataColumn("KeyAddendaNumber", typeof(string)),
// 1. Record Type Code
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Record Type Code | '7' | 01-01 | 1 | '7' (only valid value) | Identifies the type of record; '7' for Addenda Record. |
* | | | | | | Example: '7' |
*/
new DataColumn("RecordTypeCode", typeof(string)) {
DefaultValue = "7",
ExtendedProperties = {
{ "Caption", "Record Type Code" },
{ "Description", "Identifies the type of record; '7' for Addenda Record." },
{ "Explanation", "Marks the record as a payee name addendum in the file." },
{ "Example", "7" },
{ "Position", 1 },
{ "Length", 1 },
{ "Required", true },
{ "Contents", "7" },
{ "PadChar", "" },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^7$" }
}
},
// 2. Addenda Type Code
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Addenda Type Code | 'P' | 02-02 | 1 | 'P' | Indicates the data type. Must be 'P' for Payee Name. |
* | | | | | | Example: 'P' |
*/
new DataColumn("AddendaTypeCode", typeof(string)) {
DefaultValue = "P",
ExtendedProperties = {
{ "Caption", "Addenda Type Code" },
{ "Description", "Indicates the data type." },
{ "Explanation", "Must be 'P' for Payee Name." },
{ "Example", "P" },
{ "Position", 2 },
{ "Length", 1 },
{ "Required", true },
{ "Contents", "P" },
{ "PadChar", "" },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^P$" }
}
},
// 3. Addenda Sequence Number
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Addenda Sequence Number | Numeric | 03-03 | 1 | '1', '2', '3' | Indicates the position or sequence of the Payee Name. |
* | | | | | | Example: '1' |
*/
new DataColumn("AddendaSequenceNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Addenda Sequence Number" },
{ "Description", "Indicates the position or sequence of the Payee Name." },
{ "Explanation", "Will be 1, 2, or 3." },
{ "Example", "1" },
{ "Position", 3 },
{ "Length", 1 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "" },
{ "PadLeft", false },
{ "SpecialFormat", "" },
{ "Regexp", "^[1-3]$" }
}
},
// 4. Account Number
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Account Number | Numeric | 04-20 | 17 | | The account number, right justified and zero filled with no dashes. |
* | | | | | | Example: '00000000000001234' |
*/
new DataColumn("AccountNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Account Number" },
{ "Description", "The account number, right justified and zero filled." },
{ "Explanation", "Should be right justified, zero filled, no dashes." },
{ "Example", "00000000000001234" },
{ "Position", 4 },
{ "Length", 17 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^[0-9]{17}$" }
}
},
// 5. Serial Number (Check Number)
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Serial Number (Check Number) | '0000012345' | 21-30 | 10 | | The check number, right justified and zero filled no dashes. |
* | | | | | | Example: '0000012345' |
*/
new DataColumn("SerialNumber", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Serial Number" },
{ "Description", "The check number, right justified and zero filled." },
{ "Explanation", "Should be right justified, zero filled, no dashes." },
{ "Example", "0000012345" },
{ "Position", 21 },
{ "Length", 10 },
{ "Required", true },
{ "Contents", "Numeric" },
{ "PadChar", "0" },
{ "PadLeft", true },
{ "SpecialFormat", "" },
{ "Regexp", "^[0-9]{10}$" }
}
},
// 6. Payee Name
/*
* | Field | Value | Position | Length | Other Possible Values | Description |
* |--------------------------------|---------------------|----------|--------|-----------------------------------|-----------------------------------------------------------------------------|
* | Payee Name | Alphameric | 31-80 | 50 | Any valid name | The name of the payee. |
* | | | | | | Up to 3 payee name addendum records can be sent per issue. Names should be identical (space for space) to those on the check. |
* | | | | | | Example: 'JOHN DOE ...' |
*/
new DataColumn("PayeeName", typeof(string)) {
ExtendedProperties = {
{ "Caption", "Payee Name" },
{ "Description", "The name of the payee." },
{ "Explanation", "Up to 3 payee name addendum records can be sent per issue. Names should be identical (space for space) to those on the check." },
{ "Example", "JOHN DOE" },
{ "Position", 31 },
{ "Length", 50 },
{ "Required", true },
{ "Contents", "Alphameric" },
{ "PadChar", " " },
{ "PadLeft", false },
{ "SpecialFormat", "PrintableAsciiOnly" },
{ "Regexp", "^[ -~]{1,50}$" }
}
}
}
}
}
};
Maybe Jose let’s me present at Insights how we build a better Payment System 