Skip to content

Point of Sale Matching

Chelsea edited this page Nov 24, 2023 · 3 revisions

Home > Features > Record Matching > Point Of Sale Matching


POS Matching

Overview

The PosReconciliationService handles the reconciliation of POS (Point of Sale) payments with POS deposits. It provides methods to match payments with deposits based on location, program, date, and time using heuristics.

Usage

1. Configuration

Service can be set to use the appropriate heuristics for your ministry. This is done using the setHeuristics method.

service.setHeuristics(ministry: Ministries): void;
  • ministry: The ministry for which heuristics need to be set, represented by an enum value (e.g., Ministries.SBC). This determines the matching rules.

2. Reconciliation

This method matches pending payments with pending deposits based on the configured heuristics.

async reconcile(
  location: MinistryLocationEntity,
  pendingPayments: PaymentEntity[],
  pendingDeposits: POSDepositEntity[],
  currentDate: Date
): Promise<unknown>;
  • location: The location for which reconciliation is being performed, represented as a MinistryLocationEntity object.

  • pendingPayments: An array of pending payment entities (e.g., PaymentEntity[]) that need to be matched with deposits.

  • pendingDeposits: An array of pending deposit entities (e.g., POSDepositEntity[]) that need to be matched with payments.

  • currentDate: The current date used for updating the progress of matching operations.

3. Match Results

The reconcile method returns a promise that resolves to an object containing information about the reconciliation process. Here are some of the key properties in the result:

  • type: The type of reconciliation (e.g., ReconciliationType.POS).

  • location_id: The ID of the location for which reconciliation was performed.

  • total_deposits_pending: The total number of pending deposits.

  • total_payments_pending: The total number of pending payments.

  • total_matched_payments: The total number of payments that were successfully matched.

  • total_matched_deposits: The total number of deposits that were successfully matched.

  • total_payments_in_progress: The total number of payments currently in progress.

  • total_deposits_in_progress: The total number of deposits currently in progress.

  • total_payments_updated: The total number of payments updated, including matched and in-progress payments.

  • total_deposits_updated: The total number of deposits updated, including matched and in-progress deposits.

Methods

matchRound

This method is used internally for performing recursive matching rounds.

matchRound(
  payments: PaymentEntity[],
  deposits: POSDepositEntity[],
  round: PosHeuristicRound,
  allMatchedPayments: PaymentEntity[],
  allMatchedDeposits: POSDepositEntity[]
): MatchResults;
  • payments: An array of payment entities to be matched in the current round.

  • deposits: An array of deposit entities to be matched in the current round.

  • round: The current heuristic matching round.

  • allMatchedPayments: An array containing all matched payment entities from previous rounds.

  • allMatchedDeposits: An array containing all matched deposit entities from previous rounds.

findMatchesInDictionary

This method finds matches in dictionaries based on the configured heuristics.

findMatchesInDictionary(
  methodAndDateDictionaries: Dictionary[],
  round: Heuristics
): MatchResults;
  • methodAndDateDictionaries: An array of dictionaries containing payment and deposit information.

  • round: The current heuristic matching round.

buildDictionaries

This method builds dictionaries of payments and deposits based on the current round.

buildDictionaries(
  payments: PaymentEntity[],
  deposits: POSDepositEntity[],
  round: PosHeuristicRound
): Dictionary[];
  • payments: An array of payment entities.

  • deposits: An array of deposit entities.

  • round: The current heuristic matching round.

paymentDictionary

This method creates a dictionary of payment entities.

paymentDictionary(payments: PaymentEntity[]): Dictionary;
  • payments: An array of payment entities to be included in the dictionary.

depositDictionary

This method creates a dictionary of deposit entities.

depositDictionary(
  deposits: POSDepositEntity[],
  round: PosHeuristicRound
): Dictionary;
  • deposits: An array of deposit entities to be included in the dictionary.

  • round: The current heuristic matching round.

Clone this wiki locally