private payoutBatch createPayouts(payout payout, PayPalOAuthToken authToken, Guid logID) { Log(MessageType.Info, "createPayouts()", "Create payouts", relatedMessageID: logID); try { var request = new WebClient.RequestParams(this) { Method = HTTPRequestMethod.POST, ContentType = ContentType.JSON, Headers = new Dictionary <string, string> { { HDR_AUTHORIZATION, authToken.AuthorizationHeader } }, QueryParameters = new Dictionary <string, string> { { PRM_SYNC_MODE, m_SyncMode.AsString() } }, Body = payout.ToJSONDataMap().ToJSON(JSONWritingOptions.Compact) }; var response = WebClient.GetJson(URI_CreatePayouts(), request); Log(MessageType.Trace, "createPayouts()", "Payouts", relatedMessageID: logID, parameters: response.ToJSON()); Log(MessageType.Info, "createPayouts()", "Payouts created", relatedMessageID: logID); return(new payoutBatch(response)); } catch (Exception ex) { var error = composeError(StringConsts.PAYPAL_PAYOUTS_CREATE_ERROR_MESSAGE.Args(ex.ToMessageWithType()), ex); Log(MessageType.Error, "createPayouts()", error.Message, relatedMessageID: logID); throw error; } }
public IHttpActionResult Putpayout(int id, payout payout) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != payout.sn) { return(BadRequest()); } db.Entry(payout).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!payoutExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getpayout(int id) { payout payout = db.payouts.Find(id); if (payout == null) { return(NotFound()); } return(Ok(payout)); }
public IHttpActionResult Postpayout(payout payout) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.payouts.Add(payout); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = payout.sn }, payout)); }
public IHttpActionResult Deletepayout(int id) { payout payout = db.payouts.Find(id); if (payout == null) { return(NotFound()); } db.payouts.Remove(payout); db.SaveChanges(); return(Ok(payout)); }