Hello, all!
So I'm making an app that will check if the user's promo code exists in my database of promo codes. It was working a while ago but now, I dont know why it suddenly returns everything as valid? Here is my code:
string coupon_code = input_code.text;
// Prepare the target bucket to be queried.
KiiBucket bucket = Kii.Bucket("PromoCodes");
// Create a query with clauses.
KiiQuery query = new KiiQuery(KiiClause.And(KiiClause.Equals("Promo Code", coupon_code)));
query.Limit = 1;
// Query KiiObjects.
bucket.Query(query, (KiiQueryResult<KiiObject> result, Exception e) => {
if (e != null)
{
Debug.Log(e.ToString());
return;
}
else
{
if (result != null)
{
// foreach (KiiObject obj in result)
// {
// Uri id = obj.Uri;
// KiiObject appObj = KiiObject.CreateByUri(id);
//
// appObj.Refresh((KiiObject refreshedObj, Exception d) => {
// if (d != null)
// {
// Debug.Log(d.ToString());
// return;
// }
// string discount_amount = (string)refreshedObj ["Discount Amount"];
//
// Debug.Log("Code valid! Discount amount is : " + discount_amount);
// });
//
// }
Debug.Log("Coupon Code Valid");
}
else
{
Debug.Log("Invalid Coupon Code");
}
}
});