예제 #1
0
        /// <summary>
        /// Returns true if CaptureOutput instances are equal
        /// </summary>
        /// <param name="other">Instance of CaptureOutput to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CaptureOutput other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CardPaymentMethodSpecificOutput == other.CardPaymentMethodSpecificOutput ||
                     CardPaymentMethodSpecificOutput != null &&
                     CardPaymentMethodSpecificOutput.Equals(other.CardPaymentMethodSpecificOutput)
                     ) &&
                 (
                     MobilePaymentMethodSpecificOutput == other.MobilePaymentMethodSpecificOutput ||
                     MobilePaymentMethodSpecificOutput != null &&
                     MobilePaymentMethodSpecificOutput.Equals(other.MobilePaymentMethodSpecificOutput)
                 ) &&
                 (
                     PaymentMethod == other.PaymentMethod ||
                     PaymentMethod != null &&
                     PaymentMethod.Equals(other.PaymentMethod)
                 ) &&
                 (
                     RedirectPaymentMethodSpecificOutput == other.RedirectPaymentMethodSpecificOutput ||
                     RedirectPaymentMethodSpecificOutput != null &&
                     RedirectPaymentMethodSpecificOutput.Equals(other.RedirectPaymentMethodSpecificOutput)
                 ));
        }
예제 #2
0
 public void Equals_Name_Differs()
 {
     var first = new PaymentMethod(0, "name");
     var second = new PaymentMethod(0, "other name");
     Assert.AreNotSame(first, second);
     Assert.IsFalse(first.Equals(second));
     Assert.IsFalse(second.Equals(first));
 }
예제 #3
0
 public void Equals_All_Fields_Same()
 {
     var first = new PaymentMethod(0, "name");
     var second = new PaymentMethod(0, "name");
     Assert.AreNotSame(first, second);
     Assert.IsTrue(first.Equals(second));
     Assert.IsTrue(second.Equals(first));
 }
예제 #4
0
        public void Equals_Name_Differs()
        {
            var first  = new PaymentMethod(0, "name");
            var second = new PaymentMethod(0, "other name");

            Assert.AreNotSame(first, second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
        }
예제 #5
0
        public void Equals_All_Fields_Same()
        {
            var first  = new PaymentMethod(0, "name");
            var second = new PaymentMethod(0, "name");

            Assert.AreNotSame(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
예제 #6
0
        private bool IsSeparatePaymentAction()
        {
            var retVal = false;

            if (PaymentMethod.Equals("Authorization/Capture"))
            {
                retVal = false;
            }
            return(retVal);
        }
예제 #7
0
        public override bool Equals(object _other)
        {
            if (!(_other is Transaction))
            {
                return(false);
            }
            Transaction other = (Transaction)_other;

            return(transactionID == other.transactionID && currentDate.Equals(other.currentDate) && is_a_return.Equals(other.is_a_return) &&
                   receipt.SequenceEqual(other.receipt) && payment.Equals(other.payment));
        }
예제 #8
0
        public void PaymentMethod_Copy()
        {
            var first = new PaymentMethod
            {
                Id   = 1,
                Name = "Arbitrary Payment"
            };

            var second = first.Copy();

            Assert.AreNotSame(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
예제 #9
0
        private void OpenTransactionCommand_Execute(string argFilename)
        {
            if (argFilename == "")
            {
                MessageBox.Show("You must enter a file name in the File Name textbox!", "Unable to save file",
                                MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                Transaction tempTransaction = new Transaction();
                tempTransaction.Clear();

                // Create an instance of the XmlSerializer class and specify the type of object to deserialize.
                XmlSerializer serializer = new XmlSerializer(typeof(Transaction));
                try
                {
                    TextReader reader = new StreamReader(filename);

                    int cashRec = int.Parse(reader.ReadLine());
                    int cashBac = int.Parse(reader.ReadLine());
                    PaymentMethod = reader.ReadLine();

                    if (PaymentMethod.Equals("Cash"))
                    {
                        CashReceived = cashRec;
                        CashBack     = cashBac;
                    }
                    // Deserialize all items.
                    tempTransaction = (Transaction)serializer.Deserialize(reader);
                    reader.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Unable to open file", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                // We have to insert the items in the existing collection.
                Clear();
                foreach (var Item in tempTransaction)
                {
                    Add(Item);
                    itemQuantities[Item.ID] = Item.Quantity;
                }


                NotifyPropertyChanged("totalPrice");
                NotifyPropertyChanged("Count");
                NotifyPropertyChanged("CashBack");
            }
        }
예제 #10
0
        public void PaymentMethodService_Create_From_Params_Name_Has_A_Value_Adds_Item()
        {
            var mock = ServiceMocks.GetMockPaymentMethodService();

            var before = mock.GetAll();

            Assert.IsFalse(before.Where(e => e.Name.Equals(baseTestData.Name, StringComparison.OrdinalIgnoreCase)).Count() > 0);

            mock.Create(baseTestData.Name, baseTestData.Id);

            var after = mock.GetAll();

            Assert.IsTrue(after.Where(e => e.Name.Equals(baseTestData.Name, StringComparison.OrdinalIgnoreCase)).Count() > 0);

            var actual = mock.GetById(baseTestData.Id);

            Assert.IsNotNull(actual);
            Assert.IsTrue(baseTestData.Equals(actual));
        }
예제 #11
0
        public bool calcualteChange()
        {
            String change = "0";

            if (PaymentMethod.Equals("CASH"))
            {
                try
                {
                    change = Math.Round(double.Parse(CashReceived) - double.Parse(Total), 2, MidpointRounding.AwayFromZero).ToString("N2");
                }
                catch
                {
                    return(false);
                }

                //if the change is a negative number, something is wrong, so return same page and refuse to close the order
                if (double.Parse(change) < 0)
                {
                    return(false);
                }
            }
            HttpContext.Session.SetString("change", change.ToString());
            return(true);
        }
예제 #12
0
 private bool IsSeparatePaymentAction()
 {
     return(PaymentMethod.Equals("Authorization/Capture"));
 }
예제 #13
0
        /// <summary>
        /// Returns true if Card instances are equal
        /// </summary>
        /// <param name="other">Instance of Card to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CardSource other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CustomerId == other.CustomerId ||
                     CustomerId != null &&
                     CustomerId.Equals(other.CustomerId)
                     ) &&
                 (
                     ExpiryMonth == other.ExpiryMonth ||
                     ExpiryMonth != null &&
                     ExpiryMonth.Equals(other.ExpiryMonth)
                 ) &&
                 (
                     ExpiryYear == other.ExpiryYear ||
                     ExpiryYear != null &&
                     ExpiryYear.Equals(other.ExpiryYear)
                 ) &&
                 (
                     BillingDetails == other.BillingDetails ||
                     BillingDetails != null &&
                     BillingDetails.Equals(other.BillingDetails)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Last4 == other.Last4 ||
                     Last4 != null &&
                     Last4.Equals(other.Last4)
                 ) &&
                 (
                     PaymentMethod == other.PaymentMethod ||
                     PaymentMethod != null &&
                     PaymentMethod.Equals(other.PaymentMethod)
                 ) &&
                 (
                     Fingerprint == other.Fingerprint ||
                     Fingerprint != null &&
                     Fingerprint.Equals(other.Fingerprint)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     CvvCheck == other.CvvCheck ||
                     CvvCheck != null &&
                     CvvCheck.Equals(other.CvvCheck)
                 ) &&
                 (
                     AvsCheck == other.AvsCheck ||
                     AvsCheck != null &&
                     AvsCheck.Equals(other.AvsCheck)
                 ));
        }