diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index 4a87d9da3655..70b1a69105f3 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -12,7 +12,6 @@ namespace App\Console\Commands; use App\Jobs\Util\VersionCheck; -use Composer\Console\Application; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; diff --git a/app/Http/Controllers/PaymentWebhookController.php b/app/Http/Controllers/PaymentWebhookController.php index 246a65b48a89..c4c67b9fc12c 100644 --- a/app/Http/Controllers/PaymentWebhookController.php +++ b/app/Http/Controllers/PaymentWebhookController.php @@ -13,7 +13,6 @@ namespace App\Http\Controllers; use App\Http\Requests\Payments\PaymentWebhookRequest; -use Illuminate\Support\Arr; class PaymentWebhookController extends Controller { @@ -25,9 +24,10 @@ class PaymentWebhookController extends Controller public function __invoke(PaymentWebhookRequest $request, string $company_gateway_id, string $company_key) { $payment = $request->getPayment(); + $client = is_null($payment) ? $request->getClient() : $payment->client; return $request->getCompanyGateway() - ->driver($payment->client) + ->driver($client) ->processWebhookRequest($request, $payment); } } diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index f1285a538c77..bb38bcdb3522 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -75,10 +75,8 @@ class SelfUpdateController extends BaseController } info('Are there any changes to pull? '.$repo->hasChanges()); - dispatch(function (){ - + dispatch(function () { Artisan::call('ninja:post-update'); - }); return response()->json(['message' => ''], 200); diff --git a/app/Http/Requests/Payments/PaymentWebhookRequest.php b/app/Http/Requests/Payments/PaymentWebhookRequest.php index 11bb514bbc76..445e2d08bb18 100644 --- a/app/Http/Requests/Payments/PaymentWebhookRequest.php +++ b/app/Http/Requests/Payments/PaymentWebhookRequest.php @@ -77,23 +77,6 @@ class PaymentWebhookRequest extends Request return $this->getPaymentHash()->payment; } - /** - * Some gateways, like Stripe, send us transcation reference via webhook, - * so we can resolve payment from there. - */ - if ($this->has('data') && $this->has('type')) { - $src = $this->data['object']['id']; - - info('Using src: ' . $src); - - $payment = \App\Models\Payment::where('transaction_reference', $src)->first(); - - info('payment fetched!'); - info($payment); - } - - info('before abort, 97'); - abort(404); } diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 4d91c65ee6e7..3ca5f80e4a2f 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -17,8 +17,6 @@ use App\Http\Requests\Payments\PaymentWebhookRequest; use App\Http\Requests\Request; use App\Jobs\Util\SystemLogger; use App\Models\ClientGatewayToken; -use App\Models\Company; -use App\Models\CompanyGateway; use App\Models\GatewayType; use App\Models\Payment; use App\Models\PaymentHash; diff --git a/routes/api.php b/routes/api.php index 4b8fbaeeb597..06aaafe67a6f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -188,5 +188,3 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::match(['get', 'post'], 'payment_webhook/{company_gateway_id}/{company_key}', 'PaymentWebhookController')->name('payment_webhook'); Route::fallback('BaseController@notFound'); - -// localhost:8080/payment_webhook/VolejRejNm/wrsef2tiyrwbcnrruwl24iqplayx0idmtjevmnyqniekawtwcgirgpzyceka4bd8 diff --git a/tests/Feature/Import/ImportCsvTest.php b/tests/Feature/Import/ImportCsvTest.php index 807ecf7b921c..9566b2c36529 100644 --- a/tests/Feature/Import/ImportCsvTest.php +++ b/tests/Feature/Import/ImportCsvTest.php @@ -77,7 +77,6 @@ class ImportCsvTest extends TestCase Cache::put($hash, base64_encode($csv), 360); CSVImport::dispatchNow($data, $this->company); - } private function getCsvData($csvfile)