Cash Receipt API

Overview

The following provides information when using the API for the creation of Cash Receipt records including the following:

The cash receipt object is a common integration point for the Accounting Seed Financial Suite. Please note the following:

The following fields are required on the cash receipt object: AcctSeed__Cash_Receipt__c

Field Name API Name Data Type
Customer AcctSeed__Account__c Lookup(Account)
Payment Reference AcctSeed__Amount__c Text(255)
Amount AcctSeed__Amount__c Currency(16,2)

The following fields are required on the Billing Cash Receipt object: AcctSeed__Billing_Cash_Receipt__c

Field Name API Name Data Type
Billing AcctSeed__Billing__c Master-Detail(Billing)
Cash Receipt AcctSeed__Cash_Receipt__c Master-Detail(Cash Receipt)
Accounting Period AcctSeed__Accounting_Period__c Lookup(Accounting Period)
Amount AcctSeed__Applied_Amount__c Currency(16,2)

Cash Receipt Post and Unpost

The following provides information when using the API for the posting or unposting a Cash Receipt via Apex Code. With the release of Accounting Seed Financial Suite 2.21, there is a global class in the Accounting Seed Financial Suite managed package called CashReceiptPostService. This class can be called through Apex Code external to the Accounting Seed Financial Suite package to post or unpost a set of cash receipt records. Please note the following:

This class contains two static global methods. One of the static methods is related to posting cash receipt records and is called postCashReceipts. The other static method is related to unposting cash receipt records and is called unpostCashReceipts.

You cannot call either the post or unpost methods with a set of cash receipt records where the number of cash receipts is more than 1,000. If you need to post or unpost more than 1,000 cash receipts, you will need to call the class static method from a class which supports batch apex.

Each method returns a list of post result records, which will indicate if the billing was posted or unposted successfully. If the record was not posted or unposted successfully, an error status code is provided documenting the reason the record was not posted or unposted.

Cash Receipt Post Service Error Codes

Cash Receipt Post Method

Cash Receipt Unpost Method

Code Example

// Create cash receipt records to post and unpost
AcctSeed__Cash_Receipt__c[] receipts = new List <AcctSeed__Cash_Receipt__c>();

receipts.add(
    new AcctSeed__Cash_Receipt__c(
        AcctSeed__Account__c = [Select Id From Account limit 1].Id,
        AcctSeed__Amount__c = 34,
        AcctSeed__Payment_Reference__c = 'ThisIsATestPaymentReference123'
    )
);

receipts.add(
    new AcctSeed__Cash_Receipt__c(
        AcctSeed__Account__c = [Select Id From Account limit 1].Id,
        AcctSeed__Amount__c = 67,
        AcctSeed__Payment_Reference__c = 'ThisIsATestPaymentReference456'
    )
);

// Initial insert auto posts cash receipts
insert receipts;

// Unpost the cash receipts
AcctSeed.PostResult[] unpostResults = AcctSeed.CashReceiptPostService.unpostCashReceipts(receipts);

// Loop through unpost results
for (AcctSeed.PostResult theResult : unpostResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully unposted cash receipt: ' + theResult.id);
    } 
    else {
        System.debug('Error unposting cash receipt ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}

// Post the cash receipts
AcctSeed.PostResult[] postResults = AcctSeed.CashReceiptPostService.postCashReceipts(receipts);

// Loop through post results
for (AcctSeed.PostResult theResult : postResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully posted billing: ' + theResult.id);
    } 
    else {
        System.debug('Error posting billing ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}