Skip to content

Commit

Permalink
handle not async
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Dormand authored and Scott Dormand committed Jan 21, 2025
1 parent d2f5d80 commit 6e9739f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jest.mock('@defra-fish/connectors-lib', () => ({

jest.mock('../services/govuk-pay-service.js', () => ({
sendPayment: jest.fn(),
getPaymentStatus: jest.fn()
getPaymentStatus: jest.fn(() => Promise.resolve('Success'))
}))

describe('recurring-payments-processor', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ const processRecurringPaymentStatus = async record => {
const referenceNumber = record.expanded.activePermission.entity.referenceNumber
const paymentId = getPaymentId(referenceNumber)
console.log('Checking payment status for', paymentId)
const status = await getPaymentStatus(paymentId)
console.log(`Payment status for ${paymentId}: ${status}`)
getPaymentStatus(paymentId).then(status => {
console.log(`Payment status for ${paymentId}: ${status}`)
})
}

const getPaymentId = referenceNumber => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const sendPayment = preparedPayment => {
govUkPayApi.createPayment(preparedPayment, true)
}

export const getPaymentStatus = async paymentId => {
export const getPaymentStatus = paymentId => {
govUkPayApi.fetchPaymentStatus(paymentId, true)
}

0 comments on commit 6e9739f

Please sign in to comment.