コード例 #1
0
ファイル: Transaction.cs プロジェクト: vlapchenko/nfx
 /// <summary>
 /// Creates charge transaction
 /// </summary>
 /// <param name="id">Trasaction ID</param>
 /// <param name="processorName">Payment processor name which this trasaction belongs to</param>
 /// <param name="processorToken">Payment processor trasaction of this trasaction</param>
 /// <param name="from">Source account</param>
 /// <param name="to">Destination account</param>
 /// <param name="amount">Amount of this transaction</param>
 /// <param name="createDateUTC">Creation date of this trasaction</param>
 /// <param name="description">Description of this transaction (e.g. "Payment for CPU Intel i7 4470 SandyBridge")</param>
 /// <param name="amountCaptured">Captured amount (can be less or equals to amount)</param>
 /// <param name="canCapture">Can be this trasaction be captured at all</param>
 /// <param name="canRefund">Can be this trasaction be refunded at all</param>
 /// <param name="extraData">Some extra data if needed</param>
 public static Transaction Charge(object id, 
                                        string processorName, object processorToken, 
                                        Account from, Account to, 
                                        Amount amount, DateTime createDateUTC, string description, 
                                        Amount? amountCaptured = null, bool canCapture = true,
                                        bool canRefund = true, 
                                        object extraData = null)
 {
   var ta = new Transaction(id, TransactionType.Charge, 
                             processorName, processorToken, from, to, 
                             amount, createDateUTC, description, amountCaptured, canCapture, canRefund: canRefund, extraData: extraData);
   return ta;
 }
コード例 #2
0
 /// <summary>
 /// Persists transaction in memory
 /// </summary>
 public void SaveTransaction(Transaction ta)
 {
   lock (m_TransactionList)
     m_TransactionList.Add(ta);
 }
コード例 #3
0
ファイル: Transaction.cs プロジェクト: vlapchenko/nfx
      public bool Equals(Transaction other)
      {
        if (other == null) return false;
        if (object.ReferenceEquals(this, other)) return true;

        return m_ID == other.m_ID && m_TransactionType == other.m_TransactionType
          && m_From == other.m_From && m_To == other.m_To
          && m_ProcessorName == other.ProcessorName && m_ProcessorToken == other.ProcessorToken && m_CreateDateUTC == other.m_CreateDateUTC
          && m_Description == other.m_Description && m_Amount == other.m_Amount 
          && m_RelatedTransactionID == other.m_RelatedTransactionID
          && m_ExtraData == other.m_ExtraData && m_CanRefund == other.m_CanRefund
          && m_CanCapture == other.m_CanCapture;
      }
コード例 #4
0
ファイル: Transaction.cs プロジェクト: vlapchenko/nfx
 /// <summary>
 /// Creates transfer transaction
 /// </summary>
 /// <param name="id">Trasaction ID</param>
 /// <param name="processorName">Payment processor name which this trasaction belongs to</param>
 /// <param name="processorToken">Payment processor trasaction of this trasaction</param>
 /// <param name="from">Source account</param>
 /// <param name="to">Destination account</param>
 /// <param name="amount">Amount of this transaction</param>
 /// <param name="createDateUTC">Creation date of this trasaction</param>
 /// <param name="description">Description of this transaction (e.g. "Payment for CPU Intel i7 4470 SandyBridge")</param>
 /// <param name="extraData">Some extra data if needed</param>
 public static Transaction Transfer(object id, 
                                   string processorName, object processorToken, 
                                   Account from, Account to, 
                                   Amount amount, DateTime createDateUTC, string description, 
                                   object extraData = null)
 {
   var ta = new Transaction(id, TransactionType.Transfer, 
                             processorName, processorToken, from, to, 
                             amount, createDateUTC, description, extraData: extraData);
   return ta;
 }
コード例 #5
0
ファイル: PaySession.cs プロジェクト: vlapchenko/nfx
 /// <summary>
 /// Has the same semantics as corresponding PaySystem method executed in context of this session
 /// </summary>
 public Transaction Refund(ITransactionContext context, ref Transaction charge, Amount? amount = null, string description = null, object extraData = null)
 { 
   return m_PaySystem.Refund(this, context, ref charge, amount, description, extraData);
 }
コード例 #6
0
ファイル: PaySession.cs プロジェクト: vlapchenko/nfx
 /// <summary>
 /// Has the same semantics as corresponding PaySystem method executed in context of this session
 /// </summary>
 public void Capture(ITransactionContext context, ref Transaction charge, Amount? amount = null, string description = null, object extraData = null)
 {
   m_PaySystem.Capture(this, context, ref charge, amount, description, extraData);
 }
コード例 #7
0
ファイル: Transaction.cs プロジェクト: itadapter/nfx
 /// <summary>
 /// Creates refund transaction
 /// </summary>
 /// <param name="id">Trasaction ID</param>
 /// <param name="processorName">Payment processor name which this trasaction belongs to</param>
 /// <param name="processorToken">Payment processor trasaction of this trasaction</param>
 /// <param name="from">Source account</param>
 /// <param name="to">Destination account</param>
 /// <param name="amount">Amount of this transaction</param>
 /// <param name="createDateUTC">Creation date of this trasaction</param>
 /// <param name="description">Description of this transaction (e.g. "Payment for CPU Intel i7 4470 SandyBridge")</param>
 /// <param name="relatedTransactionID">ID of trasaction which this transaction belongs to (e.g. refund transaction refers to its charge trasaction)</param>
 /// <param name="extraData">Some extra data if needed</param>
 public static Transaction Refund(object id,
     string processorName, object processorToken,
     Account from, Account to,
     Amount amount, DateTime createDateUTC, string description,
     object relatedTransactionID = null, object extraData = null)
 {
     var ta = new Transaction(id, TransactionType.Refund,
                          processorName, processorToken, from, to,
                          amount, createDateUTC, description, canRefund: false,
                          relatedTransactionID: relatedTransactionID, extraData: extraData);
     return ta;
 }