Skip to content

Commit

Permalink
Merge pull request #42 from Snickser/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Snickser authored Jul 21, 2024
2 parents c1ee092 + 218bae2 commit d48eb29
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ https://cryptocloud.plus/

[![Build Status](https://github.com/Snickser/moodle-paygw_cryptocloud/actions/workflows/moodle-ci.yml/badge.svg)](https://github.com/Snickser/moodle-paygw_cryptocloud/actions/workflows/moodle-ci.yml)

## Recommendations

+ Moodle 4.3+
+ To enroll in the course, use my patched plugin "Enrollment for payment" [enrol_fee](https://github.com/Snickser/moodle-enrol_fee/tree/dev).
+ For the control task, use the plugin I patched at the link [mod_gwpayments](https://github.com/Snickser/moodle-mod_gwpayments/tree/dev).
+ To limit availability, use the plugin I patched at the link [availability_gwpayments](https://github.com/Snickser/moodle-availability_gwpayments/tree/dev).
+ Plugin for viewing reports [report_payments](https://github.com/Snickser/moodle-report_payments/tree/dev).

## INSTALLATION

Download the latest **paygw_cryptocloud.zip** and unzip the contents into the **/payment/gateway** directory. Or upload it from Moodle plugins adminnistration interface.
Expand Down
6 changes: 6 additions & 0 deletions classes/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static function notify($userid, $fee, $currency, $orderid, $type = '') {
'orderid' => $orderid,
'fullname' => fullname($user),
'firstname' => $user->firstname,
'localizedcost' => \core_payment\helper::get_cost_as_string($fee, $currency),
];

$message = new \core\message\message();
Expand All @@ -73,6 +74,11 @@ public static function notify($userid, $fee, $currency, $orderid, $type = '') {
case 'Success completed':
$messagebody = get_string('message_success_completed', 'paygw_cryptocloud', $a);
break;
case 'Invoice created':
$messagebody = get_string('message_invoice_created', 'paygw_cryptocloud', $a);
break;
default:
$messagebody = 'null';
}

$message->fullmessage = $messagebody;
Expand Down
4 changes: 4 additions & 0 deletions lang/en/paygw_cryptocloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@
$string['fixcost'] = 'Fixed price mode';
$string['fixcost_help'] = 'Disables the ability for students to pay with an arbitrary amount.';
$string['maxcosterror'] = 'The maximum price must be higher than the recommended price';

$string['message_invoice_created'] = 'Hello {$a->firstname}!
Your payment link {$a->orderid} to {$a->fee} {$a->currency} has been successfully created.
You can pay it within an hour.';
4 changes: 4 additions & 0 deletions lang/ru/paygw_cryptocloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@
$string['fixcost'] = 'Режим фиксированной цены';
$string['fixcost_help'] = 'Отключает для студентов возможность оплаты произвольной суммой.';
$string['maxcosterror'] = 'Максимальная цена должна быть выше рекомендуемой цены';

$string['message_invoice_created'] = 'Здравствуйте, {$a->firstname}!
Платёжная ссылка {$a->orderid} на {$a->localizedcost} успешно создана.
Вы можете совершить платёж по ней в течении часа.';
14 changes: 13 additions & 1 deletion pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/


use core_payment\helper;
use paygw_cryptocloud\notifications;

require_once(__DIR__ . '/../../../config.php');
global $CFG, $USER, $DB;
Expand Down Expand Up @@ -196,6 +196,18 @@
throw new Error(get_string('payment_error', 'paygw_cryptocloud') . " ($error)");
}

// Set the context of the page.
$PAGE->set_context(context_system::instance());

// Notify user.
notifications::notify(
$userid,
$cost,
$currency,
$response->result->link,
'Invoice created'
);

// Write to DB.
$paygwdata->paymentid = $paymentid;
$paygwdata->invoiceid = $response->result->uuid;
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024072100;
$plugin->version = 2024072101;
$plugin->requires = 2023100900;
$plugin->component = 'paygw_cryptocloud';
$plugin->release = '0.12';
Expand Down

0 comments on commit d48eb29

Please sign in to comment.