public IActionResult FormCallback( [FromServices] IMedoroEcomService ecomService, [FromForm] MedoroFormCallbackData obj) { return(Ok(new { Result = "Success!", Data = ecomService.AuthorizeFormPayment(obj.Data, obj.Key) })); }
public async Task <IActionResult> Callback( [FromServices] IMemoryCache memoryCache, [FromServices] IMedoroEcomService ecomService, [FromForm] string md, [FromForm] string paRes) { var paymentId = memoryCache.Get <string>(md); return(Ok(new { Result = "Success payment!", Data = await ecomService.AuthorizeSoapPayment(paymentId, paRes) })); }
public async Task Payment( [FromServices] IMedoroEcomService ecomService, [FromServices] IMemoryCache memoryCache) { var orderId = Guid.NewGuid().ToString(); var paymentResponse = await ecomService.PaymentMode6( true, "test", orderId, 100, "EUR", "Test order", "Ivan Ivanov", "Lenina 1", "Tomsk", "RU", "123456", "+79123456789", "*****@*****.**", "Notification test", CardFactory.ChallengeFlow() ); var hash = Convert.ToBase64String( MD5.Create() .ComputeHash( Encoding.UTF8.GetBytes(orderId + "secret"))); memoryCache.Set(hash, paymentResponse.Payment.ID); var threeDsDataCollection = new NameValueCollection(); threeDsDataCollection.Add("PaReq", paymentResponse.D3D.ACS.PaReq); threeDsDataCollection.Add("TermUrl", Request.Scheme + "://" + Request.Host + "/callback"); threeDsDataCollection.Add("MD", hash); await Response.RedirectWithData(threeDsDataCollection, paymentResponse.D3D.ACS.URL); }
public async Task Mode5( [FromServices] IMedoroEcomService ecomService) { var orderId = Guid.NewGuid().ToString(); var paymentResponse = await ecomService.PaymentMode5( true, "test", orderId, 100, "EUR", "Test order", "Ivan Ivanov", "Lenina 1", "Tomsk", "RU", "123456", "+79123456789", "*****@*****.**", "Notification test" ); var threeDsDataCollection = new NameValueCollection { { "KEY", paymentResponse.Key }, { "KEY_INDEX", paymentResponse.KeyIndex }, { "DATA", paymentResponse.Data }, { "INTERFACE", paymentResponse.Interface }, { "SIGNATURE", paymentResponse.Signature }, { "CALLBACK", $"{Request.Scheme}://{Request.Host}{Url.Action("FormCallback")}" }, { "ERROR_CALLBACK", $"{Request.Scheme}://{Request.Host}{Url.Action("ErrorFormCallback")}" } }; await Response.RedirectWithData(threeDsDataCollection, "https://demo.ipsp.lv/form/v2/"); }