4
4
*/
5
5
const logger = require ( '../common/logger' )
6
6
const helper = require ( '../common/helper' )
7
+ const config = require ( 'config' ) ;
7
8
const IDGenerator = require ( '../common/idGenerator' )
8
9
9
10
// the paymentDetailId's generator
@@ -18,6 +19,8 @@ const INSERT_PAYMENT = 'INSERT INTO payment (payment_id, user_id, most_recent_de
18
19
// the insert statement of payment detail xref
19
20
const INSERT_PAYMENT_DETAIL_XREF = 'INSERT INTO payment_detail_xref (payment_id, payment_detail_id) VALUES(?,?)'
20
21
22
+ const INSERT_PAYMENT_STATUS_REASON_XREF = 'INSERT INTO payment_detail_status_reason_xref (payment_detail_id, payment_status_reason_id) VALUES(?,?)'
23
+
21
24
/**
22
25
* Prepare Informix statement
23
26
* @param {Object } connection the Informix connection
@@ -46,6 +49,8 @@ async function createPayment (payment) {
46
49
await insertPayment . executeAsync ( [ paymentId , payment . memberId , paymentDetailId ] )
47
50
const insertDetailXref = await prepare ( connection , INSERT_PAYMENT_DETAIL_XREF )
48
51
await insertDetailXref . executeAsync ( [ paymentId , paymentDetailId ] )
52
+ const insertStatusXref = await prepare ( connection , INSERT_PAYMENT_STATUS_REASON_XREF )
53
+ await insertStatusXref . executeAsync ( [ paymentDetailId , config . V5_PAYMENT_DETAIL_STATUS_REASON_ID ] )
49
54
logger . info ( `Payment ${ paymentId } with detail ${ paymentDetailId } has been inserted` )
50
55
await connection . commitTransactionAsync ( )
51
56
} catch ( e ) {
0 commit comments