/// <summary> /// Check a user password. Useful if you have specific privileged actions /// requiring users to confirm their password. /// </summary> /// <param name="userIdOrEmail">user id or email address</param> /// <param name="password">user password</param> /// <returns></returns> public Boolean CheckPassword(string userIdOrEmail, string password) { var rgx = new Regex(@".*@.*\.(\w+)"); var att = new NameValueCollection(); att.Add("password", MnoEncryptor.encrypt(password, MnoHelper.With(presetName).Api.Key)); // Check if we should match the password against the id or email if (rgx.IsMatch(userIdOrEmail)) { att.Add("email", userIdOrEmail); } else { att.Add("id", userIdOrEmail); } try { // Raise an error on failure MnoClient.Create <User>(User.IndexPath() + "/authenticate", att, presetName); return(true); } catch (Maestrano.Api.ResourceException) { return(false); } }
public void DeserializeObject_DeserializeDate() { string json = @"{'Date': '0001-01-01T00:00:00Z','IncorrectDate': '0000-01-01T00:00:00Z','IncorrectNullableDate': '-000-01-01T00:00:00Z'}"; var result = MnoClient.DeserializeObject <DateContainer>(json); Assert.AreEqual(new DateTime(1, 1, 1), result.IncorrectDate); Assert.AreEqual(DateTime.MinValue, result.IncorrectDate); Assert.IsNull(result.IncorrectNullableDate); }
public Boolean Cancel() { if (Id != null) { Bill respBill = MnoClient.Delete <Bill>(ResourcePath(), Id); Status = respBill.Status; return(Status.Equals("cancelled")); } return(false); }
public Boolean Cancel() { if (Id != null) { RecurringBill respBill = MnoClient.Delete <RecurringBill>(ResourcePath(), Id); Status = respBill.Status; UpdatedAt = respBill.UpdatedAt; return(Status.Equals("cancelled")); } return(false); }
public Bill Create(String groupId, Int32 priceCents, String description, String currency = "AUD", Decimal?units = null, DateTime?periodStartedAt = null, DateTime?periodEndedAt = null) { var att = new NameValueCollection(); att.Add("groupId", groupId); att.Add("priceCents", priceCents.ToString()); att.Add("description", description); att.Add("currency", currency); if (units.HasValue) { att.Add("units", units.Value.ToString()); } if (periodStartedAt.HasValue) { att.Add("periodStartedAt", periodStartedAt.Value.ToString("s")); } if (periodEndedAt.HasValue) { att.Add("periodEndedAt", periodEndedAt.Value.ToString("s")); } return(MnoClient.Create <Bill>(Bill.IndexPath(), att, presetName)); }
public static RecurringBill Create(String groupId, Int32 priceCents, String description, String currency = "AUD", Int32 initialCents = 0, Int16?frequency = null, Int16?cycles = null, DateTime?startDate = null) { var att = new NameValueCollection(); att.Add("groupId", groupId); att.Add("priceCents", priceCents.ToString()); att.Add("description", description); att.Add("currency", currency); att.Add("initialCents", initialCents.ToString()); if (frequency.HasValue) { att.Add("frequency", frequency.Value.ToString()); } if (cycles.HasValue) { att.Add("cycles", cycles.Value.ToString()); } if (startDate.HasValue) { att.Add("startDate", startDate.Value.ToString("s")); } return(MnoClient.Create <RecurringBill>(IndexPath(), att)); }
public Bill Retrieve(string billId) { return(MnoClient.Retrieve <Bill>(Bill.ResourcePath(), billId, presetName)); }
public List <Bill> All(NameValueCollection filters = null) { return(MnoClient.All <Bill>(Bill.IndexPath(), filters, presetName)); }
public static List <Bill> All(NameValueCollection filters = null) { return(MnoClient.All <Bill>(IndexPath(), filters)); }
public static Bill Retrieve(string billId) { return(MnoClient.Retrieve <Bill>(ResourcePath(), billId)); }
/// <summary> /// Retrieve a single Maestrano user by id /// </summary> /// <param name="userId"></param> /// <returns></returns> public User Retrieve(string userId) { return(MnoClient.Retrieve <User>(User.ResourcePath(), userId, presetName)); }
/// <summary> /// Retrieve all Maestrano users having access to your application /// </summary> /// <param name="filters">User attributes to filter on</param> /// <returns></returns> public List <User> All(NameValueCollection filters = null) { return(MnoClient.All <User>(User.IndexPath(), filters, presetName)); }
/// <summary> /// Retrieve a single Maestrano group by id /// </summary> /// <param name="groupId"></param> /// <returns></returns> public Group Retrieve(string groupId) { return(MnoClient.Retrieve <Group>(Group.ResourcePath(), groupId, presetName)); }
/// <summary> /// Retrieve all Maestrano groups having access to your application /// </summary> /// <param name="filters">User attributes to filter on</param> /// <returns></returns> public List <Group> All(NameValueCollection filters = null) { return(MnoClient.All <Group>(Group.IndexPath(), filters, presetName)); }
/// <summary> /// Retrieve a single Maestrano user by id /// </summary> /// <param name="userId"></param> /// <returns></returns> public static User Retrieve(string userId) { return(MnoClient.Retrieve <User>(ResourcePath(), userId)); }
/// <summary> /// Retrieve a single Maestrano group by id /// </summary> /// <param name="groupId"></param> /// <returns></returns> public static Group Retrieve(string groupId) { return(MnoClient.Retrieve <Group>(ResourcePath(), groupId)); }