コード例 #1
0
        /// <summary>
        /// GET Fetch Settlements
        /// Settlements made to your bank accounts and the bank accounts for your subaccounts
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public async Task <SettlementResponseModel> FetchSettlement(SettlementRequestModel requestModel)
        {
            var url        = GetUrl("?");
            var properties = from p in requestModel.GetType().GetProperties()
                             where p.GetValue(requestModel, null) != null
                             select p.Name + "=" + HttpUtility.UrlEncode(p.GetValue(requestModel, null).ToString());
            string queryString = url + String.Join("&", properties.ToArray());
            var    getResult   = await BaseClient.GetEntities(queryString, this._secretKey);

            return(JsonConvert.DeserializeObject <SettlementResponseModel>(getResult));
        }
        public async Task CreateAsync([FromBody] SettlementRequestModel model, string userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ValidationApiException(HttpStatusCode.BadRequest, "User id required");
            }

            try
            {
                await _settlementService.CreateAsync(model.IndexName, model.Amount, model.Comment, model.WalletId,
                                                     model.ClientId, userId, model.IsDirect);
            }
            catch (InvalidOperationException exception)
            {
                throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message);
            }
        }