private void VailidateFee(Fee fee) { if (fee == null) throw new ArgumentNullException("fee"); if (!_possibleTos.Contains(fee.To)) { throw new ValidationException( "To should have value of \"buyer\", \"seller\", \"cc\", \"int_wire\", \"paypal_payout\""); } }
public Fee CreateFee(Fee fee) { VailidateFee(fee); var client = GetRestClient(); var request = new RestRequest("/fees", Method.POST); request.AddParameter("name", fee.Name); request.AddParameter("fee_type_id", (int)fee.FeeType); request.AddParameter("amount", fee.Amount); request.AddParameter("cap", fee.Cap); request.AddParameter("min", fee.Min); request.AddParameter("max", fee.Max); request.AddParameter("to", fee.To); var response = SendRequest(client, request); return JsonConvert.DeserializeObject<IDictionary<string, Fee>>(response.Content).Values.First(); }