Example #1
0
        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;
            }
        }
Example #2
0
        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));
        }
Example #3
0
        public IHttpActionResult Getpayout(int id)
        {
            payout payout = db.payouts.Find(id);

            if (payout == null)
            {
                return(NotFound());
            }

            return(Ok(payout));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }