feat: paygw_moneta 1.0.0, MONETA.Assistant payment gateway for Moodle
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template paygw_moneta/payment_form
|
||||
|
||||
Карточка перехода на платёжную страницу MONETA.Assistant: логотип со
|
||||
ссылкой на moneta.ru, что оплачивается, сумма, кнопка и пояснение. Сама не
|
||||
уходит — покупатель нажимает «Оплатить»; после нажатия кнопка блокируется,
|
||||
чтобы повторный клик не отправил форму дважды. Название может быть длинным:
|
||||
переносится, не растягивая карточку.
|
||||
|
||||
Context variables required for this template:
|
||||
* action - адрес платёжной формы
|
||||
* cost - сумма с валютой для показа
|
||||
* description - описание заказа
|
||||
* iscourse - оплачивается запись на курс (enrol_fee)
|
||||
* logourl - адрес логотипа
|
||||
* fields - подписанные поля формы: name, value
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"action": "https://demo.moneta.ru/assistant.htm",
|
||||
"cost": "120,25 ₽",
|
||||
"description": "Монета",
|
||||
"iscourse": true,
|
||||
"logourl": "https://example.test/theme/image.php/boost/paygw_moneta/1/img",
|
||||
"fields": [{"name": "MNT_ID", "value": "54600817"}]
|
||||
}
|
||||
}}
|
||||
<div class="paygw-moneta-checkout card mx-auto">
|
||||
<div class="card-body p-4">
|
||||
<a class="paygw-moneta-checkout-brand" href="https://moneta.ru/" target="_blank" rel="noopener noreferrer">
|
||||
<img class="paygw-moneta-checkout-logo" src="{{logourl}}" alt="{{#str}}pluginname, paygw_moneta{{/str}}">
|
||||
<span class="sr-only visually-hidden">{{#str}}opensinnewwindow{{/str}}</span>
|
||||
</a>
|
||||
<div class="paygw-moneta-checkout-label">
|
||||
{{#iscourse}}{{#str}}checkout:course, paygw_moneta{{/str}}{{/iscourse}}
|
||||
{{^iscourse}}{{#str}}checkout:item, paygw_moneta{{/str}}{{/iscourse}}
|
||||
</div>
|
||||
<h3 class="paygw-moneta-checkout-title">{{description}}</h3>
|
||||
<div class="paygw-moneta-checkout-total">
|
||||
<span class="text-muted">{{#str}}checkout:total, paygw_moneta{{/str}}</span>
|
||||
<strong class="paygw-moneta-checkout-cost">{{cost}}</strong>
|
||||
</div>
|
||||
<form method="post" action="{{action}}" id="paygw-moneta-form-{{uniqid}}">
|
||||
{{#fields}}
|
||||
<input type="hidden" name="{{name}}" value="{{value}}">
|
||||
{{/fields}}
|
||||
<button type="submit" class="btn btn-primary btn-lg w-100 paygw-moneta-checkout-button">{{#str}}pay, paygw_moneta, {{cost}}{{/str}}</button>
|
||||
</form>
|
||||
<div class="paygw-moneta-checkout-note text-muted small">
|
||||
{{#pix}}i/lock, core{{/pix}}
|
||||
<div>
|
||||
<div>{{#str}}checkout:secure, paygw_moneta{{/str}}</div>
|
||||
{{#iscourse}}<div class="mt-1">{{#str}}checkout:access, paygw_moneta{{/str}}</div>{{/iscourse}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#js}}
|
||||
(function() {
|
||||
var form = document.getElementById('paygw-moneta-form-{{uniqid}}');
|
||||
form.addEventListener('submit', function() {
|
||||
var button = form.querySelector('button[type="submit"]');
|
||||
button.disabled = true;
|
||||
button.textContent = {{#quote}}{{#str}}redirecting, paygw_moneta{{/str}}{{/quote}};
|
||||
});
|
||||
})();
|
||||
{{/js}}
|
||||
Reference in New Issue
Block a user