Esempio n. 1
0
        public ActionResult Checkout(int orderId)
        {
            // halkbank provided credentials
            string storeKey  = "halkbank provided key";
            string clientId  = "halkbank provided client id";
            string portalUrl = "https://halkbank.provided.portal.com/";

            var settings = new HalkbankSettings(clientId, storeKey, portalUrl);
            var request  = new HalkbankPaymentRequest(settings);

            request.Amount      = 100;
            request.Oid         = orderId.ToString();
            request.OkUrl       = $"https://localhost:44357/Order/Success?orderId={request.Oid}";
            request.FailUrl     = $"https://localhost:44357/Order/Fail?orderId={request.Oid}";
            request.CallbackUrl = $"https://localhost:44357/Order/Callback?orderId={request.Oid}";

            return(View(request));
        }
Esempio n. 2
0
        public ActionResult Callback(int orderId)
        {
            // halkbank provided credentials
            string storeKey  = "halkbank provided key";
            string clientId  = "halkbank provided client id";
            string portalUrl = "https://halkbank.provided.portal.com/";

            var body = new StreamReader(Request.Body).ReadToEnd();

            var settings = new HalkbankSettings(clientId, storeKey, portalUrl);
            var response = new HalkbankPaymentResponse(settings, body);

            if (response.Success)
            {
                OrderService.MarkOrderAsPaid(orderId);
            }

            return(Content(response.Response));
        }