public async Task <IActionResult> Simulate([FromBody] SimulateBody body) { Console.WriteLine("simulate body=" + JsonConvert.SerializeObject(body)); var service = new StripeLightrailSplitTenderService(_lightrail); var summary = await service.Simulate(new StripeLightrailSplitTenderSimulateOptions { UserSuppliedId = Guid.NewGuid().ToString(), Nsf = false, ShopperId = body.ShopperId, Currency = body.Currency, Amount = body.Amount, LightrailShare = body.Amount }); return(Json(summary.LightrailTransaction)); }
public async Task <IActionResult> Charge([FromForm] ChargeBody body) { Console.WriteLine("charge body=" + JsonConvert.SerializeObject(body)); var service = new StripeLightrailSplitTenderService(_lightrail); var summary = await service.Create(new StripeLightrailSplitTenderCreateOptions { Amount = body.Amount, Currency = body.Currency, Source = body.Source, ShopperId = body.ShopperId, UserSuppliedId = Guid.NewGuid().ToString(), LightrailShare = body.LightrailAmount }); var viewPath = Path.Combine(Directory.GetCurrentDirectory(), "..", "shared", "views", $"checkoutComplete.html"); var viewData = new { lightrailTransactionValue = String.Format("{0:F2}", summary.LightrailAmount / -100.0), stripeChargeValue = String.Format("{0:F2}", summary.StripeAmount / 100.0) }; return(Content(Render.FileToString(viewPath, viewData), "text/html")); }