Example #1
0
 /// <summary>
 /// Create service model from model
 /// </summary>
 public ApplicationInfoModel ToServiceModel()
 {
     return(new ApplicationInfoModel {
         ApplicationId = ApplicationId,
         ApplicationType = ApplicationType,
         ApplicationUri = ApplicationUri,
         ApplicationName = ApplicationName,
         Locale = Locale,
         LocalizedNames = LocalizedNames,
         Certificate = Certificate,
         ProductUri = ProductUri,
         SiteId = SiteId,
         HostAddresses = HostAddresses,
         SupervisorId = SupervisorId,
         DiscoveryProfileUri = DiscoveryProfileUri,
         DiscoveryUrls = DiscoveryUrls,
         Capabilities = Capabilities,
         NotSeenSince = NotSeenSince,
         State = State,
         GatewayServerUri = GatewayServerUri,
         Created = Created?.ToServiceModel(),
         Approved = Approved?.ToServiceModel(),
         Updated = Updated?.ToServiceModel(),
     });
 }
Example #2
0
        public async Task Update([FromBody] PullRequestUpdated pullRequestUpdated)
        {
            //TODO: throw if id not exists
            //if there are reviewers with vote == 10(approved)
            if (pullRequestUpdated.resource.reviewers.Any(y => y.vote == 10))
            {
                //get the existing list of approvers and compare
                var approvers   = _DBHelper.GetApprovers(pullRequestUpdated).Result;
                var newApprover = pullRequestUpdated.resource.reviewers.Where(x => x.vote == 10 && !x.displayName.EndsWith(" Team") && !approvers.Contains(x.displayName));
                if (newApprover.Count() != 1)
                {
                    throw new ArgumentException();
                }                                                               //why would this happen??

                var approvedBy = newApprover.First().displayName;
                var approved   = new Approved
                {
                    pullRequestId = pullRequestUpdated.resource.pullRequestId,
                    approvedBy    = approvedBy,
                    approvedAt    = DateTime.UtcNow
                };
                await _DBHelper.InsertApproved(approved);

                var pullRequests = await _DBHelper.GetPullRequests();

                await _hub.Clients.All.SendAsync("updatePullRequests", pullRequests);
            }
        }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (SuggestionsId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Customer_Name?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Sender_Name?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Sender_Address?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Existing_Sender_City?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Normalised_Sender_City?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Sender_Country?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Sender_Zipcode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Receiver_Name?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Receiver_Address?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Existing_Receiver_City?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Normalised_Receiver_City?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Existing_Pallet_Name?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Normalised_Pallet_Name?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Receiver_Zipcode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Receiver_Country?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Carrier?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Order_Number?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Shipment_Date?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Weight?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Volume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Cost?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Currency?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Number_Of_Pallets?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Suggestion_Date?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Approved.GetHashCode());
            hashCode = hashCode * -1521134295 + (ApprovedBy?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ApprovedDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Owner?.GetHashCode() ?? 0);
            return(hashCode);
        }
        public IActionResult OnPostReview()
        {
            Confirmation = false;
            CBS RequestDirecter = new CBS();

            Golfer.Approved = Approved.ToString();
            DateTime.TryParse(MembershipStartDate, out DateTime date);
            Golfer.MembershipStartDate = date;
            Golfer.MemberNumber        = (int)TempData["MemberNumber"];

            Confirmation = RequestDirecter.ReviewMembershipApplication(Golfer);

            if (Confirmation)
            {
                TempData["Alert"] = $"Successfully Updated Membership Application";
                return(RedirectToPage("/Index"));
            }
            else
            {
                TempData["Danger"] = true;
                Alert  = $"Could Not Update Membership Application";
                Golfer = null;
            }

            return(Page());
        }
Example #5
0
        public static List <Approved> GetApproved()
        {
            var dbUtil    = new DatabaseManager();
            var approveds = new List <Approved>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spAccGLGetApprovalStatus";
                    cmd.CommandTimeout = 180;
                    cmd.Parameters.Clear();

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var approved = new Approved
                            {
                                ApprovedID  = ReferenceEquals(reader["intApprovedID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intApprovedID"]),
                                Description = ReferenceEquals(reader["strDescription"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strDescription"])
                            };

                            approveds.Add(approved);
                        }

                        return(approveds);
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        ///     使用一定的格式构造一个字符串
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        public string ToString(string format, IFormatProvider formatProvider)
        {
            var b = new StringBuilder(format);

            b.Replace("Artist", Artist);
            b.Replace("artist", Artist);
            b.Replace("bpm", Bpm.ToString(CultureInfo.CurrentCulture));
            b.Replace("stars", Stars.ToString(CultureInfo.CurrentCulture));
            b.Replace("mode", Mode.ToString());
            b.Replace("cs", CircleSize.ToString(CultureInfo.CurrentCulture));
            b.Replace("ar", ApproachRate.ToString(CultureInfo.CurrentCulture));
            b.Replace("hp", HpDrain.ToString(CultureInfo.CurrentCulture));
            b.Replace("od", OverallDifficulty.ToString(CultureInfo.CurrentCulture));
            b.Replace("circles", HitCircle.ToString());
            b.Replace("sliders", Slider.ToString());
            b.Replace("spiners", Spinner.ToString());
            b.Replace("creator", Creator);
            b.Replace("Title", Title);
            b.Replace("title", Title);
            b.Replace("Tags", Tags);
            b.Replace("tags", Tags);
            b.Replace("setid", BeatmapSetId.ToString());
            b.Replace("maxcombo", MaxCombo.ToString());
            b.Replace("approved", Approved.ToString());
            var total = TimeSpan.FromSeconds(TotalTime);
            var hit   = TimeSpan.FromSeconds(DrainTime);

            b.Replace("length", $"{total.TotalMinutes}:{total.Seconds}");
            b.Replace("hitlength", $"{hit.TotalMinutes}:{hit.Seconds}");
            b.Replace("version", Version);
            b.Replace("md5", Md5);
            b.Replace("id", BeatmapId.ToString());
            return(b.ToString());
        }
Example #7
0
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     Cancel.Update();
     Approved.Update();
     Session["gg"] = "Cancellation Request Granted.";
     ccancel.Insert();
     Response.Redirect("~/admin/RFC.aspx?rr=0");
 }
Example #8
0
        public ActionResult DeleteConfirmed(string id)
        {
            Approved approved = db.Approveds.Find(id);

            db.Approveds.Remove(approved);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #9
0
 public override string ToString()
 {
     return(string.Format(
                "approved = {0}, issued = {1}",
                Approved.ToString("C0", Program.Culture),
                Issued.ToString("C0", Program.Culture)
                ));
 } // ToString
Example #10
0
 public ActionResult Edit([Bind(Include = "Name,status")] Approved approved)
 {
     if (ModelState.IsValid)
     {
         db.Entry(approved).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(approved));
 }
        public async Task InsertApproved(Approved approved)
        {
            string insertQuery = "INSERT INTO Approved (PullRequestid, ApprovedBy, ApprovedAt)"
                                 + " VALUES(@pullRequestId, @approvedBy, @approvedAt)";

            using (IDbConnection dbConnection = Connection)
            {
                await dbConnection.ExecuteAsync(insertQuery, approved);
            }
        }
Example #12
0
        public ActionResult Create([Bind(Include = "Name,status")] Approved approved)
        {
            if (ModelState.IsValid)
            {
                db.Approveds.Add(approved);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(approved));
        }
Example #13
0
 /// <summary>
 /// To service model
 /// </summary>
 /// <returns></returns>
 public CertificateRequestRecordModel ToServiceModel()
 {
     return(new CertificateRequestRecordModel {
         RequestId = RequestId,
         EntityId = EntityId,
         Type = Type,
         State = State,
         GroupId = GroupId,
         Submitted = Submitted?.ToServiceModel(),
         Accepted = Accepted?.ToServiceModel(),
         Approved = Approved?.ToServiceModel(),
         ErrorInfo = ErrorInfo
     });
 }
Example #14
0
        // GET: Approveds/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Approved approved = db.Approveds.Find(id);

            if (approved == null)
            {
                return(HttpNotFound());
            }
            return(View(approved));
        }
Example #15
0
        /// <summary>
        /// Checks for at least one filter in the GetItem request.
        /// See GetItem Post https://developers.neto.com.au/documentation/engineers/api-documentation/products/getitem
        /// </summary>
        /// <returns>bool</returns>
        internal override bool isValid()
        {
            if (!string.IsNullOrWhiteSpace(ParentSKU))
            {
                return(true);
            }

            if (DateAddedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateAddedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedTo != DateTime.MinValue)
            {
                return(true);
            }

            int requiredFilterCount = SKU.NullSafeLength() +
                                      AccountingCode.NullSafeLength() +
                                      InventoryID.NullSafeLength() +
                                      Brand.NullSafeLength() +
                                      Model.NullSafeLength() +
                                      Name.NullSafeLength() +
                                      PrimarySupplier.NullSafeLength() +
                                      Approved.NullSafeLength() +
                                      ApprovedForPOS.NullSafeLength() +
                                      ApprovedForMobileStore.NullSafeLength() +
                                      SalesChannels.NullSafeLength() +
                                      Visible.NullSafeLength() +
                                      IsActive.NullSafeLength() +
                                      CategoryID.NullSafeLength();


            if (requiredFilterCount != 0)
            {
                return(true);
            }

            throw new NetoRequestException("At least one filter is required in the GetItem request");
        }
Example #16
0
        public bool Equals(ForumRecruitmentDetail input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     TopicId == input.TopicId ||
                     (TopicId.Equals(input.TopicId))
                     ) &&
                 (
                     MicrophoneRequired == input.MicrophoneRequired ||
                     (MicrophoneRequired != null && MicrophoneRequired.Equals(input.MicrophoneRequired))
                 ) &&
                 (
                     Intensity == input.Intensity ||
                     (Intensity != null && Intensity.Equals(input.Intensity))
                 ) &&
                 (
                     Tone == input.Tone ||
                     (Tone != null && Tone.Equals(input.Tone))
                 ) &&
                 (
                     Approved == input.Approved ||
                     (Approved != null && Approved.Equals(input.Approved))
                 ) &&
                 (
                     ConversationId == input.ConversationId ||
                     (ConversationId.Equals(input.ConversationId))
                 ) &&
                 (
                     PlayerSlotsTotal == input.PlayerSlotsTotal ||
                     (PlayerSlotsTotal.Equals(input.PlayerSlotsTotal))
                 ) &&
                 (
                     PlayerSlotsRemaining == input.PlayerSlotsRemaining ||
                     (PlayerSlotsRemaining.Equals(input.PlayerSlotsRemaining))
                 ) &&
                 (
                     Fireteam == input.Fireteam ||
                     (Fireteam != null && Fireteam.SequenceEqual(input.Fireteam))
                 ) &&
                 (
                     KickedPlayerIds == input.KickedPlayerIds ||
                     (KickedPlayerIds != null && KickedPlayerIds.SequenceEqual(input.KickedPlayerIds))
                 ));
        }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Submitted != null)
     {
         Submitted.Validate();
     }
     if (Approved != null)
     {
         Approved.Validate();
     }
     if (Accepted != null)
     {
         Accepted.Validate();
     }
 }
Example #18
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        UpdateDate.Update();
        Approved.Update();
        ResUpdate.Update();
        TagUpdate.Update();
        DataView dv = (DataView)AfftectedSelect.Select(DataSourceSelectArguments.Empty);
        int      x  = 0;

        foreach (DataRow dr in dv.Table.Rows)
        {
            Session["rr"] = (int)dv.Table.Rows[x][0];
            Session["gg"] = "Event Date Already Reserved";
            ccancel.Insert();
        }
        Response.Redirect("~/admin/RFR.aspx?rr=0");
    }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "commentid": // Int
                return(CommentID.ToString(strFormat, formatProvider));

            case "componentid": // Int
                return(ComponentId.ToString(strFormat, formatProvider));

            case "itemtype": // Int
                return(ItemType.ToString(strFormat, formatProvider));

            case "itemid": // Int
                return(ItemId.ToString(strFormat, formatProvider));

            case "parentid": // Int
                if (ParentId == null)
                {
                    return("");
                }
                ;
                return(((int)ParentId).ToString(strFormat, formatProvider));

            case "message": // NVarCharMax
                return(PropertyAccess.FormatString(Message, strFormat));

            case "approved": // Bit
                if (Approved == null)
                {
                    return("");
                }
                ;
                return(Approved.ToString());

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Example #20
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            Approved approved = (Approved)value;

            switch (approved)
            {
            case Approved.Graveyard:
                writer.WriteValue("-2");
                break;

            case Approved.WIP:
                writer.WriteValue("-1");
                break;

            case Approved.Pending:
                writer.WriteValue("0");
                break;

            case Approved.Ranked:
                writer.WriteValue("1");
                break;

            case Approved.Approved:
                writer.WriteValue("2");
                break;

            case Approved.Qualified:
                writer.WriteValue("3");
                break;

            case Approved.Loved:
                writer.WriteValue("4");
                break;

            default:
                writer.WriteNull();
                break;
            }
        }
Example #21
0
 public void Add(RegisteredCourse type)
 {
     lock (type)
     {
         if (Count == RegisteredCourseId.Length)
         {
             var newLength           = RegisteredCourseId.Length + 1000;
             var _RegisteredCourseId = new string[newLength];
             RegisteredCourseId.CopyTo(_RegisteredCourseId);
             RegisteredCourseId = _RegisteredCourseId;
             var _RegistrationDate = new System.DateTime[newLength];
             RegistrationDate.CopyTo(_RegistrationDate);
             RegistrationDate = _RegistrationDate;
             var _StudentId = new string[newLength];
             StudentId.CopyTo(_StudentId);
             StudentId = _StudentId;
             var _Semester = new string[newLength];
             Semester.CopyTo(_Semester);
             Semester = _Semester;
             var _MountedCourseId = new string[newLength];
             MountedCourseId.CopyTo(_MountedCourseId);
             MountedCourseId = _MountedCourseId;
             var _AcademicYear = new string[newLength];
             AcademicYear.CopyTo(_AcademicYear);
             AcademicYear = _AcademicYear;
             var _Approved = new bool[newLength];
             Approved.CopyTo(_Approved);
             Approved = _Approved;
         }
         RegisteredCourseId.Span[Count] = type.RegisteredCourseId;
         RegistrationDate.Span[Count]   = type.RegistrationDate;
         StudentId.Span[Count]          = type.StudentId;
         Semester.Span[Count]           = type.Semester;
         MountedCourseId.Span[Count]    = type.MountedCourseId;
         AcademicYear.Span[Count]       = type.AcademicYear;
         Approved.Span[Count]           = type.Approved;
     }
 }
Example #22
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Capabilities != null)
     {
         if (Capabilities.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(Capabilities)))
         {
             throw new ValidationException(ValidationRules.UniqueItems, "Capabilities");
         }
     }
     if (DiscoveryUrls != null)
     {
         if (DiscoveryUrls.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(DiscoveryUrls)))
         {
             throw new ValidationException(ValidationRules.UniqueItems, "DiscoveryUrls");
         }
     }
     if (HostAddresses != null)
     {
         if (HostAddresses.Count != System.Linq.Enumerable.Count(System.Linq.Enumerable.Distinct(HostAddresses)))
         {
             throw new ValidationException(ValidationRules.UniqueItems, "HostAddresses");
         }
     }
     if (Created != null)
     {
         Created.Validate();
     }
     if (Approved != null)
     {
         Approved.Validate();
     }
     if (Updated != null)
     {
         Updated.Validate();
     }
 }
Example #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["rr"] == null)
     {
         Label1.Text = "";
     }
     else if (Request.QueryString["rr"] == "0")
     {
         Label1.Text = "Request Approved";
     }
     else if (Request.QueryString["rr"] == "1")
     {
         Label1.Text = "Request Rejected";
     }
     if (Request.QueryString["ReservationId"] != null)
     {
         DataView dv    = (DataView)Approved.Select(DataSourceSelectArguments.Empty);
         DateTime ddate = (DateTime)dv.Table.Rows[0][0];
         TextBox1.Text = ddate.ToShortDateString();
         DataView dv2 = (DataView)Cancel0.Select(DataSourceSelectArguments.Empty);
         int      x   = (int)dv2.Table.Rows[0][0];
         TextBox2.Text = x.ToString();
     }
 }
Example #24
0
        internal override void MapResponse(Element response)
        {
            base.MapResponse(response);

            string category = response.GetValue <string>("TableCategory") ?? "";

            if (category == null)
            {
                category = LastCategory;
            }
            var fieldValues = new Dictionary <string, string>();

            foreach (Element field in response.GetAll("Field"))
            {
                fieldValues.Add(field.GetValue <string>("Key"), field.GetValue <string>("Value"));
            }

            if (category.EndsWith("SUMMARY", StringComparison.OrdinalIgnoreCase))
            {
                var summary = new SummaryResponse {
                    SummaryType      = MapSummaryType(category),
                    Count            = fieldValues.GetValue <int>("Count"),
                    Amount           = fieldValues.GetAmount("Amount"),
                    TotalAmount      = fieldValues.GetAmount("Total Amount"),
                    AuthorizedAmount = fieldValues.GetAmount("Authorized Amount"),
                    AmountDue        = fieldValues.GetAmount("Balance Due Amount"),
                };

                if (category.Contains("APPROVED"))
                {
                    if (Approved == null)
                    {
                        Approved = new Dictionary <SummaryType, SummaryResponse>();
                    }
                    Approved.Add(summary.SummaryType, summary);
                }
                else if (category.StartsWith("PENDING"))
                {
                    if (Pending == null)
                    {
                        Pending = new Dictionary <SummaryType, SummaryResponse>();
                    }
                    Pending.Add(summary.SummaryType, summary);
                }
                else if (category.StartsWith("DECLINED"))
                {
                    if (Declined == null)
                    {
                        Declined = new Dictionary <SummaryType, SummaryResponse>();
                    }
                    Declined.Add(summary.SummaryType, summary);
                }
            }
            else if (category.EndsWith("RECORD", StringComparison.OrdinalIgnoreCase))
            {
                TransactionSummary trans;
                if (category.Equals(LastCategory, StringComparison.OrdinalIgnoreCase))
                {
                    trans = LastTransactionSummary;
                }
                else
                {
                    trans = new TransactionSummary {
                        TransactionId         = fieldValues.GetValue <string>("TransactionId"),
                        OriginalTransactionId = fieldValues.GetValue <string>("OriginalTransactionId"),
                        TransactionDate       = fieldValues.GetValue <string>("TransactionTime").ToDateTime(),
                        TransactionType       = fieldValues.GetValue <string>("TransactionType"),
                        MaskedCardNumber      = fieldValues.GetValue <string>("MaskedPAN"),
                        CardType              = fieldValues.GetValue <string>("CardType"),
                        CardEntryMethod       = fieldValues.GetValue <string>("CardAcquisition"),
                        AuthCode              = fieldValues.GetValue <string>("ApprovalCode"),
                        IssuerResponseCode    = fieldValues.GetValue <string>("ResponseCode"),
                        IssuerResponseMessage = fieldValues.GetValue <string>("ResponseText"),
                        HostTimeout           = (bool)fieldValues.GetBoolean("HostTimeOut"),
                        // BaseAmount - Not doing this one
                        TaxAmount        = fieldValues.GetAmount("TaxAmount"),
                        GratuityAmount   = fieldValues.GetAmount("TipAmount"),
                        Amount           = fieldValues.GetAmount("RequestAmount"),
                        AuthorizedAmount = fieldValues.GetAmount("Authorized Amount"),
                        AmountDue        = fieldValues.GetAmount("Balance Due Amount")
                    };
                }
                if (!(category.Equals(LastCategory)))
                {
                    if (category.StartsWith("APPROVED"))
                    {
                        var summary = Approved[SummaryType.Approved];
                        summary.Transactions.Add(trans);
                    }
                    else if (category.StartsWith("PENDING"))
                    {
                        var summary = Pending[SummaryType.Pending];
                        summary.Transactions.Add(trans);
                    }
                    else if (category.StartsWith("DECLINED"))
                    {
                        var summary = Declined[SummaryType.Declined];
                        summary.Transactions.Add(trans);
                    }
                }
                LastTransactionSummary = trans;
            }
            LastCategory = category;
        }
Example #25
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);
     }
 }
        /// <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)
                 ));
        }
 /// <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);
     }
 }
Example #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="approved"></param>
 /// <returns><c>true</c> if the approve state will never change.</returns>
 public static bool Fixed(this Approved approved) => s_rankedStates.Contains(approved);
Example #29
0
        public async Task When_Order_Approved_Message_Should_Be_Sent_To_Confirm_Member_On_Lending_Unit()
        {
            var ev = new Approved(orderId, 1);

            await Run(ev, lending_ConfirmMemberId);
        }
Example #30
0
        public UpaSAFResponse(JsonDoc root)
        {
            Approved = new Dictionary <SummaryType, SummaryResponse>();
            Pending  = new Dictionary <SummaryType, SummaryResponse>();
            Declined = new Dictionary <SummaryType, SummaryResponse>();

            var firstDataNode = root.Get("data");

            if (firstDataNode == null)
            {
                throw new MessageException(INVALID_RESPONSE_FORMAT);
            }

            var cmdResult = firstDataNode.Get("cmdResult");

            if (cmdResult == null)
            {
                throw new MessageException(INVALID_RESPONSE_FORMAT);
            }

            Status = cmdResult.GetValue <string>("result");
            if (string.IsNullOrEmpty(Status))
            {
                var errorCode = cmdResult.GetValue <string>("errorCode");
                var errorMsg  = cmdResult.GetValue <string>("errorMessage");
                DeviceResponseText = $"Error: {errorCode} - {errorMsg}";
            }
            else
            {
                // If the Status is not "Success", there is either nothing to process, or something else went wrong.
                // Skip the processing of the rest of the message, as we'll likely hit null reference exceptions
                if (Status == "Success")
                {
                    var secondDataNode = firstDataNode.Get("data");
                    if (secondDataNode == null)
                    {
                        throw new MessageException(INVALID_RESPONSE_FORMAT);
                    }
                    Multiplemessage = secondDataNode.GetValue <string>("multipleMessage");
                    var safDetailsList = secondDataNode.GetEnumerator("SafDetails");

                    if (safDetailsList != null)
                    {
                        foreach (var detail in safDetailsList)
                        {
                            if (TotalAmount == null)
                            {
                                TotalAmount = 0.00m;
                            }

                            TotalAmount += detail.GetValue <decimal>("SafTotal");
                            TotalCount  += detail.GetValue <int>("SafCount");

                            SummaryResponse summaryResponse = new SummaryResponse()
                            {
                                TotalAmount  = detail.GetValue <decimal>("SafTotal"),
                                Count        = detail.GetValue <int>("SafCount"),
                                SummaryType  = MapSummaryType(detail.GetValue <string>("SafType")),
                                Transactions = new List <TransactionSummary>()
                            };

                            if (detail.Has("SafRecords"))
                            {
                                foreach (var record in detail.GetEnumerator("SafRecords"))
                                {
                                    TransactionSummary transactionSummary = new TransactionSummary()
                                    {
                                        TransactionType   = record.GetValue <string>("transactionType"),
                                        TerminalRefNumber = record.GetValue <string>("transId"), // The sample XML says tranNo?
                                        ReferenceNumber   = record.GetValue <string>("referenceNumber"),
                                        GratuityAmount    = record.GetValue <decimal>("tipAmount"),
                                        TaxAmount         = record.GetValue <decimal>("taxAmount"),
                                        Amount            = record.GetValue <decimal>("baseAmount"),
                                        AuthorizedAmount  = record.GetValue <decimal>("authorizedAmount"),
                                        //AmountDue = record.GetValue<decimal>("totalAmount"),
                                        CardType         = record.GetValue <string>("cardType"),
                                        MaskedCardNumber = record.GetValue <string>("maskedPan"),
                                        TransactionDate  = record.GetValue <DateTime>("transactionTime"),
                                        AuthCode         = record.GetValue <string>("approvalCode"),
                                        HostTimeout      = record.GetValue <bool>("hostTimeOut"),
                                        CardEntryMethod  = record.GetValue <string>("cardAcquisition"),
                                        Status           = record.GetValue <string>("responseCode"),
                                        //record.GetValue<decimal>("requestAmount")
                                    };
                                    summaryResponse.Transactions.Add(transactionSummary);
                                }
                            }

                            if (summaryResponse.SummaryType == SummaryType.Approved)
                            {
                                if (Approved == null)
                                {
                                    Approved = new Dictionary <SummaryType, SummaryResponse>();
                                }
                                Approved.Add(summaryResponse.SummaryType, summaryResponse);
                            }
                            else if (summaryResponse.SummaryType == SummaryType.Pending)
                            {
                                if (Pending == null)
                                {
                                    Pending = new Dictionary <SummaryType, SummaryResponse>();
                                }
                                Pending.Add(summaryResponse.SummaryType, summaryResponse);
                            }
                            else if (summaryResponse.SummaryType == SummaryType.Declined)
                            {
                                if (Declined == null)
                                {
                                    Declined = new Dictionary <SummaryType, SummaryResponse>();
                                }
                                Declined.Add(summaryResponse.SummaryType, summaryResponse);
                            }
                        }
                    }
                }
                else   // the only other option is "Failed"
                {
                    var errorCode = cmdResult.GetValue <string>("errorCode");
                    var errorMsg  = cmdResult.GetValue <string>("errorMessage");
                    DeviceResponseText = $"Error: {errorCode} - {errorMsg}";
                }
            }
        }