Пример #1
0
        public async Task <IActionResult> Confirm()
        {
            var transactionId = Int64.Parse(HttpContext.Request.Query["transactionId"]);
            var reserve       = CacheService.Cache[transactionId] as Reserve;

            var confirm = new Confirm()
            {
                Amount   = reserve.Amount,
                Currency = reserve.Currency
            };

            if ((bool)reserve.Capture)
            {
                var response = await client.ConfirmAsync(transactionId, confirm);

                return(new OkObjectResult(JsonConvert.SerializeObject(response)));
            }
            else
            {
                var authorizationRes = await client.GetAuthorizationAsync(transactionId, reserve.OrderId);

                var captureRes = await client.CaptureAsync(transactionId, reserve.Amount, reserve.Currency);

                return(new OkObjectResult(JsonConvert.SerializeObject(captureRes)));
            }
        }
        public async Task <IActionResult> Confirm(long transactionId, Guid orderId)
        {
            var confirmData = GetConfirmData();
            var nonce       = Guid.NewGuid().ToString();
            var confirmUrl  = $"/v3/payments/{transactionId}/confirm";
            var requestJson = JsonConverterFacade.SerializeObject(confirmData, _client.SerializerSettings);
            var signature   = _client.GetSignature((_config.ChannelSecret + confirmUrl + requestJson + nonce), _config.ChannelSecret);

            var result = await _client.ConfirmAsync(confirmData, nonce, signature, transactionId);

            // 若不是自動請款請呼叫 _client.CaptureAsync(),如果使用非自動請款,請聯繫 LINE PAY API 相關窗口申請

            return(Ok(result));
        }
Пример #3
0
        public async Task <IActionResult> Confirm()
        {
            // transactionId を取得して、キャッシュから決済予約を取得
            var transactionId = Int64.Parse(HttpContext.Request.Query["transactionId"]);
            var reserve       = CacheService.Cache[transactionId] as Reserve;

            // 決済確認の作成
            var confirm = new Confirm()
            {
                Amount   = reserve.Amount,
                Currency = reserve.Currency
            };

            var response = await client.ConfirmAsync(transactionId, confirm);

            return(new OkObjectResult("決済が完了しました。"));
        }
Пример #4
0
        public async Task <IActionResult> Confirm()
        {
            // transactionId を取得して、キャッシュから決済予約を取得
            var transactionId = Int64.Parse(HttpContext.Request.Query["transactionId"]);
            var reserve       = CacheService.Cache[transactionId] as Reserve;

            // 決済確認の作成
            var confirm = new Confirm()
            {
                Amount   = reserve.Amount,
                Currency = reserve.Currency
            };

            var response = await linePayClient.ConfirmAsync(transactionId, confirm);

            var app = new LineBotApp(lineMessagingClient, linePayClient, appsettings);
            await app.SendPayConfirm(reserve);

            return(new OkResult());
        }