mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 14:54:34 -04:00
Update webhooks to support Checkout.com & apply php-cs-fixer
This commit is contained in:
parent
c75bd84cbe
commit
942652b668
@ -12,7 +12,6 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Jobs\Util\VersionCheck;
|
use App\Jobs\Util\VersionCheck;
|
||||||
use Composer\Console\Application;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
|
|
||||||
class PaymentWebhookController extends Controller
|
class PaymentWebhookController extends Controller
|
||||||
{
|
{
|
||||||
@ -25,9 +24,10 @@ class PaymentWebhookController extends Controller
|
|||||||
public function __invoke(PaymentWebhookRequest $request, string $company_gateway_id, string $company_key)
|
public function __invoke(PaymentWebhookRequest $request, string $company_gateway_id, string $company_key)
|
||||||
{
|
{
|
||||||
$payment = $request->getPayment();
|
$payment = $request->getPayment();
|
||||||
|
$client = is_null($payment) ? $request->getClient() : $payment->client;
|
||||||
|
|
||||||
return $request->getCompanyGateway()
|
return $request->getCompanyGateway()
|
||||||
->driver($payment->client)
|
->driver($client)
|
||||||
->processWebhookRequest($request, $payment);
|
->processWebhookRequest($request, $payment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,8 @@ class SelfUpdateController extends BaseController
|
|||||||
}
|
}
|
||||||
info('Are there any changes to pull? '.$repo->hasChanges());
|
info('Are there any changes to pull? '.$repo->hasChanges());
|
||||||
|
|
||||||
dispatch(function (){
|
dispatch(function () {
|
||||||
|
|
||||||
Artisan::call('ninja:post-update');
|
Artisan::call('ninja:post-update');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return response()->json(['message' => ''], 200);
|
return response()->json(['message' => ''], 200);
|
||||||
|
@ -77,23 +77,6 @@ class PaymentWebhookRequest extends Request
|
|||||||
return $this->getPaymentHash()->payment;
|
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);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ use App\Http\Requests\Payments\PaymentWebhookRequest;
|
|||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Models\ClientGatewayToken;
|
use App\Models\ClientGatewayToken;
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
|
@ -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::match(['get', 'post'], 'payment_webhook/{company_gateway_id}/{company_key}', 'PaymentWebhookController')->name('payment_webhook');
|
||||||
|
|
||||||
Route::fallback('BaseController@notFound');
|
Route::fallback('BaseController@notFound');
|
||||||
|
|
||||||
// localhost:8080/payment_webhook/VolejRejNm/wrsef2tiyrwbcnrruwl24iqplayx0idmtjevmnyqniekawtwcgirgpzyceka4bd8
|
|
||||||
|
@ -77,7 +77,6 @@ class ImportCsvTest extends TestCase
|
|||||||
Cache::put($hash, base64_encode($csv), 360);
|
Cache::put($hash, base64_encode($csv), 360);
|
||||||
|
|
||||||
CSVImport::dispatchNow($data, $this->company);
|
CSVImport::dispatchNow($data, $this->company);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCsvData($csvfile)
|
private function getCsvData($csvfile)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user