/// <summary> /// Retrieves the ParticipantId which is retrieved using the supplied XPath. /// </summary> /// <param name="xPathExpr"></param> /// <returns></returns> protected ParticipantIdentifier ParticipantId(String xPathExpr) { ParticipantId ret; // first we retrieve the correct participant element XElement element; try { element = this.Parser.RetrieveElementForXpath(xPathExpr); } catch (Exception) { // DOM parser throws "java.lang.IllegalStateException: No element in XPath: ..." if no Element is found throw new InvalidOperationException(String.Format("No ParticipantId found at '{0}'.", xPathExpr)); } // get value and any schemeId given String companyId = (element.FirstNode as XText)?.Value.Trim(); String schemeIdTextValue = element.Attribute("schemeID")?.Value.Trim(); // check if we already have a valid participant 9908:987654321 if (Identifier.ParticipantId.IsValidParticipantIdentifierPattern(companyId)) { Debug.Assert(schemeIdTextValue != null, nameof(schemeIdTextValue) + " != null"); if (schemeIdTextValue.Length == 0) { // we accept participants with icd prefix if schemeId is missing ... ret = new ParticipantId(companyId); } else { // ... or when given schemeId matches the icd code stat eg NO:VAT matches 9908 from 9908:987654321 Debug.Assert(companyId != null, nameof(companyId) + " != null"); if (companyId.StartsWith(SchemeId.Parse(schemeIdTextValue).Code + ":")) { ret = new ParticipantId(companyId); } else { throw new InvalidOperationException( string.Format( "ParticipantId at '{0}' is illegal, schemeId '{1}' and icd code prefix of '{2}' does not match", xPathExpr, schemeIdTextValue, companyId)); } } } else { // try to add the given icd prefix to the participant id companyId = String.Format("{0}:{1}", SchemeId.Parse(schemeIdTextValue).Code, companyId); if (!Identifier.ParticipantId.IsValidParticipantIdentifierPattern(companyId)) { throw new InvalidOperationException( $"ParticipantId syntax at '{xPathExpr}' evaluates to '{companyId}' and is invalid"); } ret = new ParticipantId(companyId); } return(ret.ToVefa()); }
/// <summary> /// Returns true if ProcessInfo instances are equal /// </summary> /// <param name="other">Instance of ProcessInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(ProcessInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( StateName == other.StateName || StateName != null && StateName.Equals(other.StateName) ) && ( ActivityName == other.ActivityName || ActivityName != null && ActivityName.Equals(other.ActivityName) ) && ( SchemeId == other.SchemeId || SchemeId != null && SchemeId.Equals(other.SchemeId) ) && ( SchemeCode == other.SchemeCode || SchemeCode != null && SchemeCode.Equals(other.SchemeCode) ) && ( PreviousState == other.PreviousState || PreviousState != null && PreviousState.Equals(other.PreviousState) ) && ( PreviousStateForDirect == other.PreviousStateForDirect || PreviousStateForDirect != null && PreviousStateForDirect.Equals(other.PreviousStateForDirect) ) && ( PreviousStateForReverse == other.PreviousStateForReverse || PreviousStateForReverse != null && PreviousStateForReverse.Equals(other.PreviousStateForReverse) ) && ( PreviousActivity == other.PreviousActivity || PreviousActivity != null && PreviousActivity.Equals(other.PreviousActivity) ) && ( PreviousActivityForDirect == other.PreviousActivityForDirect || PreviousActivityForDirect != null && PreviousActivityForDirect.Equals(other.PreviousActivityForDirect) ) && ( PreviousActivityForReverse == other.PreviousActivityForReverse || PreviousActivityForReverse != null && PreviousActivityForReverse.Equals(other.PreviousActivityForReverse) ) && ( ParentProcessId == other.ParentProcessId || ParentProcessId != null && ParentProcessId.Equals(other.ParentProcessId) ) && ( RootProcessId == other.RootProcessId || RootProcessId != null && RootProcessId.Equals(other.RootProcessId) ) && ( InstanceStatus == other.InstanceStatus || InstanceStatus != null && InstanceStatus.Equals(other.InstanceStatus) ) && ( Transitions == other.Transitions || Transitions != null && Transitions.SequenceEqual(other.Transitions) ) && ( History == other.History || History != null && History.SequenceEqual(other.History) ) && ( ProcessParameters == other.ProcessParameters || ProcessParameters != null && ProcessParameters.Equals(other.ProcessParameters) )); }
/// <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 (StateName != null) { hashCode = hashCode * 59 + StateName.GetHashCode(); } if (ActivityName != null) { hashCode = hashCode * 59 + ActivityName.GetHashCode(); } if (SchemeId != null) { hashCode = hashCode * 59 + SchemeId.GetHashCode(); } if (SchemeCode != null) { hashCode = hashCode * 59 + SchemeCode.GetHashCode(); } if (PreviousState != null) { hashCode = hashCode * 59 + PreviousState.GetHashCode(); } if (PreviousStateForDirect != null) { hashCode = hashCode * 59 + PreviousStateForDirect.GetHashCode(); } if (PreviousStateForReverse != null) { hashCode = hashCode * 59 + PreviousStateForReverse.GetHashCode(); } if (PreviousActivity != null) { hashCode = hashCode * 59 + PreviousActivity.GetHashCode(); } if (PreviousActivityForDirect != null) { hashCode = hashCode * 59 + PreviousActivityForDirect.GetHashCode(); } if (PreviousActivityForReverse != null) { hashCode = hashCode * 59 + PreviousActivityForReverse.GetHashCode(); } if (ParentProcessId != null) { hashCode = hashCode * 59 + ParentProcessId.GetHashCode(); } if (RootProcessId != null) { hashCode = hashCode * 59 + RootProcessId.GetHashCode(); } if (InstanceStatus != null) { hashCode = hashCode * 59 + InstanceStatus.GetHashCode(); } if (Transitions != null) { hashCode = hashCode * 59 + Transitions.GetHashCode(); } if (History != null) { hashCode = hashCode * 59 + History.GetHashCode(); } if (ProcessParameters != null) { hashCode = hashCode * 59 + ProcessParameters.GetHashCode(); } return(hashCode); } }
/// <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 (ActionId != null) { hashCode = hashCode * 59 + ActionId.GetHashCode(); } if (Amount != null) { hashCode = hashCode * 59 + Amount.GetHashCode(); } if (Currency != null) { hashCode = hashCode * 59 + Currency.GetHashCode(); } if (Approved != null) { hashCode = hashCode * 59 + Approved.GetHashCode(); } if (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (AuthCode != null) { hashCode = hashCode * 59 + AuthCode.GetHashCode(); } if (ResponseCode != null) { hashCode = hashCode * 59 + ResponseCode.GetHashCode(); } if (ResponseSummary != null) { hashCode = hashCode * 59 + ResponseSummary.GetHashCode(); } if (ThreeDS != null) { hashCode = hashCode * 59 + ThreeDS.GetHashCode(); } if (Risk != null) { hashCode = hashCode * 59 + Risk.GetHashCode(); } if (Source != null) { hashCode = hashCode * 59 + Source.GetHashCode(); } if (Customer != null) { hashCode = hashCode * 59 + Customer.GetHashCode(); } if (ProcessedOn != null) { hashCode = hashCode * 59 + ProcessedOn.GetHashCode(); } if (Reference != null) { hashCode = hashCode * 59 + Reference.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); } }
/// <summary> /// Returns true if PaymentResponse instances are equal /// </summary> /// <param name="other">Instance of PaymentResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaymentResponse other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( ActionId == other.ActionId || ActionId != null && ActionId.Equals(other.ActionId) ) && ( Amount == other.Amount || Amount != null && Amount.Equals(other.Amount) ) && ( Currency == other.Currency || Currency != null && Currency.Equals(other.Currency) ) && ( Approved == other.Approved || Approved != null && Approved.Equals(other.Approved) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( AuthCode == other.AuthCode || AuthCode != null && AuthCode.Equals(other.AuthCode) ) && ( ResponseCode == other.ResponseCode || ResponseCode != null && ResponseCode.Equals(other.ResponseCode) ) && ( ResponseSummary == other.ResponseSummary || ResponseSummary != null && ResponseSummary.Equals(other.ResponseSummary) ) && ( ThreeDS == other.ThreeDS || ThreeDS != null && ThreeDS.Equals(other.ThreeDS) ) && ( Risk == other.Risk || Risk != null && Risk.Equals(other.Risk) ) && ( Source == other.Source || Source != null && Source.Equals(other.Source) ) && ( Customer == other.Customer || Customer != null && Customer.Equals(other.Customer) ) && ( ProcessedOn == other.ProcessedOn || ProcessedOn != null && ProcessedOn.Equals(other.ProcessedOn) ) && ( Reference == other.Reference || Reference != null && Reference.Equals(other.Reference) ) && ( 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) )); }
public override int GetHashCode() { return(SchemeId.GetHashCode() ^ Year.GetHashCode() ^ Quarter.GetHashCode()); }
/// <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); } }
/// <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) )); }