예제 #1
0
파일: PaySession.cs 프로젝트: zhabis/nfx
        protected override void Destructor()
        {
            try
            {
                if (m_AffectedAccounts != null)
                {
                    foreach (var account in m_AffectedAccounts.Values)
                    {
                        PaySystemHost.DoStoreAccountData(this, account);
                    }
                }

                if (m_AffectedTransactions != null)
                {
                    foreach (var tran in m_AffectedTransactions.Values)
                    {
                        PaySystemHost.DoStoreTransaction(this, tran);
                    }
                }
            }
            finally
            {
                if (PaySystem != null)
                {
                    lock (PaySystem.Sessions)
                        PaySystem.Sessions.Remove(this);
                }
            }

            base.Destructor();
        }
예제 #2
0
파일: PaySession.cs 프로젝트: zhabis/nfx
        public Transaction FetchTransaction(object id)
        {
            Transaction result = null;

            if (m_AffectedTransactions != null && m_AffectedTransactions.ContainsKey(id))
            {
                result = m_AffectedTransactions[id];
            }
            if (result == null)
            {
                result = PaySystemHost.DoFetchTransaction(this, id);
            }
            return(result);
        }
예제 #3
0
파일: PaySession.cs 프로젝트: zhabis/nfx
        public IActualAccountData FetchAccountData(Account account)
        {
            IActualAccountData result = null;

            if (m_AffectedAccounts != null && m_AffectedAccounts.ContainsKey(account))
            {
                result = m_AffectedAccounts[account];
            }
            if (result == null)
            {
                result = PaySystemHost.DoFetchAccountData(this, account);
            }
            return(result);
        }
예제 #4
0
파일: PaySession.cs 프로젝트: zhabis/nfx
        protected PaySession(PaySystem paySystem, ConnectionParameters cParams, IPaySessionContext context = null)
        {
            if (paySystem == null || cParams == null)
            {
                throw new PaymentException(StringConsts.ARGUMENT_ERROR + this.GetType().Name + ".ctor((paySystem|cParams)=null)");
            }

            PaySystem = paySystem;

            Context = context ?? PaySystemHost.GetDefaultTransactionContext();

            ConnectionParameters = cParams;

            lock (PaySystem.Sessions)
                PaySystem.Sessions.Add(this);
        }
예제 #5
0
파일: PaySession.cs 프로젝트: zhabis/nfx
 /// <summary>
 /// Generates new transaction ID for desired pay session and transaction type (Charge, Transfer).
 /// Context supplies host specific information about this transation i.e. user id
 /// </summary>
 public object GenerateTransactionID(TransactionType type)
 {
     return(PaySystemHost.DoGenerateTransactionID(this, type));
 }