mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Replace geary with Gearer
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Blacklight\libraries\Geary;
|
||||
use Gearer;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
@@ -17,8 +17,6 @@ class BtcPaymentController extends BasePageController
|
||||
public function show(Request $request)
|
||||
{
|
||||
$this->setPreferences();
|
||||
$gateway_id = config('settings.mycelium_gateway_id');
|
||||
$gateway_secret = config('settings.mycelium_gateway_secret');
|
||||
|
||||
$action = $request->input('action') ?? 'view';
|
||||
$donation = Role::query()->where('donation', '>', 0)->get(['id', 'name', 'donation', 'addyears']);
|
||||
@@ -34,8 +32,7 @@ class BtcPaymentController extends BasePageController
|
||||
$keychain_id = random_int(0, 19);
|
||||
$callback_data = json_encode($data);
|
||||
|
||||
$geary = new Geary($gateway_id, $gateway_secret);
|
||||
$order = $geary->create_order($price, $keychain_id, $callback_data);
|
||||
$order = Gearer::createOrder($price, $keychain_id, $callback_data);
|
||||
|
||||
if ($order->payment_id) {
|
||||
// Redirect to a payment gateway
|
||||
@@ -65,22 +62,17 @@ class BtcPaymentController extends BasePageController
|
||||
*/
|
||||
public function callback(): void
|
||||
{
|
||||
$gateway_id = config('settings.mycelium_gateway_id');
|
||||
$gateway_secret = config('settings.mycelium_gateway_secret');
|
||||
|
||||
$geary = new Geary($gateway_id, $gateway_secret);
|
||||
$order = $geary->check_order_callback();
|
||||
$order = Gearer::handleOrderStatusCallback();
|
||||
|
||||
// Order status was received
|
||||
if ($order !== false) {
|
||||
$callback_data = json_decode($order['callback_data'], true);
|
||||
$newRole = $callback_data['role'];
|
||||
$amount = $callback_data['price'];
|
||||
$addYear = $callback_data['addyears'];
|
||||
$newRole = $order['role'];
|
||||
$amount = $order['price'];
|
||||
$addYear = $order['addyears'];
|
||||
// If order was paid in full (2) or overpaid (4)
|
||||
if ((int) $order['status'] === 2 || (int) $order['status'] === 4) {
|
||||
User::updateUserRole($callback_data['user_id'], $newRole);
|
||||
User::updateUserRoleChangeDate($callback_data['user_id'], null, $addYear);
|
||||
User::updateUserRole($order['user_id'], $newRole);
|
||||
User::updateUserRoleChangeDate($order['user_id'], null, $addYear);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -73,10 +73,10 @@
|
||||
"kevinlebrun/colors.php": "^1.0",
|
||||
"laravel/framework": "^10.32",
|
||||
"laravel/horizon": "^5.21",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/scout": "^9.0",
|
||||
"laravel/telescope": "^4.17",
|
||||
"laravel/tinker": "^2.8",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/ui": "^4.2",
|
||||
"laravelcollective/html": "^6.4",
|
||||
"league/climate": "^3.8",
|
||||
@@ -97,6 +97,7 @@
|
||||
"predis/predis": "^2.2",
|
||||
"propaganistas/laravel-disposable-email": "^2.2",
|
||||
"ramsey/uuid": "^4.7",
|
||||
"revlenuwe/gearer": "dev-master",
|
||||
"sentry/sentry-laravel": "^3.8",
|
||||
"smarty/smarty": "^4.3",
|
||||
"spatie/async": "^1.6",
|
||||
@@ -151,6 +152,10 @@
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/DariusIII/TVMaze-PHP-API-Wrapper"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/DariusIII/gearer"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
|
||||
Generated
+73
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "052a4f3b0a85f3bd0072ae5bb6c783ee",
|
||||
"content-hash": "5efdefb2acf7a503343441b59b7c1bc6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aharen/omdbapi",
|
||||
@@ -8878,6 +8878,78 @@
|
||||
],
|
||||
"time": "2023-11-16T16:16:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "revlenuwe/gearer",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DariusIII/gearer.git",
|
||||
"reference": "3b2b20ed89529900950ed8486a026ff79811a6ba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/DariusIII/gearer/zipball/3b2b20ed89529900950ed8486a026ff79811a6ba",
|
||||
"reference": "3b2b20ed89529900950ed8486a026ff79811a6ba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"illuminate/support": "^10.0",
|
||||
"php": "^8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^8.0",
|
||||
"phpunit/phpunit": "^9.3"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Revlenuwe\\Gearer\\GearerServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Gearer": "Revlenuwe\\Gearer\\Facades\\Gearer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Revlenuwe\\Gearer\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Revlenuwe\\Gearer\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"vendor/bin/phpunit"
|
||||
],
|
||||
"test-coverage": [
|
||||
"vendor/bin/phpunit --coverage-html coverage"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "MyceliumGear gateway payment processing",
|
||||
"keywords": [
|
||||
"bitcoin",
|
||||
"gear",
|
||||
"gearer",
|
||||
"laravel",
|
||||
"laravel gateway",
|
||||
"laravel payment",
|
||||
"mycelium",
|
||||
"revlenuwe"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/DariusIII/gearer/tree/master"
|
||||
},
|
||||
"time": "2023-11-25T15:00:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "seld/cli-prompt",
|
||||
"version": "1.0.4",
|
||||
|
||||
Reference in New Issue
Block a user