Пример #1
0
 /// <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
      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
 /// <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
 /// <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
 /// <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
 /// <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;
 }