public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is BankAccount other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((AccountNumberSuffix == null && other.AccountNumberSuffix == null) || (AccountNumberSuffix?.Equals(other.AccountNumberSuffix) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((AccountType == null && other.AccountType == null) || (AccountType?.Equals(other.AccountType) == true)) &&
                   ((HolderName == null && other.HolderName == null) || (HolderName?.Equals(other.HolderName) == true)) &&
                   ((PrimaryBankIdentificationNumber == null && other.PrimaryBankIdentificationNumber == null) || (PrimaryBankIdentificationNumber?.Equals(other.PrimaryBankIdentificationNumber) == true)) &&
                   ((SecondaryBankIdentificationNumber == null && other.SecondaryBankIdentificationNumber == null) || (SecondaryBankIdentificationNumber?.Equals(other.SecondaryBankIdentificationNumber) == true)) &&
                   ((DebitMandateReferenceId == null && other.DebitMandateReferenceId == null) || (DebitMandateReferenceId?.Equals(other.DebitMandateReferenceId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   Creditable.Equals(other.Creditable) &&
                   Debitable.Equals(other.Debitable) &&
                   ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((BankName == null && other.BankName == null) || (BankName?.Equals(other.BankName) == true)));
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Card other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CardBrand == null && other.CardBrand == null) || (CardBrand?.Equals(other.CardBrand) == true)) &&
                   ((Last4 == null && other.Last4 == null) || (Last4?.Equals(other.Last4) == true)) &&
                   ((ExpMonth == null && other.ExpMonth == null) || (ExpMonth?.Equals(other.ExpMonth) == true)) &&
                   ((ExpYear == null && other.ExpYear == null) || (ExpYear?.Equals(other.ExpYear) == true)) &&
                   ((CardholderName == null && other.CardholderName == null) || (CardholderName?.Equals(other.CardholderName) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) &&
                   ((CardType == null && other.CardType == null) || (CardType?.Equals(other.CardType) == true)) &&
                   ((PrepaidType == null && other.PrepaidType == null) || (PrepaidType?.Equals(other.PrepaidType) == true)) &&
                   ((Bin == null && other.Bin == null) || (Bin?.Equals(other.Bin) == true)));
        }
Beispiel #3
0
        public void EqualsOther()
        {
            var v1 = new Fingerprint("AA");
            var v2 = new Fingerprint("AA");

            Assert.True(v1.Equals(v2));
        }
Beispiel #4
0
        public void EqualsObject()
        {
            var v1 = new Fingerprint("AA");
            var v2 = new Fingerprint("AA") as object;

            Assert.True(v1.Equals(v2));
        }
Beispiel #5
0
        public void TestEquality()
        {
            Fingerprint fp1 = new Fingerprint(65);
            Fingerprint fp2 = new Fingerprint(65);
            Fingerprint fp3 = new Fingerprint(64);
            Fingerprint fp4 = new Fingerprint(66);

            // Reference first
            Assert.True(fp1.Equals(fp1));
            Assert.True(fp2.Equals(fp2));
            Assert.True(fp3.Equals(fp3));
            Assert.True(fp4.Equals(fp4));

            // Type second
            Assert.False(fp1.Equals(new Object()));

            // Length third

            Assert.False(fp3.Equals(fp1));
            Assert.False(fp1.Equals(fp3));

            Assert.False(fp4.Equals(fp2));
            Assert.False(fp2.Equals(fp4));

            // Bits forth

            Assert.True(fp1.Equals(fp2));
            Assert.True(fp2.Equals(fp1));

            fp1.Touch(32);
            Assert.False(fp1.Equals(fp2));
            Assert.False(fp2.Equals(fp1));

            fp2.Touch(32);
            Assert.True(fp1.Equals(fp2));
            Assert.True(fp2.Equals(fp1));

            // Length <= 32
            var fp5 = new Fingerprint(7);
            var fp6 = new Fingerprint(7);

            fp5.Touch(0);
            Assert.False(fp5.Equals(fp6));
            fp6.Touch(0);
            Assert.True(fp5.Equals(fp6));
        }
Beispiel #6
0
        public void BeEquatableToItself()
        {
            var first = new Fingerprint("1234-1234-1234-1234");

            var second = new Fingerprint("1234-1234-1234-1234");

            first.Equals(second).Should().BeTrue();
        }
Beispiel #7
0
        public void TestSerialization()
        {
            Fingerprint fp1 = new Fingerprint(65);
            Fingerprint fp2 = new Fingerprint(65);

            fp1.Touch(0);
            fp1.Touch(2);
            fp1.Touch(31);
            fp1.Touch(32);

            Assert.False(fp2.Equals(fp1));

            var buffer = new x2net.Buffer();

            fp1.Serialize(new Serializer(buffer));
            buffer.Rewind();
            fp2.Deserialize(new Deserializer(buffer));

            Assert.True(fp2.Equals(fp1));
        }
        public bool Equals(FileFingerprint other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(string.Equals(FullFilePath, other.FullFilePath, StringComparison.OrdinalIgnoreCase) &&
                   LastModifiedUtc.Equals(other.LastModifiedUtc) &&
                   Fingerprint.Equals(other.Fingerprint));
        }
Beispiel #9
0
        public void Equality()
        {
            byte[] hashA = new Random().NextBytes(20);
            var    hashB = new byte[hashA.Length];

            hashA.CopyTo(hashB, 0);
            hashB[19] = (byte)(hashA[19] >= 0xff ? 0 : hashA[19] + 1);
            Assert.NotEqual(hashA, hashB);

            var l123A = new Fingerprint(ValueKind.List, 123, hashA);

            Assert.False(l123A.Equals(null));
            Assert.False(l123A.Equals("other"));

            var l123A_ = new Fingerprint(ValueKind.List, 123, hashA.ToImmutableList());

            Assert.Equal(l123A, l123A_);
            Assert.True(l123A.Equals((object)l123A_));
            Assert.Equal(l123A.GetHashCode(), l123A_.GetHashCode());
            Assert.Equal(l123A.Serialize(), l123A_.Serialize());
            Assert.True(l123A == l123A_);
            Assert.False(l123A != l123A_);

            var d123A = new Fingerprint(ValueKind.Dictionary, 123, hashA);

            Assert.NotEqual(l123A, d123A);
            Assert.False(l123A.Equals((object)d123A));
            Assert.NotEqual(l123A.GetHashCode(), d123A.GetHashCode());
            Assert.NotEqual(l123A.Serialize(), d123A.Serialize());
            Assert.False(l123A == d123A);
            Assert.True(l123A != d123A);

            var l122A = new Fingerprint(ValueKind.List, 122, hashA);

            Assert.NotEqual(l123A, l122A);
            Assert.False(l123A.Equals((object)l122A));
            Assert.NotEqual(l123A.GetHashCode(), l122A.GetHashCode());
            Assert.NotEqual(l123A.Serialize(), l122A.Serialize());
            Assert.False(l123A == l122A);
            Assert.True(l123A != l122A);

            var l123B = new Fingerprint(ValueKind.List, 123, hashB);

            Assert.NotEqual(l123A, l123B);
            Assert.False(l123A.Equals((object)l123B));
            Assert.NotEqual(l123A.GetHashCode(), l123B.GetHashCode());
            Assert.NotEqual(l123A.Serialize(), l123B.Serialize());
            Assert.False(l123A == l123B);
            Assert.True(l123A != l123B);
        }
        private async Task <SslStream> GetStream()
        {
            await streamSemaphore.WaitAsync();

            try {
                if (stream != null)
                {
                    return(stream);
                }
                var tcpClient = new TcpClient();
                await tcpClient.ConnectAsync(Host, Port);

                stream = new SslStream(tcpClient.GetStream(), false, (source, cert, chain, policy) => {
                    return(Fingerprint == null || Fingerprint.Equals(cert.GetCertHashString(), StringComparison.OrdinalIgnoreCase));
                });
                await stream.AuthenticateAsClientAsync("", new X509CertificateCollection(), SslProtocols.Tls, true);

                DrainStream(stream);
                return(stream);
            } finally {
                streamSemaphore.Release();
            }
        }
Beispiel #11
0
        void SelfPatch()
        {
            try
            {
                Fingerprint myFingerprint = new Fingerprint(Settings.GamePath, "Bourbon.exe");

                if (DontSelfUpdate)
                {
                    return;
                }
                MyToolkit.ActivityLog("Starting self-patch process.");

                // Before we go far... lets see if there are any old temp files hanging around and get rid of them

                string[] oldFiles = Directory.GetFiles(Settings.GamePath, "*.old");
                foreach (string oldFile in oldFiles)
                {
                    try { File.Delete(oldFile); }
                    catch (Exception ex) { }
                }

                // OK now thats out of the way, lets determine if we need to self patch or not!!
                IEnumerable <XElement> launchers = m_manifest.Descendants("launcher");
                m_Status = "Self patching";
                foreach (XElement launcher in launchers)
                {
                    if (launcher.Attribute("id").Value == "Bourbon")
                    {
                        long size = 0;
                        long.TryParse(launcher.Attribute("size").Value.ToString(), out size);
                        string md5 = launcher.Attribute("md5").Value;

                        Fingerprint remoteLauncher = new Fingerprint(Settings.GamePath, "Bourbon.exe", md5, size);

                        if (!myFingerprint.Equals(remoteLauncher))
                        {
                            MyToolkit.ActivityLog("Patcher out of date...");

                            // We need to update!!! yay...
                            IEnumerable <XElement> urls = launcher.Descendants("url");

                            // Get every possible download URL into the remoteLauncher fingerprint
                            foreach (XElement url in urls)
                            {
                                remoteLauncher.AddDownloadURL(url.Value);
                            }


                            // Start the download process
                            HTTP selfPatcherClient = new HTTP();

                            m_DownloadSize = remoteLauncher.Size;
                            string downloadURL = remoteLauncher.DownloadURL;
                            MyToolkit.ActivityLog("Downloading new version from \"" + downloadURL + "\"");
                            if (selfPatcherClient.StartDownload(new AsyncCompletedEventHandler(DownloadFileComplete),
                                                                new DownloadProgressChangedEventHandler(dlProgress),
                                                                downloadURL,
                                                                remoteLauncher.FullName + ".download"))
                            {
                                m_Status         = "Downloading";
                                m_DownloadActive = true;
                            }

                            m_current = remoteLauncher.FullName;

                            // Wait until download is complete

                            MyToolkit.ActivityLog("Waiting for patcher download to complete...");
                            while (selfPatcherClient.Active)
                            {
                                if (Kill)
                                {
                                    selfPatcherClient.CancelDownload();
                                    return;
                                }
                                System.Threading.Thread.Sleep(10);
                            }
                            m_DownloadActive = false;
                            MyToolkit.ActivityLog("New patcher version downloaded...");

                            // Make sure the downloaded file is not corrupted

                            Fingerprint downloadedFile = new Fingerprint(remoteLauncher.RootPath, remoteLauncher.FileName + ".download");

                            if (!downloadedFile.Equals(remoteLauncher))
                            {
                                string error = "Was unable to self patch. Downloaded file did not match expected checksum.";
                                error += "\r\n" + remoteLauncher.FileName
                                         + "\r\n md5: " + remoteLauncher.Checksum + " vs " + downloadedFile.Checksum
                                         + "\r\n size: " + remoteLauncher.Size + " vs " + downloadedFile.Size;

                                MyToolkit.ActivityLog(error);

                                File.Delete(downloadedFile.FullName + ".download");
                                m_ErrorLog.Add(error);
                                m_Status = "Done";
                                return;
                            }
                            else
                            {
                                // Find an available _#.old file name
                                long   i         = 0;
                                string TrashName = myFingerprint.FullName + "_";
                                while (File.Exists(TrashName + i.ToString() + ".old"))
                                {
                                    i++;
                                }

                                TrashName = TrashName + i.ToString() + ".old";
                                File.Move(myFingerprint.FullName, TrashName);
                                File.Move(myFingerprint.FullName + ".download", myFingerprint.FullName);

                                var startInfo = new ProcessStartInfo();
                                startInfo.FileName  = myFingerprint.FullName;
                                startInfo.Arguments = MyToolkit.AllArgs();

                                MyToolkit.ActivityLog("Bourbon has been patched successfuly. Restarting.");

                                Process.Start(startInfo);

                                Application.Exit();
                                return;
                            }
                        }
                    }
                }

                MyToolkit.ActivityLog("Self patching process complete.");
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "WorkThread.SelfPatch()");
            }
        }
Beispiel #12
0
        public void DownloadFiles()
        {
            foreach (Fingerprint file in m_DownloadQueue)
            {
                if (Kill)
                {
                    return;
                }

                HTTP client = new HTTP();

                bool   keepTrying  = true;
                string DownloadURL = file.DownloadURL;;

                while (keepTrying)
                {
                    try
                    {
                        MyToolkit.ActivityLog("Downloading file \"" + file.FullName + "\" from \"" + DownloadURL + "\"");
                        if (client.StartDownload(new AsyncCompletedEventHandler(DownloadFileComplete),
                                                 new DownloadProgressChangedEventHandler(dlProgress),
                                                 DownloadURL,
                                                 file.FullName + ".download"))
                        {
                            m_Status         = "Downloading";
                            m_DownloadActive = true;
                        }
                    }
                    catch (Exception ex) {
                        string er = ex.Message;
                    }

                    m_current = file.FullName;

                    while (client.Active)
                    {
                        if (Kill)
                        {
                            client.CancelDownload();
                            return;
                        }
                        System.Threading.Thread.Sleep(10);
                    }

                    Fingerprint Downloaded = new Fingerprint(file.RootPath, file.FileName + ".download");

                    if (!Downloaded.Equals(file))
                    {
                        // OK this file is no good, delete it.
                        File.Delete(file.FullName + ".download");

                        // lets try a different url...
                        DownloadURL = file.DownloadURL;

                        // Did we get a blank URL?
                        if (DownloadURL == "")
                        {
                            MyToolkit.ActivityLog("Download failed, no more URL's to try from");

                            // OK stop trying and report error...
                            keepTrying = false;

                            string Msg = "Download error: " + file.FileName;
                            if (Downloaded.Size == 0)
                            {
                                Msg += "\r\nWas unable to download file";
                            }
                            else
                            {
                                if (Downloaded.Size != file.Size)
                                {
                                    Msg += "\r\nSize mismatch (" + Downloaded.Size + " vs " + file.Size + ")";
                                }
                                if (Downloaded.Checksum != file.Checksum)
                                {
                                    Msg += "\r\nChecksum Mismatch (" + Downloaded.Checksum + " vs " + file.Checksum + ")";
                                }
                            }
                            if (file.Warn)
                            {
                                m_ErrorLog.Add(Msg);
                            }
                            else
                            {
                                m_WarningLog.Add(Msg);
                            }
                        }
                        else
                        {
                            MyToolkit.ActivityLog("Download failed, trying from a different URL");
                        }
                    }
                    else
                    {
                        if (File.Exists(file.FullName))
                        {
                            File.SetAttributes(file.FullName, File.GetAttributes(file.FullName) & ~FileAttributes.ReadOnly);
                            File.Delete(file.FullName);
                        }

                        // We are done, we dont need to keep trying (infinite loop if we dont set this)
                        keepTrying = false;
                        File.Move(file.FullName + ".download", file.FullName);
                        FlagVerified(file.FullName, file.Size, file.Checksum);
                    }
                }

                m_Downloaded += file.Size;
            }

            m_Status  = "Done";
            m_current = "";
        }
Beispiel #13
0
        public void Validate()
        {
            long i = 0;

            m_Status = "Validating";

            LoadLog();

            foreach (Fingerprint ManifestFingerprint in m_ManifestFileList)
            {
                if (Kill)
                {
                    return;
                }

                i++;
                m_current = ManifestFingerprint.FullName;

                ProgressEventArgs e = new ProgressEventArgs(i, m_ManifestFileList.Count);

                Fingerprint LocalFingerprint;
                if (ManifestFingerprint.Size == 0)
                {
                    // File is to be deleted
                    if (System.IO.File.Exists(ManifestFingerprint.FullName))
                    {
                        System.IO.File.Delete(ManifestFingerprint.FullName);
                    }
                }
                else if (System.IO.File.Exists(ManifestFingerprint.FullName))
                {
                    // File exists locally, lets start verifying it. First check if
                    // the checksum matches the one in our last run log, if so there
                    // is no need to download the file nor do a checksum
                    if (AlreadyVerified(ManifestFingerprint.FileName,
                                        ManifestFingerprint.Size,
                                        ManifestFingerprint.Checksum))
                    {
                        FlagVerified(ManifestFingerprint.FileName, ManifestFingerprint.Size, ManifestFingerprint.Checksum);
                    }
                    else
                    {
                        // Get an md5 checksum for the local copy of the file
                        LocalFingerprint = new Fingerprint(ManifestFingerprint.RootPath, ManifestFingerprint.FileName);

                        if (LocalFingerprint.Equals(ManifestFingerprint))
                        {
                            FlagVerified(ManifestFingerprint.FileName, ManifestFingerprint.Size, ManifestFingerprint.Checksum);
                        }
                        else
                        {
                            // There was no match, lets add the file to our download queue
                            AddToDownloadQueue(ManifestFingerprint);
                        }
                    }
                }
                else
                {
                    // File does not exist locally, we must download it. Add to our download queue.
                    AddToDownloadQueue(ManifestFingerprint);
                }
                m_progress = (int)(Math.Round((i / 100.0f) * 100.0f));
            }

            DownloadFiles();
        }
Beispiel #14
0
 /// <summary>
 /// Tests if the <paramref name="other" /> content fingerprint represents the same hash.
 /// </summary>
 public bool Equals(WeakContentFingerprint other)
 {
     return(Hash.Equals(other.Hash));
 }
Beispiel #15
0
 /// <nodoc />
 public bool Equals(Hash other)
 {
     return(RawHash.Equals(other.RawHash));
 }
Beispiel #16
0
        public void TestSerialization()
        {
            Fingerprint fp1 = new Fingerprint(65);
            Fingerprint fp2 = new Fingerprint(65);

            fp1.Touch(0);
            fp1.Touch(2);
            fp1.Touch(31);
            fp1.Touch(32);

            Assert.False(fp2.Equals(fp1));

            var buffer = new x2.Buffer();
            fp1.Serialize(new Serializer(buffer));
            buffer.Rewind();
            fp2.Deserialize(new Deserializer(buffer));

            Assert.True(fp2.Equals(fp1));
        }
Beispiel #17
0
        public void TestEquality()
        {
            Fingerprint fp1 = new Fingerprint(65);
            Fingerprint fp2 = new Fingerprint(65);
            Fingerprint fp3 = new Fingerprint(64);
            Fingerprint fp4 = new Fingerprint(66);

            // Reference first
            Assert.True(fp1.Equals(fp1));
            Assert.True(fp2.Equals(fp2));
            Assert.True(fp3.Equals(fp3));
            Assert.True(fp4.Equals(fp4));

            // Type second
            Assert.False(fp1.Equals(new Object()));

            // Length third

            Assert.False(fp3.Equals(fp1));
            Assert.False(fp1.Equals(fp3));

            Assert.False(fp4.Equals(fp2));
            Assert.False(fp2.Equals(fp4));

            // Bits forth

            Assert.True(fp1.Equals(fp2));
            Assert.True(fp2.Equals(fp1));

            fp1.Touch(32);
            Assert.False(fp1.Equals(fp2));
            Assert.False(fp2.Equals(fp1));

            fp2.Touch(32);
            Assert.True(fp1.Equals(fp2));
            Assert.True(fp2.Equals(fp1));

            // Length <= 32
            var fp5 = new Fingerprint(7);
            var fp6 = new Fingerprint(7);
            fp5.Touch(0);
            Assert.False(fp5.Equals(fp6));
            fp6.Touch(0);
            Assert.True(fp5.Equals(fp6));
        }
Beispiel #18
0
        public void Validate()
        {
            long i = 0;

            m_Status = "Validating";

            LoadLog();

            foreach (Fingerprint ManifestFingerprint in m_ManifestFileList)
            {
                if (Kill)
                {
                    return;
                }

                i++;
                m_current = ManifestFingerprint.FullName;

                ProgressEventArgs e = new ProgressEventArgs(i, m_ManifestFileList.Count);

                Fingerprint LocalFingerprint;
                if (!ManifestFingerprint.PathIsSafe)
                {
                    // This manifest entry sets off our path traversal detection!
                    // 1. Don't attempt to download it, delete it, etc.
                    // 2. Write a log entry about it.
                    MyToolkit.ActivityLog("Manifest contains path traversal! File named '" + ManifestFingerprint.FileName +
                                          "' would be written to '" + ManifestFingerprint.AbsolutePath + "'. Skipping.");
                }
                else if (ManifestFingerprint.Size == 0)
                {
                    // File is to be deleted
                    if (System.IO.File.Exists(ManifestFingerprint.FullName))
                    {
                        System.IO.File.Delete(ManifestFingerprint.FullName);
                    }
                }
                else if (System.IO.File.Exists(ManifestFingerprint.FullName))
                {
                    // File exists locally, lets start verifying it. First check if
                    // the checksum matches the one in our last run log, if so there
                    // is no need to download the file nor do a checksum
                    if (AlreadyVerified(ManifestFingerprint.FileName,
                                        ManifestFingerprint.Size,
                                        ManifestFingerprint.Checksum))
                    {
                        FlagVerified(ManifestFingerprint.FileName, ManifestFingerprint.Size, ManifestFingerprint.Checksum);
                    }
                    else
                    {
                        // Get an md5 checksum for the local copy of the file
                        LocalFingerprint = new Fingerprint(ManifestFingerprint.RootPath, ManifestFingerprint.FileName);

                        if (LocalFingerprint.Equals(ManifestFingerprint))
                        {
                            FlagVerified(ManifestFingerprint.FileName, ManifestFingerprint.Size, ManifestFingerprint.Checksum);
                        }
                        else
                        {
                            // There was no match, lets add the file to our download queue
                            AddToDownloadQueue(ManifestFingerprint);
                        }
                    }
                }
                else
                {
                    // File does not exist locally, we must download it. Add to our download queue.
                    AddToDownloadQueue(ManifestFingerprint);
                }
                m_progress = (int)(Math.Round((i / 100.0f) * 100.0f));
            }

            DownloadFiles();
        }
Beispiel #19
0
        public void TestSerialization()
        {
            Fingerprint fp1 = new Fingerprint(65);
            Fingerprint fp2 = new Fingerprint(65);

            fp1.Touch(0);
            fp1.Touch(2);
            fp1.Touch(31);
            fp1.Touch(32);

            Assert.False(fp2.Equals(fp1));

            /*
            Buffer buffer = new Buffer(12);
            fp1.Dump(buffer);
            buffer.Rewind();
            fp2.Load(buffer);

            Assert.True(fp2.Equals(fp1));
            */
        }
Beispiel #20
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)
                 ));
        }