/// <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 (Source != null) { hashCode = hashCode * 59 + Source.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(); } hashCode = hashCode * 59 + Reference.GetHashCode(); if (Description != null) { hashCode = hashCode * 59 + Description.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 (ThreeDS != null) { hashCode = hashCode * 59 + ThreeDS.GetHashCode(); } if (PreviousPaymentId != null) { hashCode = hashCode * 59 + PreviousPaymentId.GetHashCode(); } if (Risk != null) { hashCode = hashCode * 59 + Risk.GetHashCode(); } if (SuccessUrl != null) { hashCode = hashCode * 59 + SuccessUrl.GetHashCode(); } if (FailureUrl != null) { hashCode = hashCode * 59 + FailureUrl.GetHashCode(); } if (PaymentIp != null) { hashCode = hashCode * 59 + PaymentIp.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if PaymentRequest instances are equal /// </summary> /// <param name="other">Instance of PaymentRequest to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaymentRequest <TPaymentSource> other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Source == other.Source || Source != null && Source.Equals(other.Source) ) && ( 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) ) && ( 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) ) && ( ThreeDS == other.ThreeDS || ThreeDS != null && ThreeDS.Equals(other.ThreeDS) ) && ( PreviousPaymentId == other.PreviousPaymentId || PreviousPaymentId != null && PreviousPaymentId.Equals(other.PreviousPaymentId) ) && ( Risk == other.Risk || Risk != null && Risk.Equals(other.Risk) ) && ( SuccessUrl == other.SuccessUrl || SuccessUrl != null && SuccessUrl.Equals(other.SuccessUrl) ) && ( FailureUrl == other.FailureUrl || FailureUrl != null && FailureUrl.Equals(other.FailureUrl) ) && ( PaymentIp == other.PaymentIp || PaymentIp != null && PaymentIp.Equals(other.PaymentIp) )); }