Update webhooks to support Checkout.com & apply php-cs-fixer

This commit is contained in:
Benjamin Beganović 2020-12-17 12:27:15 +01:00
parent c75bd84cbe
commit 942652b668
7 changed files with 3 additions and 28 deletions

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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

View File

@ -77,7 +77,6 @@ class ImportCsvTest extends TestCase
Cache::put($hash, base64_encode($csv), 360);
CSVImport::dispatchNow($data, $this->company);
}
private function getCsvData($csvfile)