private Transaction GetSampleTransaction()
        {
            Transaction t = new Transaction();
            
            t.Action = ActionType.CreditCardHold;
            t.Amount = _AmountSuccess;

            t.Card.CardNumber = _TestVisa;
            t.Card.CardHolderName = "No One";
            t.Card.ExpirationMonth = 12;
            t.Card.ExpirationYear = 2014;
            t.Card.SecurityCode = "123";

            t.Customer.City = "New York";
            t.Customer.Company = "None";
            t.Customer.Country = "United States";
            t.Customer.Email = "*****@*****.**";
            t.Customer.FirstName = "No";
            t.Customer.LastName = "One";
            t.Customer.IpAddress = "127.0.0.1";
            t.Customer.Phone = "2125551212";
            t.Customer.PostalCode = "10038";
            t.Customer.Region = "NY";
            t.Customer.Street = "99 John Street";
            
            return t;
        }
示例#2
0
 public void PopulateFromPaymentTransaction(MerchantTribe.Payment.Transaction t)
 {
     if (t != null)
     {
         TimeStampUtc = DateTime.UtcNow;
         Action       = t.Action;
         Amount       = t.Amount;
         if (t.Action == ActionType.CreditCardRefund)
         {
             Amount = (t.Amount * -1);
         }
         CreditCard = t.Card;
         Success    = t.Result.Succeeded;
         Voided     = false;
         RefNum1    = t.Result.ReferenceNumber;
         RefNum2    = t.Result.ReferenceNumber2;
         Messages   = string.Empty;
         if (t.Result.Messages.Count > 0)
         {
             foreach (Message m in t.Result.Messages)
             {
                 Messages += m.Code + "::" + m.Description;
             }
         }
     }
 }
 public void PopulateFromPaymentTransaction(MerchantTribe.Payment.Transaction t)
 {
     if (t != null)
     {
         TimeStampUtc = DateTime.UtcNow;
         Action       = t.Action;
         Amount       = t.Amount;
         if (t.IsRefundTransaction)
         {
             Amount = (t.Amount * -1);
         }
         CreditCard = t.Card;
         Success    = t.Result.Succeeded;
         Voided     = false;
         RefNum1    = t.Result.ReferenceNumber;
         RefNum2    = t.Result.ReferenceNumber2;
         Messages   = string.Empty;
         if (t.Result.Messages.Count > 0)
         {
             foreach (Message m in t.Result.Messages)
             {
                 Messages += ":: " + m.Code + " - " + m.Description + " ";
             }
         }
         this.CheckNumber          = t.CheckNumber;
         this.PurchaseOrderNumber  = t.PurchaseOrderNumber;
         this.GiftCardNumber       = t.GiftCardNumber;
         this.CompanyAccountNumber = t.CompanyAccountNumber;
     }
 }
 public OrderTransaction(MerchantTribe.Payment.Transaction t)
 {
     Id                  = System.Guid.NewGuid();
     StoreId             = 0;
     OrderId             = string.Empty;
     LinkedToTransaction = string.Empty;
     PopulateFromPaymentTransaction(t);
 }
示例#5
0
 public Transaction(MerchantTribe.Payment.Transaction t)
 {
     Id                  = 0;
     AccountId           = 0;
     InvoiceReference    = string.Empty;
     ExternalOrderNumber = string.Empty;
     LinkedToTransaction = 0;
     PopulateFromPaymentTransaction(t);
 }
示例#6
0
 public abstract void ProcessTransaction(Transaction t);
示例#7
0
 public override void ProcessTransaction(Transaction t)
 {
     Membership.CustomerPointsManager manager =
         Membership.CustomerPointsManager.InstantiateForDatabase(Settings.PointsIssuedPerDollarSpent,
                                             Settings.PointsNeededForDollarCredit,
                                             RequestContext.GetCurrentRequestContext().CurrentStore.Id);
     switch (t.Action)
     {
         case ActionType.RewardPointsBalanceInquiry:
             int points = manager.FindAvailablePoints(t.Customer.UserId);
             t.Result.Succeeded = true;
             t.Result.ResponseCode = "OK";
             t.Result.ResponseCodeDescription = "Points Availble " + points.ToString();
             t.Result.BalanceAvailable = points;
             break;
         case ActionType.RewardPointsCapture:
             if (manager.CapturePoints(t.Customer.UserId,t.RewardPoints))
             {
                 t.Result.Succeeded = true;
                 t.Result.ResponseCode = "OK";
                 t.Result.ResponseCodeDescription = t.RewardPoints.ToString() + " Points Captured";
             }
             else
             {
                 t.Result.Succeeded = false;
                 t.Result.Messages.Add(new Message("Not enough points available to capture", "FAIL", MessageType.Error));
             }
             break;
         case ActionType.RewardPointsDecrease:
             if (manager.DecreasePoints(t.Customer.UserId,t.RewardPoints))
             {
                 t.Result.Succeeded = true;
                 t.Result.ResponseCode = "OK";
                 t.Result.ResponseCodeDescription = t.RewardPoints.ToString() + " Points Used";
             }
             else
             {
                 t.Result.Succeeded = false;
                 t.Result.Messages.Add(new Message("Unable to Use Points", "FAIL", MessageType.Error));
             }
             break;
         case ActionType.RewardPointsHold:
             if (manager.HoldPoints(t.Customer.UserId,t.RewardPoints))
             {
                 t.Result.Succeeded = true;
                 t.Result.ResponseCode = "OK";
                 t.Result.ResponseCodeDescription = t.RewardPoints.ToString() + " Points Held";
             }
             else
             {
                 t.Result.Succeeded = false;
                 t.Result.Messages.Add(new Message("Not enough points available to hold", "FAIL", MessageType.Error));
             }
             break;
         case ActionType.RewardPointsUnHold:
             if (manager.UnHoldPoints(t.Customer.UserId, t.RewardPoints))
             {
                 t.Result.Succeeded = true;
                 t.Result.ResponseCode = "OK";
                 t.Result.ResponseCodeDescription = t.RewardPoints.ToString() + " Points Held";
             }
             else
             {
                 t.Result.Succeeded = false;
                 t.Result.Messages.Add(new Message("Not enought points held to unhold", "FAIL", MessageType.Error));
             }
             break;
         case ActionType.RewardPointsIncrease:
             if (manager.IssuePoints(t.Customer.UserId,t.RewardPoints))
             {
                 t.Result.Succeeded = true;
                 t.Result.ResponseCode = "OK";
                 t.Result.ResponseCodeDescription = t.RewardPoints.ToString() + " Points Issued";
             }
             else
             {
                 t.Result.Succeeded = false;
                 t.Result.Messages.Add(new Message("Unable to Issue Points", "FAIL", MessageType.Error));
             }
             break;
         case ActionType.RewardPointsInfo:
             t.Result.Succeeded = true;
             t.Result.ResponseCode = "OK";
             t.Result.ResponseCodeDescription = "Reward Points Info";
             break;
         default:
             t.Result.Succeeded = false;
             t.Result.Messages.Add(new Message("Operation Not Supported by this Method", "OPFAIL", MessageType.Error));
             break;
     }
 }