E-Payment Integrator 2022 macOS Edition
Version 22.0 [Build 8593]

ACHConverter Module

Properties   Methods   Events   Config Settings   Errors  

The ACHConverter module is used to convert ACH files into XML, for the purpose of easy viewing and editing. The module can also convert this XML back into the ACH format, so it may later be processed by the ACH network. Validation of these files occurs during the translation process.

Syntax

InPay.Achconverter

Remarks

This class is used for translating ACH files back and forth between the complex data format used by the ACH network and simple XML. By representing an ACH file as an XML structure, the viewing, parsing, and editing of individual ACH records can be easily accomplished. An XML document can be built from scratch and then use the ACHConverter class to convert it to ACH format.

The ConvertACH and ConvertXML methods are used to go back and forth between the ACH format and XML formats. ConvertACH converts from ACH to XML, and ConvertXML converts from XML back into ACH format. The data to be converted is specified by SetInputStream, InputFile or InputString, and the results are written to SetOutputStream, OutputFile or OutputString.

When the parsing is taking place, the source file is checked for validity in several different ways. The format and sequence of the records in the file is checked, as well as the data in each field in a record. Any formatting error or incorrect data (for instance, a character in an numeric-only field) will cause the validity checks to fail. In addition, the totals in each Batch Control Record and in the final File Control Record are checked against values computed as the class parses each record (this last check may be overridden by the VerifyMode property).

For example: ACHConverter1.InputFile = "c:\achtestfile.txt" ACHConverter1.OutputFile = "c:\xmltestfile.xml" ACHConverter1.VerifyMode = vmValidateTotals ACHConverter1.ConvertACH()

After the above code completes successfully, "c:\xmltestfile.xml" will contain the XML representation of the input ACH file. In addition, the following properties will be filled with information about the ACH file that was just parsed:

Note: The XML document created (and parsed) by this class is defined in the Schema property.

Property List


The following is the full list of the properties of the module with short descriptions. Click on the links for further details.

FileBatchCountTotal number of batches contained in the file.
FileBlockCountTotal number of blocks in a file.
FileCreditTotalTotal amount credited to the merchant's bank account.
FileDebitTotalTotal amount debited from the merchant's bank account.
FileEntryCountTotal number of entries in a file.
FileEntryHashHash of the routing numbers from each detail record in the file.
InputFileSpecifies the file to read data from when calling ConvertXML or ConvertACH .
InputStringData in memory to read from when calling ConvertXML or ConvertACH .
OutputFileSpecifies the file data is written to when calling ConvertXML or ConvertACH .
OutputStringContains the results from ConvertXML or ConvertACH .
SchemaReturns the XSD Schema used to create XML from ACH files.
VerifyModeDetermines how the totals in the Batch and File control records are validated.

Method List


The following is the full list of the methods of the module with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
ConvertACHConverts a file from ACH format into XML.
ConvertXMLConverts an XML file into ACH format.
ResetReset the internal state of the module and all properties to their default values.

Event List


The following is the full list of the events fired by the module with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.

Config Settings


The following is a list of config settings for the module with short descriptions. Click on the links for further details.

CloseStreamAfterConversionIf true, the module will close the output stream after conversion.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
MaskSensitiveWhether sensitive data is masked in log messages.
UseInternalSecurityAPITells the module whether or not to use the system security libraries or an internal implementation.

FileBatchCount Property (ACHConverter Module)

Total number of batches contained in the file.

Syntax

public var fileBatchCount: Int64 {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileBatchCount) long long fileBatchCount;

- (long long)fileBatchCount;

Default Value

0

Remarks

A file may contain a minimum of 1 and a maximum of 999999 batches.

This property is read-only.

FileBlockCount Property (ACHConverter Module)

Total number of blocks in a file.

Syntax

public var fileBlockCount: Int64 {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileBlockCount) long long fileBlockCount;

- (long long)fileBlockCount;

Default Value

0

Remarks

Each block consists of 10 records, or approximately 960 characters.

This property is read-only.

FileCreditTotal Property (ACHConverter Module)

Total amount credited to the merchant's bank account.

Syntax

public var fileCreditTotal: String {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileCreditTotal) NSString* fileCreditTotal;

- (NSString*)fileCreditTotal;

Default Value

"0"

Remarks

This property contains the total amount of all transactions that credit funds to the merchant's account (this is a gross amount).

This property is read-only.

FileDebitTotal Property (ACHConverter Module)

Total amount debited from the merchant's bank account.

Syntax

public var fileDebitTotal: String {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileDebitTotal) NSString* fileDebitTotal;

- (NSString*)fileDebitTotal;

Default Value

"0"

Remarks

This property contains the total amount of all transactions that debit funds from the merchant's account (this is a gross amount).

This property is read-only.

FileEntryCount Property (ACHConverter Module)

Total number of entries in a file.

Syntax

public var fileEntryCount: Int32 {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileEntryCount) int fileEntryCount;

- (int)fileEntryCount;

Default Value

0

Remarks

An entry is defined as a Detail Record or an Addenda Record. Header and Control records are ignored.

This property is read-only.

FileEntryHash Property (ACHConverter Module)

Hash of the routing numbers from each detail record in the file.

Syntax

public var fileEntryHash: String {
  get {...}
}

@property (nonatomic,readonly,assign,getter=fileEntryHash) NSString* fileEntryHash;

- (NSString*)fileEntryHash;

Default Value

"0"

Remarks

This property contains a 10-character long hash of all of the recipient routing numbers in the file. This is used as a check to ensure that no records were lost in the transmission of this ACH file.

This property is read-only.

InputFile Property (ACHConverter Module)

Specifies the file to read data from when calling ConvertXML or ConvertACH .

Syntax

public var inputFile: String {
  get {...}
  set {...}
}

@property (nonatomic,readwrite,assign,getter=inputFile,setter=setInputFile:) NSString* inputFile;

- (NSString*)inputFile;
- (void)setInputFile :(NSString*)newInputFile;

Default Value

""

Remarks

This property contains the path and filename to the ACH or XML file you wish to parse and convert.

InputString Property (ACHConverter Module)

Data in memory to read from when calling ConvertXML or ConvertACH .

Syntax

public var inputString: String {
  get {...}
  set {...}
}

@property (nonatomic,readwrite,assign,getter=inputString,setter=setInputString:) NSString* inputString;

- (NSString*)inputString;
- (void)setInputString :(NSString*)newInputString;

Default Value

""

Remarks

This property contains the ACH or XML data, in memory, that you wish to parse and convert.

OutputFile Property (ACHConverter Module)

Specifies the file data is written to when calling ConvertXML or ConvertACH .

Syntax

public var outputFile: String {
  get {...}
  set {...}
}

@property (nonatomic,readwrite,assign,getter=outputFile,setter=setOutputFile:) NSString* outputFile;

- (NSString*)outputFile;
- (void)setOutputFile :(NSString*)newOutputFile;

Default Value

""

Remarks

This property contains the path and filename where you wish to store your converted results.

OutputString Property (ACHConverter Module)

Contains the results from ConvertXML or ConvertACH .

Syntax

public var outputString: String {
  get {...}
}

@property (nonatomic,readonly,assign,getter=outputString) NSString* outputString;

- (NSString*)outputString;

Default Value

""

Remarks

If SetOutputStream and OutputFile have not been set, the results of the ConvertXML or ConvertACH methods will be stored in memory and returned by the OutputString property.

This property is read-only.

Schema Property (ACHConverter Module)

Returns the XSD Schema used to create XML from ACH files.

Syntax

public var schema: String {
  get {...}
}

@property (nonatomic,readonly,assign,getter=schema) NSString* schema;

- (NSString*)schema;

Default Value

""

Remarks

This property returns the schema (XSD format) that the class uses to generate XML from an ACH file. This same schema is used when parsing XML to re-create an ACH file. During the parsing process, if the input XML does not conform to the schema the translation process will fail with an error.

This property is read-only.

VerifyMode Property (ACHConverter Module)

Determines how the totals in the Batch and File control records are validated.

Syntax

public var verifyMode: AchconverterVerifyModes {
  get {...}
  set {...}
}

public enum AchconverterVerifyModes: Int32 { case vmValidateTotals = 0 case vmComputeTotals = 1 case vmNoValidation = 2 }

@property (nonatomic,readwrite,assign,getter=verifyMode,setter=setVerifyMode:) int verifyMode;

- (int)verifyMode;
- (void)setVerifyMode :(int)newVerifyMode;

Default Value

0

Remarks

Batch Control Records contain several fields that provide information about each batch included in the ACH file. These include an Entry Count (number of records in the batch), Credit Total (total funds added to the merchant's account), Debit Total (total of funds removed from the merchant's account), and a hash used to verify that there are no missing transactions. The ending File Control record contains similar information about the entire batch The final record in an ACH file is the File Control Record. This record contains several fields that provide information about all of the batches and all of the transactions in the ACH file. These fields are exposed in the following properties:

FileBatchCountTotal number of batches contained in this ACH File.
FileBlockCountTotal number of blocks (each block consists of 960 characters).
FileCreditTotalGross amount of funds deposited into the merchant's account.
FileDebitTotalGross amount of funds removed from the merchant's account
FileEntryCountTotal number of entries in the file (sum of all entries in each batch)
FileEntryHashUsed to validate that there are no transactions missing from the file

There are similar fields for each of the batches contained within the ACH file, but only the final totals are exposed. The class carefully computes these values as the input is parsed, and the table below shows how they are validated:

Verify ModeDescription
vmValidateTotals (0)The totals listed in each control record in the file are compared against the totals that the class computes itself. If there is any mismatch, the class fails with an error.
vmComputeTotals (1)The totals listed in each control record in the file are ignored. The values computed by the class are substituted. This is useful when adding or removing records from the ACH or XML files.
vmNoValidation (2)No validation is performed. The values in the file are used, and the computed values are ignored.

Config Method (ACHConverter Module)

Sets or retrieves a configuration setting.

Syntax

public func config(configurationString: String) throws -> String
- (NSString*)config:(NSString*)configurationString;

Remarks

Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

ConvertACH Method (ACHConverter Module)

Converts a file from ACH format into XML.

Syntax

public func convertACH() throws -> Void
- (void)convertACH;

Remarks

This method converts an ACH-formatted file into an XML format. This XML can easily be viewed, edited, or otherwise manipulated, and then converted back to ACH format at a later date using the ConvertXML method. The source ACH file can be specified by the SetInputStream method or the InputFile and InputString properties, and the destination XML by the SetOutputStream method or OutputFile, and OutputString properties.

When the ConvertACH method is called, the source ACH file is validated in several ways. The format of each record in the file is checked before it is converted to XML. The validity of data contained within each field in the record is also checked. Any formatting error or incorrect data (for instance, a character in an integer-only field) will cause the class to fail with an error.

In addition, each ACH file contains several Batch Control records and a final File Control Record. These records contain information about the transactions contained within the ACH file. The data contained within these control records is used to make sure the ACH files have not been corrupted, and have not lost records in the transmission process. The class will by default validate the data contained in these control records. However, you can override this functionality by changing the VerifyMode (note that VerifyMode does not affect the format or data validity checks).

ConvertXML Method (ACHConverter Module)

Converts an XML file into ACH format.

Syntax

public func convertXML() throws -> Void
- (void)convertXML;

Remarks

The ConvertACH method takes an industry-standard ACH file and converts it into an XML file. This XML can easily be viewed, edited, or otherwise manipulated. The ConvertXML method takes that modified XML and converts it back into an ACH file so that it can be processed.

The source XML can be specified by the SetInputStream method, or the InputFile and InputString properties, and the destination ACH file by the SetOutputStream method or the OutputFile and OutputString properties.

When the ConvertXML method is called, the source XML is validated in several ways. First, the XML format is validated. Unclosed tags and other editing mistakes will cause the class to be unable to parse the XML. The XML is then validated against the Schema. If any of the tags are missing or out of place, the class will be unable to parse the XML. Finally, each data field contained within an XML tag is then validated for the correct length and formatting (for instance, a character in an integer-only field will cause the class to fail with an error).

In addition, each XML file contains several Batch Control records and a final File Control Record. These records contain information about the transactions contained within the XML-formatted ACH file's Detail Records. The data contained within these control records is used to make sure the ACH files have not been corrupted, and have not lost records in the transmission process.

If you have made changes to the XML and you do not wish to manually compute the new Debit Total, Credit Total, Entry Count, and Entry Hash for each Batch Control record in the XML, you can set VerifyMode to vmComputeTotals, and allow the class to compute these values for you.

Reset Method (ACHConverter Module)

Reset the internal state of the component and all properties to their default values.

Syntax

public func reset() throws -> Void
- (void)reset;

Remarks

The Reset method doesn't have any parameters and doesn't return any value.

Error Event (ACHConverter Module)

Information about errors during data delivery.

Syntax

func onError(errorCode: Int32, description: String)
- (void)onError:(int)errorCode :(NSString*)description;

Remarks

The Error event is fired in case of exceptional conditions during message processing.

ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.

Config Settings (ACHConverter Module)

The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

ACHConverter Config Settings

CloseStreamAfterConversion:   If true, the component will close the output stream after conversion.

This property is true by default. Therefore, by default, the output stream will be closed after conversion is completed. In order to keep streams open after the conversion completes, you must set this config to false.

Base Config Settings

BuildInfo:   Information about the product's build.

When queried, this setting will return a string containing information about the product's build.

CodePage:   The system code page used for Unicode to Multibyte translations.

The default code page is Unicode UTF-8 (65001).

The following is a list of valid code page identifiers:

IdentifierName
037IBM EBCDIC - U.S./Canada
437OEM - United States
500IBM EBCDIC - International
708Arabic - ASMO 708
709Arabic - ASMO 449+, BCON V4
710Arabic - Transparent Arabic
720Arabic - Transparent ASMO
737OEM - Greek (formerly 437G)
775OEM - Baltic
850OEM - Multilingual Latin I
852OEM - Latin II
855OEM - Cyrillic (primarily Russian)
857OEM - Turkish
858OEM - Multilingual Latin I + Euro symbol
860OEM - Portuguese
861OEM - Icelandic
862OEM - Hebrew
863OEM - Canadian-French
864OEM - Arabic
865OEM - Nordic
866OEM - Russian
869OEM - Modern Greek
870IBM EBCDIC - Multilingual/ROECE (Latin-2)
874ANSI/OEM - Thai (same as 28605, ISO 8859-15)
875IBM EBCDIC - Modern Greek
932ANSI/OEM - Japanese, Shift-JIS
936ANSI/OEM - Simplified Chinese (PRC, Singapore)
949ANSI/OEM - Korean (Unified Hangul Code)
950ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC)
1026IBM EBCDIC - Turkish (Latin-5)
1047IBM EBCDIC - Latin 1/Open System
1140IBM EBCDIC - U.S./Canada (037 + Euro symbol)
1141IBM EBCDIC - Germany (20273 + Euro symbol)
1142IBM EBCDIC - Denmark/Norway (20277 + Euro symbol)
1143IBM EBCDIC - Finland/Sweden (20278 + Euro symbol)
1144IBM EBCDIC - Italy (20280 + Euro symbol)
1145IBM EBCDIC - Latin America/Spain (20284 + Euro symbol)
1146IBM EBCDIC - United Kingdom (20285 + Euro symbol)
1147IBM EBCDIC - France (20297 + Euro symbol)
1148IBM EBCDIC - International (500 + Euro symbol)
1149IBM EBCDIC - Icelandic (20871 + Euro symbol)
1200Unicode UCS-2 Little-Endian (BMP of ISO 10646)
1201Unicode UCS-2 Big-Endian
1250ANSI - Central European
1251ANSI - Cyrillic
1252ANSI - Latin I
1253ANSI - Greek
1254ANSI - Turkish
1255ANSI - Hebrew
1256ANSI - Arabic
1257ANSI - Baltic
1258ANSI/OEM - Vietnamese
1361Korean (Johab)
10000MAC - Roman
10001MAC - Japanese
10002MAC - Traditional Chinese (Big5)
10003MAC - Korean
10004MAC - Arabic
10005MAC - Hebrew
10006MAC - Greek I
10007MAC - Cyrillic
10008MAC - Simplified Chinese (GB 2312)
10010MAC - Romania
10017MAC - Ukraine
10021MAC - Thai
10029MAC - Latin II
10079MAC - Icelandic
10081MAC - Turkish
10082MAC - Croatia
12000Unicode UCS-4 Little-Endian
12001Unicode UCS-4 Big-Endian
20000CNS - Taiwan
20001TCA - Taiwan
20002Eten - Taiwan
20003IBM5550 - Taiwan
20004TeleText - Taiwan
20005Wang - Taiwan
20105IA5 IRV International Alphabet No. 5 (7-bit)
20106IA5 German (7-bit)
20107IA5 Swedish (7-bit)
20108IA5 Norwegian (7-bit)
20127US-ASCII (7-bit)
20261T.61
20269ISO 6937 Non-Spacing Accent
20273IBM EBCDIC - Germany
20277IBM EBCDIC - Denmark/Norway
20278IBM EBCDIC - Finland/Sweden
20280IBM EBCDIC - Italy
20284IBM EBCDIC - Latin America/Spain
20285IBM EBCDIC - United Kingdom
20290IBM EBCDIC - Japanese Katakana Extended
20297IBM EBCDIC - France
20420IBM EBCDIC - Arabic
20423IBM EBCDIC - Greek
20424IBM EBCDIC - Hebrew
20833IBM EBCDIC - Korean Extended
20838IBM EBCDIC - Thai
20866Russian - KOI8-R
20871IBM EBCDIC - Icelandic
20880IBM EBCDIC - Cyrillic (Russian)
20905IBM EBCDIC - Turkish
20924IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol)
20932JIS X 0208-1990 & 0121-1990
20936Simplified Chinese (GB2312)
21025IBM EBCDIC - Cyrillic (Serbian, Bulgarian)
21027Extended Alpha Lowercase
21866Ukrainian (KOI8-U)
28591ISO 8859-1 Latin I
28592ISO 8859-2 Central Europe
28593ISO 8859-3 Latin 3
28594ISO 8859-4 Baltic
28595ISO 8859-5 Cyrillic
28596ISO 8859-6 Arabic
28597ISO 8859-7 Greek
28598ISO 8859-8 Hebrew
28599ISO 8859-9 Latin 5
28605ISO 8859-15 Latin 9
29001Europa 3
38598ISO 8859-8 Hebrew
50220ISO 2022 Japanese with no halfwidth Katakana
50221ISO 2022 Japanese with halfwidth Katakana
50222ISO 2022 Japanese JIS X 0201-1989
50225ISO 2022 Korean
50227ISO 2022 Simplified Chinese
50229ISO 2022 Traditional Chinese
50930Japanese (Katakana) Extended
50931US/Canada and Japanese
50933Korean Extended and Korean
50935Simplified Chinese Extended and Simplified Chinese
50936Simplified Chinese
50937US/Canada and Traditional Chinese
50939Japanese (Latin) Extended and Japanese
51932EUC - Japanese
51936EUC - Simplified Chinese
51949EUC - Korean
51950EUC - Traditional Chinese
52936HZ-GB2312 Simplified Chinese
54936Windows XP: GB18030 Simplified Chinese (4 Byte)
57002ISCII Devanagari
57003ISCII Bengali
57004ISCII Tamil
57005ISCII Telugu
57006ISCII Assamese
57007ISCII Oriya
57008ISCII Kannada
57009ISCII Malayalam
57010ISCII Gujarati
57011ISCII Punjabi
65000Unicode UTF-7
65001Unicode UTF-8

The following is a list of valid code page identifiers for Mac OS only:

IdentifierName
1ASCII
2NEXTSTEP
3JapaneseEUC
4UTF8
5ISOLatin1
6Symbol
7NonLossyASCII
8ShiftJIS
9ISOLatin2
10Unicode
11WindowsCP1251
12WindowsCP1252
13WindowsCP1253
14WindowsCP1254
15WindowsCP1250
21ISO2022JP
30MacOSRoman
10UTF16String
0x90000100UTF16BigEndian
0x94000100UTF16LittleEndian
0x8c000100UTF32String
0x98000100UTF32BigEndian
0x9c000100UTF32LittleEndian
65536Proprietary

LicenseInfo:   Information about the current license.

When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

  • Product: The product the license is for.
  • Product Key: The key the license was generated from.
  • License Source: Where the license was found (e.g., RuntimeLicense, License File).
  • License Type: The type of license installed (e.g., Royalty Free, Single Server).
  • Last Valid Build: The last valid build number for which the license will work.
MaskSensitive:   Whether sensitive data is masked in log messages.

In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to to mask sensitive data. The default is .

This setting only works on these classes: AS3Receiver, AS3Sender, Atom, Client(3DS), FTP, FTPServer, IMAP, OFTPClient, SSHClient, SCP, Server(3DS), Sexec, SFTP, SFTPServer, SSHServer, TCPClient, TCPServer.

UseInternalSecurityAPI:   Tells the class whether or not to use the system security libraries or an internal implementation.

When set to , the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this setting to tells the class to use the internal implementation instead of using the system security libraries.

This setting is set to by default on all platforms.

Trappable Errors (ACHConverter Module)

Copyright (c) 2023 4D Payments Inc.
E-Payment Integrator 2022 macOS Edition - Version 22.0 [Build 8593]