/// <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) )); }
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)); }
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)); }
private bool IsSeparatePaymentAction() { var retVal = false; if (PaymentMethod.Equals("Authorization/Capture")) { retVal = false; } return(retVal); }
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)); }
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)); }
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"); } }
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)); }
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); }
private bool IsSeparatePaymentAction() { return(PaymentMethod.Equals("Authorization/Capture")); }
/// <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) )); }