-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from MythicalLTD/216-add-funds-page-with-plug…
…in-support Add stripe & paypal gateway!
- Loading branch information
Showing
42 changed files
with
1,717 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Build Frontend", | ||
"type": "node-terminal", | ||
"command": "php mythicalclient frontend:build", | ||
"request": "launch" | ||
|
||
}, | ||
{ | ||
"name": "Watch Backend", | ||
"type": "node-terminal", | ||
"command": "php mythicalclient backend:watch", | ||
"request": "launch" | ||
}, | ||
{ | ||
"name": "Lint Backend", | ||
"type": "node-terminal", | ||
"command": "php mythicalclient backend:lint", | ||
"request": "launch" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of MythicalClient. | ||
* Please view the LICENSE file that was distributed with this source code. | ||
* | ||
* # MythicalSystems License v2.0 | ||
* | ||
* ## Copyright (c) 2021–2025 MythicalSystems and Cassian Gherman | ||
* | ||
* Breaking any of the following rules will result in a permanent ban from the MythicalSystems community and all of its services. | ||
*/ | ||
|
||
use MythicalClient\App; | ||
use MythicalClient\Chat\User\Session; | ||
|
||
$router->add('/api/user/addfunds', function () { | ||
global $pluginManager; | ||
App::init(); | ||
$appInstance = App::getInstance(true); | ||
$appInstance->allowOnlyPOST(); | ||
$session = new Session($appInstance); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of MythicalClient. | ||
* Please view the LICENSE file that was distributed with this source code. | ||
* | ||
* # MythicalSystems License v2.0 | ||
* | ||
* ## Copyright (c) 2021–2025 MythicalSystems and Cassian Gherman | ||
* | ||
* Breaking any of the following rules will result in a permanent ban from the MythicalSystems community and all of its services. | ||
*/ | ||
|
||
use MythicalClient\App; | ||
use MythicalClient\Chat\User\Session; | ||
use MythicalClient\Chat\columns\UserColumns; | ||
|
||
/* | ||
* This file is part of MythicalClient. | ||
* Please view the LICENSE file that was distributed with this source code. | ||
* | ||
* # MythicalSystems License v2.0 | ||
* | ||
* ## Copyright (c) 2021–2025 MythicalSystems and Cassian Gherman | ||
* | ||
* Breaking any of the following rules will result in a permanent ban from the MythicalSystems community and all of its services. | ||
*/ | ||
|
||
// Route handlers | ||
$router->post('/api/webhooks/paypal', function () { | ||
$paypal = new MythicalClient\Gateways\PayPal(); | ||
$paypal->handleIPN(); | ||
}); | ||
|
||
$router->get('/api/paypal/process', function () { | ||
App::init(); | ||
$app = App::getInstance(true); | ||
$session = new Session($app); | ||
|
||
try { | ||
if (!isset($_GET['coins']) || empty($_GET['coins'])) { | ||
throw new InvalidArgumentException('Missing coins parameter'); | ||
} | ||
|
||
$paypal = new MythicalClient\Gateways\PayPal(); | ||
$redirectUrl = $paypal->createPayment( | ||
(float) $_GET['coins'], | ||
$session->getInfo(UserColumns::UUID, false) | ||
); | ||
|
||
header("Location: $redirectUrl"); | ||
exit; | ||
} catch (Throwable $e) { | ||
$app->getLogger()->error('PayPal process error: ' . $e->getMessage()); | ||
header('Location: /?error=payment_failed&message=' . $e->getMessage()); | ||
exit; | ||
} | ||
}); | ||
|
||
$router->add('/api/paypal/finish', function () { | ||
App::init(); | ||
$app = App::getInstance(true); | ||
|
||
header('Location: /dashboard'); | ||
exit; | ||
}); |
Oops, something went wrong.