本文整理汇总了C++中CMultiXAppMsg::SavedContext方法的典型用法代码示例。如果您正苦于以下问题:C++ CMultiXAppMsg::SavedContext方法的具体用法?C++ CMultiXAppMsg::SavedContext怎么用?C++ CMultiXAppMsg::SavedContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMultiXAppMsg
的用法示例。
在下文中一共展示了CMultiXAppMsg::SavedContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Owner
//! see CMultiXSession::OnDataReplyReceived
void CISO8583AuthorizerServerSession::OnDataReplyReceived(CMultiXAppMsg &ReplyMsg,CMultiXAppMsg &ForwardedMsg)
{
DebugPrint(3,"Data Reply Received\n");
switch(CISO8583Msg::VersionIndependentMTI(ForwardedMsg.MsgCode())) // this will give us version independent MTI
{
case CISO8583Msg::MTIAuthorizationMessageRequest :
case CISO8583Msg::MTIFinancialMessageRequest :
{
CMultiXAppMsg *AcquirerMsg = (CMultiXAppMsg *)ForwardedMsg.SavedContext();
if(ReplyMsg.AppDataSize() == 0)
{
AcquirerMsg->Reply(ReplyMsg.Error());
delete AcquirerMsg;
break;
}
CISO8583Msg AcquirerISO;
CISO8583Msg ReplyISO;
AcquirerISO.FromISO((const byte_t *)AcquirerMsg->AppData(),AcquirerMsg->AppDataSize());
ReplyISO.FromISO((const byte_t *)ReplyMsg.AppData(),ReplyMsg.AppDataSize());
/*
before we send the reply, we need to check if it is MTI 200 and if the response is positive, if so :
1. we debit the issuer account for the sales amount + commission. in this sample we derive the issuer account from the PAN.
2. we credit our own account for these amounts
3. we write transactions log.
*/
if(CISO8583Msg::VersionIndependentMTI(AcquirerMsg->MsgCode()) == CISO8583Msg::MTIFinancialMessageRequest)
{
if(CISO8583Utilities::ToInt64(ReplyISO.ActionCode()) == 0)
{
double Amount = (double)CISO8583Utilities::ToInt64(ReplyISO.TransactionAmount())/100;
int IssuerAccount = PANToIssuerAccount(AcquirerISO.PAN());
int MerchantAccount = (int)CISO8583Utilities::ToInt64(AcquirerISO.CardAcceptorIdentificationCode().StringData());
if(!UpdateAuthorizedSale(IssuerAccount,MerchantAccount,AcquirerISO.PAN(),Amount))
{
AcquirerMsg->Reply(CISO8583Msg::RequestRejected);
// SendReversalToIssuer(ReplyISO); not implemented
delete AcquirerMsg;
return;
}
}
} else if(CISO8583Msg::VersionIndependentMTI(AcquirerMsg->MsgCode()) == CISO8583Msg::MTIAuthorizationMessageRequest)
{
int IssuerAccount = PANToIssuerAccount(AcquirerISO.PAN());
double Amount = (double)CISO8583Utilities::ToInt64(AcquirerISO.TransactionAmount())/100;
mysqlpp::Transaction Tran(Owner()->DBConn());
mysqlpp::Query Query = Owner()->DBConn().query();
transactions_log Log;
Log.Time = TomysqlppDateTime(time(NULL));
Log.AccountNumber = IssuerAccount;
Log.CardNumber = AcquirerISO.PAN();
Log.Action = 11; // Query
Log.Amount = Amount;
Log.NewBalance = 0;
Query.insert(Log);
Query.execute();
Tran.commit();
}
/*
We get here when we receive a response for a message we forwarded before. In this case we will forward the response back to
the originator, we do not care for the content, we forward it back almost AS IS except for few fields that
we need to restore because changed them before we forwarded the message, the fields are:
BMP 7 - Set Transmission time
BMP 11 - restore sender STAN
BMP 12 - Restore sender Date and Time Local
BMP 32 - Restore senders Acquiring Institution Identification Code
*/
/*
In order to restore old values, we need to restore the message we received originaly from the acquirer or from the pos terminal.
this message is saved in the SaveContext() of the ForwardedMsg.
*/
ReplyISO.SetTimes(time(NULL),true);
ReplyISO.SetSTAN(AcquirerISO.STAN());
ReplyISO.SetDateTimeLocal(AcquirerISO.DateTimeLocal());
ReplyISO.SetAcquiringInstitutionIdentificationCode(AcquirerISO.AcquiringInstitutionIdentificationCode());
ReplyISO.ToISO();
AcquirerMsg->Reply(AcquirerMsg->MsgCode(),
ReplyISO.ISOBuffer(),
ReplyISO.ISOBufferSize(),0,0,0,0,0,ReplyMsg.Error());
delete AcquirerMsg; // WE MUST DELETE THE MESSAGE BECAUSE WE CALLED "Keep()" BEFORE WE FORWARDED IT.
}
break;
//.........这里部分代码省略.........