public static void CreditCardAuthTrans_onInserting(Common sender, DataEventArgs e)
{
CreditCardAuthTrans creditCardAuthTrans = sender as CreditCardAuthTrans;
MCRHoldCodeTrans holdCodeTrans;
CustParameters custParameters;
select custParameters where custParameters.DataAreaId == 'rev';
str declinedCCHoldCode = custParameters.revDeclinedCCOrderHoldCode;
CreditCardProcessorStatus status = creditCardAuthTrans.ProcessorStatus;
str salesId = creditCardAuthTrans.SalesId;
{
ttsbegin;
select forupdate holdCodeTrans;
holdCodeTrans.initValue();
holdCodeTrans.InventRefId = creditCardAuthTrans.SalesId;
holdCodeTrans.MCRHoldCode = declinedCCHoldCode;
holdCodetrans.RetailInfocodeId = 'HoldCode';
holdCodeTrans.insert();
ttscommit;
}
}
{
MCRHoldCodeTrans holdCodeTrans;
CustParameters custParameters;
select custParameters where custParameters.DataAreaId == 'rev';
str declinedCCHoldCode = custParameters.revDeclinedCCOrderHoldCode;
CreditCardProcessorStatus status = this.ProcessorStatus;
str salesId = this.SalesId;
{
//ttsbegin;
holdCodeTrans.InventRefId = this.SalesId;
holdCodeTrans.MCRHoldCode = declinedCCHoldCode;
holdCodetrans.RetailInfocodeId = 'HoldCode';
holdCodeTrans.insert();
//ttscommit;
}
next insert();
[DataEventHandler(tableStr(CreditCardAuthTrans), DataEventType::Inserted)] public static void CreditCardAuthTrans_onInserted(Common sender, DataEventArgs e) { CreditCardAuthTrans creditCardAuthTrans = sender as CreditCardAuthTrans; MCRHoldCodeTrans holdCodeTrans; CustParameters custParameters; select custParameters where custParameters.DataAreaId == 'rev'; str declinedCCHoldCode = custParameters.revDeclinedCCOrderHoldCode; CreditCardProcessorStatus status = creditCardAuthTrans.ProcessorStatus; str salesId = creditCardAuthTrans.SalesId; if(creditCardAuthTrans.ProcessorStatus == CreditCardProcessorStatus::Declined) { ttsbegin; select forupdate holdCodeTrans; holdCodeTrans.initValue(); holdCodeTrans.InventRefId = creditCardAuthTrans.SalesId; holdCodeTrans.MCRHoldCode = declinedCCHoldCode; holdCodetrans.RetailInfocodeId = 'HoldCode'; holdCodeTrans.insert(); ttscommit; } }/// Idea 2: CoC on CreditCardAuthTrans.insert() public void insert() { MCRHoldCodeTrans holdCodeTrans; CustParameters custParameters; select custParameters where custParameters.DataAreaId == 'rev'; str declinedCCHoldCode = custParameters.revDeclinedCCOrderHoldCode; CreditCardProcessorStatus status = this.ProcessorStatus; str salesId = this.SalesId; if(this.ProcessorStatus == CreditCardProcessorStatus::Declined) { //ttsbegin; holdCodeTrans.InventRefId = this.SalesId; holdCodeTrans.MCRHoldCode = declinedCCHoldCode; holdCodetrans.RetailInfocodeId = 'HoldCode'; holdCodeTrans.insert(); //ttscommit; } next insert();/// Idea 3, event handler on inserting [DataEventHandler(tableStr(CreditCardAuthTrans), DataEventType::Inserting)] public static void CreditCardAuthTrans_onInserting(Common sender, DataEventArgs e) { CreditCardAuthTrans creditCardAuthTrans = sender as CreditCardAuthTrans; MCRHoldCodeTrans holdCodeTrans; CustParameters custParameters; select custParameters where custParameters.DataAreaId == 'rev'; str declinedCCHoldCode = custParameters.revDeclinedCCOrderHoldCode; CreditCardProcessorStatus status = creditCardAuthTrans.ProcessorStatus; str salesId = creditCardAuthTrans.SalesId; if(creditCardAuthTrans.ProcessorStatus == CreditCardProcessorStatus::Declined) { ttsbegin; select forupdate holdCodeTrans; holdCodeTrans.initValue(); holdCodeTrans.InventRefId = creditCardAuthTrans.SalesId; holdCodeTrans.MCRHoldCode = declinedCCHoldCode; holdCodetrans.RetailInfocodeId = 'HoldCode'; holdCodeTrans.insert(); ttscommit; } }