Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit c1167ca

Browse files
author
James Cori
committed
Missing Import
1 parent 93f5e07 commit c1167ca

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/services/paymentService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Payment Service
33
* Interacts with InformixDB
44
*/
5+
const util = require('util')
56
const logger = require('../common/logger')
67
const helper = require('../common/helper')
78
const config = require('config');
@@ -58,7 +59,7 @@ async function paymentExists(payment) {
5859
logger.debug(`Checking if paymentExists - ${query}`)
5960
return connection.queryAsync(query)
6061
} catch (e) {
61-
logger.error(`Error in 'getGroupsForChallenge' ${e}`)
62+
logger.error(`Error in 'paymentExists' ${e}`)
6263
throw e
6364
} finally {
6465
await connection.closeAsync()

src/services/processorService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ async function processUpdate(message) {
5757
}, basePayment)
5858

5959
const paymentExists = await paymentService.paymentExists(payment)
60-
if(!paymentExists) {
60+
logger.debug(`Payment Exists Response: ${JSON.stringify(paymentExists)}`)
61+
if(!paymentExists || paymentExists.length === 0) {
6162
await paymentService.createPayment(payment)
6263
} else {
6364
logger.error(`Payment Exists for ${v5ChallengeId}, skipping - ${JSON.stringify(paymentExists)}`)
@@ -86,7 +87,8 @@ async function processUpdate(message) {
8687
typeId: config.COPILOT_PAYMENT_TYPE_ID
8788
}, basePayment)
8889
const paymentExists = await paymentService.paymentExists(copilotPayment)
89-
if(!paymentExists) {
90+
logger.debug(`Copilot Payment Exists Response: ${JSON.stringify(paymentExists)}`)
91+
if(!paymentExists || paymentExists.length === 0) {
9092
await paymentService.createPayment(copilotPayment)
9193
} else {
9294
logger.error(`Copilot Payment Exists for ${v5ChallengeId}, skipping - ${JSON.stringify(paymentExists)}`)

0 commit comments

Comments
 (0)