- 27 Jun 2023
- 1 Minute to read
- Print
- DarkLight
- PDF
Use ChargeLogic Payments with Custom Document Types
- Updated on 27 Jun 2023
- 1 Minute to read
- Print
- DarkLight
- PDF
Please Note
This article is intended for ISVs and other solution providers that have written extensions that implement non-standard Document Types.
Overview
Some industry solutions require adding Document Types to the base system. In these cases, it is sometimes beneficial to be able to take payments from these new Document Types. Because the Document Type field on the EFT Transaction table is an Option field, it cannot be extended by another extension. Therefore, ChargeLogic Payments publishes events for other extensions to subscribe to when Document Type-specific logic is needed.
Integration
Dependencies
Your app.json file must reference the ChargeLogic Payments app as a dependency so that you will have access to the necessary symbols in Visual Studio Code. Here is an example of how to include ChargeLogic Payments as a dependency to your app.
"dependencies": [{
"appId": "0f30fcab-5ea0-4345-ba83-a32015759fbe",
"name": "ChargeLogic Payments",
"publisher": "ChargeLogic, LLC",
"version": "4.0.11.0"
}],
Add a Custom Document Type Field to the EFT Transaction Table
In your extension, create a TableExtension for the EFT Transaction table. Add a new Document Type field of type Option to hold your custom Document Types (e.g., “My Document Type” with Options for Type 1, Type 2, etc.). You will use this field to attach EFT Transactions to your records and set the native Document Type field on the EFT Transaction table to Other.
Create a Subscribers
The EFT Transaction table offers a number of event publishers.
OnSetCurrencyFactorForOtherDocumentType(VAR Tran : Record “EFT Transaction -CL-“)
This fires when the Currency Factor on the EFT Transaction is set to the Currency Factor from the source document. In the event subscriber, you should assign the Currency Factor to the proper value.
OnGetAmountDueForOtherDocumentType(VAR Tran : Record “EFT Transaction -CL-“;VAR AmountDue : Decimal)
This fires whenever ChargeLogic Payments needs to calculate the amount owed on a document. You should populate the AmountDue variable with the AmountDue.
OnCreatePurchaseDataForOtherDocumentType(VAR Tran : Record “EFT Transaction -CL-“;VAR DutyTotal : Decimal;VAR AltTaxTotal : Decimal;VAR FreightTotal : Decimal;VAR InvDiscAmount : Decimal)
This fires when ChargeLogic Payments creates Level II and Level III data. You should populate the EFT Transaction Purchase Line table and populate the DutyTotal, AltTaxTotal, FreightTotal, and InvDiscAmount variables with the appropriate Level II values.
Other functionality can be performed using normal OnAfterValidate events and the subscriber can check for the Document Type of Other to see if it should take action.