/// <summary> /// This Async service For Reversing a Hold process. /// </summary> /// <exception cref="GameballException">Thrown if the request fails..</exception> public async Task <TransactionResponse> ReverseHoldAsync(ReverseHoldRequest hold) { hold.Validate(); hold.TransactionTime = DateTime.UtcNow; string hash = GameballUtils.GetSHA1(hold.PlayerUniqueId, TransactionKey, GameballUtils.ToUtcTime(hold.TransactionTime), GameballUtils.ToValidAmount(hold.Amount)); hold.Hash = hash; var response = await this.Client.PostAsync(ApiBase + GameballConstants.Hold, new StringContent(hold.Serialize(), Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { throw (BuildGameballException(response)); } else { return(JsonConvert.DeserializeObject <TransactionResponse>(await response.Content.ReadAsStringAsync())); } }
/// <summary> /// This service is used by Clients to send Purchase Rewards (could have a discount) /// and Events to Gameball based on Events triggered by the Players Actions on the Client's Interface. /// </summary> /// <exception cref="GameballException">Thrown if the request fails..</exception> public ActionResponse SendAction(ActionRequest action) { action.Validate(); action.PointsTransaction.TransactionTime = DateTime.UtcNow; string hash = GameballUtils.GetSHA1(action.PlayerUniqueId, TransactionKey, GameballUtils.ToUtcTime(action.PointsTransaction.TransactionTime), GameballUtils.ToValidAmount(action.PointsTransaction.RewardAmount)); action.PointsTransaction.Hash = hash; var response = this.Client.PostAsync(ApiBase + GameballConstants.Action, new StringContent(action.Serialize(), Encoding.UTF8, "application/json")).Result; if (!response.IsSuccessStatusCode) { throw (BuildGameballException(response)); } else { return(JsonConvert.DeserializeObject <ActionResponse>(response.Content.ReadAsStringAsync().Result)); } }
/// <summary> /// This service For Redeem Points Based on the Amount send and the Client Transaction Config. /// </summary> /// <exception cref="GameballException">Thrown if the request fails..</exception> public TransactionResponse RedeemPoints(RedeemPointsRequest redeem) { redeem.Validate(); redeem.TransactionTime = DateTime.UtcNow; string hash = GameballUtils.GetSHA1(redeem.PlayerUniqueId, TransactionKey, GameballUtils.ToUtcTime(redeem.TransactionTime)); redeem.Hash = hash; var response = this.Client.PostAsync(ApiBase + GameballConstants.Redeem, new StringContent(redeem.Serialize(), Encoding.UTF8, "application/json")).Result; if (!response.IsSuccessStatusCode) { throw (BuildGameballException(response)); } else { return(JsonConvert.DeserializeObject <TransactionResponse>(response.Content.ReadAsStringAsync().Result)); } }