UNPKG

@defra-fish/dynamics-lib

Version:

Framework to support integration with dynamics

21 lines (17 loc) 674 B
import { RecurringPayment } from '../entities/recurring-payment.entity.js' import { PredefinedQuery } from './predefined-query.js' /** * Builds a query to retrieve active recurring payment and related entities for a given date * * @param date current date used for lookup * @returns {PredefinedQuery} */ export const findDueRecurringPayments = date => { const { contact, activePermission } = RecurringPayment.definition.relationships const filter = `Microsoft.Dynamics.CRM.On(PropertyName='defra_nextduedate', PropertyValue='${date}')` return new PredefinedQuery({ root: RecurringPayment, filter: filter, expand: [contact, activePermission] }) }