eyght-models
Version:
Models for eyght
123 lines (113 loc) • 4.72 kB
JavaScript
let mongoose = require('mongoose');
mongoose.Promise = global.Promise;
let aggrTxnSchema = new mongoose.Schema({
//txn
aggrCardID: {type: 'String'},
arnNum: {type: 'String'},
authAmt: {type: 'Number'},
authCode: {type: 'String'},
avsCodeID: {type: mongoose.Schema.Types.ObjectId, ref: 'genAvsCode'},
clientID: {type: mongoose.Schema.Types.ObjectId, ref: 'eygClient', required: true},
cvCodeID: {type: mongoose.Schema.Types.ObjectId, ref: 'genCvCode'},
declBktID: {type: mongoose.Schema.Types.ObjectId, ref: 'ssCCDeclBkt'},
declCollDt: {type: 'Date'}, //store all dates in utc
domIntlCatID: {type: mongoose.Schema.Types.ObjectId, ref: 'genDomIntlCat'},
entryType: {type: 'String'},
exchRt: {type: 'Number'},
exchRtFound: {type: 'Boolean'},
fraudRespCode: {type: 'String'},
fraudRespDesc: {type: 'String'},
functAmt: {type: 'Number'},
functAuthAmt: {type: 'Number'},
functCurrID: {type: mongoose.Schema.Types.ObjectId, ref: 'genCurr'},
grossAmt: {type: 'Number'},
gwBatchNum: {type: 'String'},
gwID: {type: mongoose.Schema.Types.ObjectId, ref: 'genAggr', required: true},
gwProcMapped: {type: 'Boolean'},
invDesc: {type: 'String'},
invNum: {type: 'String'},
ipAddr: {type: 'String'},
mccCode: {type: 'String'},
midID: {type: mongoose.Schema.Types.ObjectId, ref: 'eygClientMid', required: true},
opportunity: {type: 'Boolean'},
origTxnRefrID: {type: 'String'},
preventable: {type: 'Boolean'},
procBatchNum: {type: 'String'},
procID: {type: mongoose.Schema.Types.ObjectId, ref: 'genAggr', required: true},
rawTxnIDs: [{type: 'String'}], //these ids can come from: 1 - the raw transactions in aggrTxnHolding db in the client's raw data collection; 2 - the ssMoFee collection
respCodeID: {type: mongoose.Schema.Types.ObjectId, ref: 'genCCRespCode'},
settleDt: {type: 'Date'}, //store all dates in utc
tokenNum: {type: 'String'},
txnAmt: {type: 'Number'},
txnBktID: {type: mongoose.Schema.Types.ObjectId, ref: 'ssTxnBkt'},
txnCurrID: {type: mongoose.Schema.Types.ObjectId, ref: 'genCurr'},
txnDt: {type: 'Date'}, //store all dates in utc
txnGuid: {type: 'String'},
txnID: {type: 'String'},
txnRefrID: {type: 'String'},
txnTypeID: {type: mongoose.Schema.Types.ObjectId, ref: 'ssTxnType'},
//cust
aggrCustID: {type: 'String'},
ccID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCustCC'},
custAddrID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCustAddr'},
custEmailID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCustEmail'},
custPhID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCustPh'},
eygCustID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCust', required: true},
origCustName: {type: 'String'},
shipToCustAddrID: {type: mongoose.Schema.Types.ObjectId, ref: 'arCustAddr'},
//fees
calculatedFees: {
chgbkFees: {type: 'Number'},
gwFees: {type: 'Number'},
moStmtFees: {type: 'Number'},
procFees: {type: 'Number'},
qualDiscFees: {type: 'Number'},
resFees: {type: 'Number'}
},
creditFee: {type: 'Number'},
crossBorderFee: {type: 'Number'},
discQualFee: {type: 'Number'},
miscFee1: {type: 'Number'},
miscFee2: {type: 'Number'},
miscFee3: {type: 'Number'},
txnFee: {type: 'Number'},
//chgbk
bankComment: {type: 'String'},
caseNum: {type: 'String'},
chgbkCodeID: {type: mongoose.Schema.Types.ObjectId, ref: 'genCCChgbkCode'},
chgbkFee: {type: 'Number'},
chgbkResolved: {type: 'Boolean'},
investigatorComment: {type: 'String'},
replyByDt: {type: 'Date'}, //store all dates in utc
origGwBatchNum: {type: 'String'},
origInvNum: {type: 'String'},
origProcBatchNum: {type: 'String'},
origTxnAmt: {type: 'Number'},
origTxnDt: {type: 'Date'}, //store all dates in utc
origTxnID: {type: mongoose.Schema.Types.ObjectId, ref: 'aggrTxn'},
origTxnMapped: {type: 'Boolean'},
txnStat: {type: 'String'},
//stmtFee
feeTypeDesc: {type: 'String'},
gwTxnID: {type: 'String'},
gwTxnRefrID: {type: 'String'},
procTxnID: {type: 'String'},
procTxnRefrID: {type: 'String'},
//res
batchDt: {type: 'Date'}, //store all dates in utc
batchID: {type: 'String'},
depAmt: {type: 'Number'},
resDesc: {type: 'String'},
reserveInfo: {
projResRelDt: {type: 'Date'}, //store all dates in utc
resRelAmt: {type: 'Number'},
resRelDt: {type: 'Date'} //store all dates in utc
},
txnCount: {type: 'Number'},
//pending
pendingComplete: {type: 'Boolean'},
active: {type: 'Boolean', required: true},
inactDt: {type: 'Date'}, //store all dates in utc
inactRsnID: {type: mongoose.Schema.Types.ObjectId, ref: 'genInactRsn'}
}, {timestamps: true});
module.exports = mongoose.model('aggrTxn', aggrTxnSchema, 'aggrTxn');