This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 2
2
* Payment Service
3
3
* Interacts with InformixDB
4
4
*/
5
+ const util = require ( 'util' )
5
6
const logger = require ( '../common/logger' )
6
7
const helper = require ( '../common/helper' )
7
8
const config = require ( 'config' ) ;
@@ -58,7 +59,7 @@ async function paymentExists(payment) {
58
59
logger . debug ( `Checking if paymentExists - ${ query } ` )
59
60
return connection . queryAsync ( query )
60
61
} catch ( e ) {
61
- logger . error ( `Error in 'getGroupsForChallenge ' ${ e } ` )
62
+ logger . error ( `Error in 'paymentExists ' ${ e } ` )
62
63
throw e
63
64
} finally {
64
65
await connection . closeAsync ( )
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ async function processUpdate(message) {
57
57
} , basePayment )
58
58
59
59
const paymentExists = await paymentService . paymentExists ( payment )
60
- if ( ! paymentExists ) {
60
+ logger . debug ( `Payment Exists Response: ${ JSON . stringify ( paymentExists ) } ` )
61
+ if ( ! paymentExists || paymentExists . length === 0 ) {
61
62
await paymentService . createPayment ( payment )
62
63
} else {
63
64
logger . error ( `Payment Exists for ${ v5ChallengeId } , skipping - ${ JSON . stringify ( paymentExists ) } ` )
@@ -86,7 +87,8 @@ async function processUpdate(message) {
86
87
typeId : config . COPILOT_PAYMENT_TYPE_ID
87
88
} , basePayment )
88
89
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 ) {
90
92
await paymentService . createPayment ( copilotPayment )
91
93
} else {
92
94
logger . error ( `Copilot Payment Exists for ${ v5ChallengeId } , skipping - ${ JSON . stringify ( paymentExists ) } ` )
You can’t perform that action at this time.
0 commit comments