Local - FMS ePayment Journal Examples
Somethings are not as obvious as they may seem even when the code required is quite bijou and compact.
XmlDocument d = new XmlDocument();
string fileName = @"c:\temp\journals.xml";
string Server = ".";
string Database = "FMS";
string User = "Sysman";
string Password = "Finance";
string js = "";
using (System.IO.StreamReader sr = new System.IO.StreamReader(fileName))
{
js = sr.ReadToEnd();
}
d.InnerXml = js;
var LedgerProcessor = new CSFMSEJournalInterface.FmsGeneralLedgerProcessor(Server,Database,User,Password);
var Xpath = LedgerProcessor.PostJournals(d);
var navigator = Xpath.CreateNavigator();
Is all of the code needed to inject a bank journal to enable and ePayment system to update FMS.
WORKING EXAMPLE - Note the Guid for the transaction id.
<ControlAccounts xmlns="">
<Header requestedBy="admin@capita.co.uk" responseDateTime="2022-03-18T00:00:00" systemIdentifier="TPPCS" description="Test Journal" submissionID="0071" source="Test Harness" sourceVersion="1.0.0.1" transactionLineCount="2" />
<Banks>
<Bank reference="BK1" controlTotal="0.0">
<Orders lastRowVersion="8573">
<Txn id="c5fba7d6-134f-4149-b42c-6011f0fa81c2" externalReference="64562/2" productReference="WATBTL1" description="Blazer" date="2022-03-18T00:00:00" grossAmount="12.15" vat="0.00" vatReference="VAT_EXEMPT" grossSurcharge="0.15" surchargeReference="SURCHARGE" surchargeVat="0.00" surchargeVatReference="S_VAT_EXEMPT" />
</Orders>
<OrderReversals lastRowVersion="8573" />
<Settlements lastRowVersion="8573" >
<Txn id="c5fba7d6-134f-4149-b42c-6011f0fa81c1" externalReference="64562/1" fileDescription="Tue, 03 May 2016" bacsReference="BACS1" bacsDescription="BACS1" description="Blazer" date="2022-03-18T00:00:00" grossAmount="12.15" grossSurcharge="0.15" grossCharges="0.19" chargesReference="CHARGE30" chargesVat="0.00" chargesVatReference="CHARGEVAT0" />
</Settlements>
<SettlementReversals lastRowVersion="8573" />
</Bank>
</Banks>
</ControlAccounts>
Clues to help debugging
- The transaction line count is equal to the sum of the orders, order reversals, settlements and settlement reversals.
- All codes used must be correct and have been entered in the Payment System Mapping Screen in FMS.
- The dates must be within an open period in FMS
- ids need to be unique and a GUID is recommended.
- Control totals must be maintained in the external system unless each and every journal posted is a 'balanced' journal with a control total of zero.
- BACS Reference in our example did not have to be an existing code or unique.
- Look at the Xpath variable and it offers some meaningful error codes, however some errors can be spurious and almost impossible to debug.
WARNING - THIS EXAMPLE FAILS - ALL OF THE CODES EXIST!
<?xml version="1.0" encoding="utf-8"?>
<ControlAccounts>
<Header requestedBy="admin@capita.co.uk" responseDateTime="2022-03-18T00:00:00" systemIdentifier="TPPCS" description="Test Journal" submissionID="0071" source="Test Harness" sourceVersion="1.0.0.1" transactionLineCount="2" />
<Banks>
<Bank reference="BK1" controlTotal="0">
<Orders lastRowVersion="1">
<Txn id="1" productReference="WATBTL1" description="Description" date="2022-03-18T00:00:00" grossAmount="9.000000" vat="1.500000" vatReference="VAT20" />
</Orders>
<Settlements lastRowVersion="1">
<Txn id="1" description="Description" date="2022-03-18T00:00:00" grossAmount="9.000000" grossCharges="0.30" chargesReference="CHARGE30" chargesVat="0.00" chargesVatReference="CHARGEVAT0" />
</Settlements>
</Bank>
</Banks>
</ControlAccounts>
The above example is one such spurious failure and best indication is that the error is caused by a duplicated id of '1'.