Skip to content

Commit

Permalink
Remove magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
jaucourt committed Dec 6, 2024
1 parent a0362b6 commit 448c45c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { executeQuery, findDueRecurringPayments, RecurringPayment } from '@defra-fish/dynamics-lib'
import { createHash } from 'node:crypto'
import { ADVANCED_PURCHASE_MAX_DAYS } from '@defra-fish/business-rules-lib'
import moment from 'moment'

export const getRecurringPayments = date => executeQuery(findDueRecurringPayments(date))

const getNextDueDate = (startDate, issueDate, endDate) => {
const mStart = moment(startDate)
if (mStart.isAfter(moment(issueDate)) && mStart.isSameOrBefore(moment(issueDate).add(30, 'days'), 'day')) {
if (mStart.isAfter(moment(issueDate)) && mStart.isSameOrBefore(moment(issueDate).add(ADVANCED_PURCHASE_MAX_DAYS, 'days'), 'day')) {
if (mStart.isSame(moment(issueDate), 'day')) {
return moment(startDate).add(1, 'year').subtract(10, 'days').startOf('day').toISOString()
}
Expand Down

0 comments on commit 448c45c

Please sign in to comment.