Exemplo n.º 1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (RequestedOn != null)
         {
             hashCode = hashCode * 59 + RequestedOn.GetHashCode();
         }
         if (Source != null)
         {
             hashCode = hashCode * 59 + Source.GetHashCode();
         }
         if (Destination != null)
         {
             hashCode = hashCode * 59 + Destination.GetHashCode();
         }
         if (Amount != null)
         {
             hashCode = hashCode * 59 + Amount.GetHashCode();
         }
         if (Currency != null)
         {
             hashCode = hashCode * 59 + Currency.GetHashCode();
         }
         if (PaymentType != null)
         {
             hashCode = hashCode * 59 + PaymentType.GetHashCode();
         }
         if (Reference != null)
         {
             hashCode = hashCode * 59 + Reference.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Approved != null)
         {
             hashCode = hashCode * 59 + Approved.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (ThreeDS != null)
         {
             hashCode = hashCode * 59 + ThreeDS.GetHashCode();
         }
         if (Risk != null)
         {
             hashCode = hashCode * 59 + Risk.GetHashCode();
         }
         if (Customer != null)
         {
             hashCode = hashCode * 59 + Customer.GetHashCode();
         }
         if (BillingDescriptor != null)
         {
             hashCode = hashCode * 59 + BillingDescriptor.GetHashCode();
         }
         if (Shipping != null)
         {
             hashCode = hashCode * 59 + Shipping.GetHashCode();
         }
         if (PaymentIp != null)
         {
             hashCode = hashCode * 59 + PaymentIp.GetHashCode();
         }
         if (Eci != null)
         {
             hashCode = hashCode * 59 + Eci.GetHashCode();
         }
         if (SchemeId != null)
         {
             hashCode = hashCode * 59 + SchemeId.GetHashCode();
         }
         if (Links != null)
         {
             hashCode = hashCode * 59 + Links.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if Payment instances are equal
        /// </summary>
        /// <param name="other">Instance of Payment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaymentDetails other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     RequestedOn == other.RequestedOn ||
                     RequestedOn != null &&
                     RequestedOn.Equals(other.RequestedOn)
                 ) &&
                 (
                     Source == other.Source ||
                     Source != null &&
                     Source.Equals(other.Source)
                 ) &&
                 (
                     Destination == other.Destination ||
                     Destination != null &&
                     Destination.Equals(other.Destination)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     PaymentType == other.PaymentType ||
                     PaymentType != null &&
                     PaymentType.Equals(other.PaymentType)
                 ) &&
                 (
                     Reference == other.Reference ||
                     Reference != null &&
                     Reference.Equals(other.Reference)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Approved == other.Approved ||
                     Approved != null &&
                     Approved.Equals(other.Approved)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     ThreeDS == other.ThreeDS ||
                     ThreeDS != null &&
                     ThreeDS.Equals(other.ThreeDS)
                 ) &&
                 (
                     Risk == other.Risk ||
                     Risk != null &&
                     Risk.Equals(other.Risk)
                 ) &&
                 (
                     Customer == other.Customer ||
                     Customer != null &&
                     Customer.Equals(other.Customer)
                 ) &&
                 (
                     BillingDescriptor == other.BillingDescriptor ||
                     BillingDescriptor != null &&
                     BillingDescriptor.Equals(other.BillingDescriptor)
                 ) &&
                 (
                     Shipping == other.Shipping ||
                     Shipping != null &&
                     Shipping.Equals(other.Shipping)
                 ) &&
                 (
                     PaymentIp == other.PaymentIp ||
                     PaymentIp != null &&
                     PaymentIp.Equals(other.PaymentIp)
                 ) &&
                 (
                     Eci == other.Eci ||
                     Eci != null &&
                     Eci.Equals(other.Eci)
                 ) &&
                 (
                     SchemeId == other.SchemeId ||
                     SchemeId != null &&
                     SchemeId.Equals(other.SchemeId)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }