sends a first PayPal Api call
This commit is contained in:
@ -17,6 +17,7 @@ namespace Yavsc.ApiControllers
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.Helpers;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
|
||||
[Route("api/haircut")]
|
||||
public class HairCutController : Controller
|
||||
@ -87,8 +88,10 @@ namespace Yavsc.ApiControllers
|
||||
{
|
||||
var apiContext = _paymentSettings.CreateAPIContext();
|
||||
var query = await _context.HairCutQueries.Include(q=>q.Client).
|
||||
Include(q=>q.Client.PostalAddress).SingleAsync(q=>q.Id == id);
|
||||
var payment = apiContext.CreatePaiment(query,"sale",_logger);
|
||||
Include(q=>q.Client.PostalAddress).Include(q=>q.Prestation)
|
||||
.SingleAsync(q=>q.Id == id);
|
||||
query.SelectedProfile = _context.BrusherProfile.Single(p=>p.UserId == query.PerformerId);
|
||||
var payment = apiContext.CreatePayment(query,"authorize",_logger);
|
||||
return Json(payment);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -6,6 +7,7 @@ using Microsoft.Extensions.OptionsModel;
|
||||
using PayPal.Api;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.ViewModels.PayPal;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
@ -59,8 +61,13 @@ namespace Yavsc.ApiControllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("create"),AllowAnonymous]
|
||||
public async Task<IActionResult> Create()
|
||||
{
|
||||
var apiContext = paymentSettings.CreateAPIContext();
|
||||
Payment result=apiContext.CreatePayment(new Estimate());
|
||||
return Ok(Payment.Create(apiContext,result));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user