Skip to content

Instantly share code, notes, and snippets.

@c0rp-aubakirov
Created March 15, 2017 06:02
Show Gist options
  • Save c0rp-aubakirov/a0f9452225aedb2d1c876183b335ce42 to your computer and use it in GitHub Desktop.
Save c0rp-aubakirov/a0f9452225aedb2d1c876183b335ce42 to your computer and use it in GitHub Desktop.
<%@ page contentType="text/html; charset=UTF-8" %>
<html>
<head>
<!-- Bootstrap core CSS -->
<%--<link href="css/bootstrap.min.css" rel="stylesheet">--%>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Material Design fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Bootstrap Material Design -->
<%--<link href="css/bootstrap-material-design.min.css" rel="stylesheet">--%>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.5.7/css/bootstrap-material-design.min.css" rel="stylesheet">
<%--<link href="css/ripples.min.css" rel="stylesheet">--%>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.5.7/css/ripples.min.css" rel="stylesheet">
</head>
<body>
<div class="container col-xs-12 col-md-6 col-md-offset-3" style="background-color: #EEEEEE">
<form class="form-horizontal" accept-charset="UTF-8" id="form"
action="${pageContext.request.contextPath}/sendPayment"
method="post">
<div class="form-group col-xs-10 col-md-10" id="shopName">
<label for="shopNameInput" class="control-label"></label>
<input type="text" class="form-control"
spellcheck="false"
value='' required="true"
id="shopNameInput" name="shopName" placeholder="Название магазина">
</div>
<div class="form-group col-xs-10 col-md-10" id="invoiceNumber">
<label for="invoiceNumberInput" class="control-label"></label>
<input type="text" class="form-control"
autocomplete="off" spellcheck="false"
value='' required="true"
id="invoiceNumberInput" name="invoiceNumber" placeholder="Номер заказа/инвойса">
</div>
<div class="form-group col-xs-10 col-md-10" id="amount">
<label for="amountInput" class="control-label"></label>
<input type="number" class="form-control"
autocomplete="off" spellcheck="false"
value="" required="true"
id="amountInput" name="amount" placeholder="Сумма в тенге">
</div>
<div class="form-group col-xs-10 col-md-10" id="terminalId">
<label for="terminalIdInput" class="control-label"></label>
<input type="text" class="form-control"
spellcheck="false"
value="" required="true"
id="terminalIdInput" name="terminalId" placeholder="Введите ID терминала">
</div>
<div class="form-group col-xs-10 col-md-10">
<label class="control-label" for="pemInput"></label>
<textarea class="form-control" name="pemInput" id="pemInputId" placeholder="Приватный ключ(для подписи запроса)"></textarea>
</div>
<div class="form-group col-xs-10 col-md-10">
<label class="control-label" for="pemInputResponse"></label>
<textarea class="form-control" name="pemInputResponse" id="pemInputResponseId" placeholder="Публичный ключ(для проверки подписи ответа)"></textarea>
</div>
<%--This fields only for test purposes--%>
<div class="form-group col-xs-12 col-md-12" id="testFields">
<label for="terminalIdInput" class="control-label"></label>
<input type="number" class="form-control"
spellcheck="false"
value="" required="true"
min="600" max="86400"
id="transactionTimeOutInSeconds" name="transactionTimeOutInSeconds" placeholder="Таймаут">
<p class="help-block">Введите таймаут транзакции</p>
<div class="">
<label>
<input type="checkbox" value="false" id="deleteRequiredFields" name="deleteRequiredFields">
Удалить обязательные поля
</label>
</div>
</div>
<input type="hidden" class="form-control" id="webshopRequest" name="webshopRequest">
<div class="form-group col-xs-10 col-md-10">
<div class="col-xs-5">
<button type="submit" id="bs" class="btn btn-raised btn-info" onclick='getSignedXML()'>
Оплатить
</button>
</div>
<div class="col-xs-5">
<a href="${pageContext.request.contextPath}/transactions.jsp" class="btn btn-raised btn-default">
Просмотр транзакций
</a>
</div>
</div>
</form>
</div>
<div class="container">
<h1 >Для тестирования:</h1>
<p>Нужно сгенерировать ключи мерчанту интернет магазина. (У мерчанта должен быть активный терминал)</p>
<ol>
<li>Авторизовать как мерчант.</li>
<li>Пройти по <strong>Настройки</strong> -&gt;<strong>Управление сертификатами</strong></li>
<li>Нажать <strong>Сгенерировать пару и скачать приватный ключ</strong></li>
<li>Вставить содержимое файлов в форму (<strong>Приватный</strong> и <strong>Публичный ключ</strong>)</li>
</ol>
</div>
<%--<script src="js/jquery-1.11.3.min.js"></script>--%>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery.min.js"><\/script>')</script>
<%--<script src="js/bootstrap.min.js"></script>--%>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
crossorigin="anonymous"></script>
<script>
function getSignedXML() {
var invoice = document.getElementById("invoiceNumberInput").value;
var amount = document.getElementById("amountInput").value;
var shopName = document.getElementById("shopNameInput").value;
var terminalId = document.getElementById("terminalIdInput").value;
var deleteRequiredFields = document.getElementById("deleteRequiredFields").value;
var transactionTimeOutInSeconds = document.getElementById("transactionTimeOutInSeconds").value;
var pemInput = document.getElementById("pemInputId").value;
var pemInputResponse = document.getElementById("pemInputResponseId").value;
$.ajax({
type: "GET",
async: false,
url: "${pageContext.request.contextPath}/webresources/test/getSignedXML?invoiceNumber=" + invoice + "&amount=" + amount + "&shopName=" + shopName + "&terminalId=" + terminalId + "&deleteRequiredFields="+deleteRequiredFields+"&transactionTimeOutInSeconds="+transactionTimeOutInSeconds + "&pemInput=" + encodeURIComponent(pemInput) + "&pemInputResponse=" + encodeURIComponent(pemInputResponse)
}).done(function (data) {
document.getElementById('webshopRequest').value = data.webshopRequest;
});
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment