mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Update webhooks for Checkout:
- Update api.php -> gateway_key => company_gateway_id - Pass correct reference to url in CreditCard.php - Update PaymentWebhookController.php to support new company_gateway_id - Update PaymentWebhookRequest.php to resolve company gateway from correct input
This commit is contained in:
parent
a56e1cf3a0
commit
9662d9af92
@ -21,7 +21,7 @@ class PaymentWebhookController extends Controller
|
|||||||
$this->middleware('guest');
|
$this->middleware('guest');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __invoke(PaymentWebhookRequest $request, string $gateway_key, string $company_key)
|
public function __invoke(PaymentWebhookRequest $request, string $company_gateway_id, string $company_key)
|
||||||
{
|
{
|
||||||
return $request->getCompanyGateway()
|
return $request->getCompanyGateway()
|
||||||
->driver($request->getClient())
|
->driver($request->getClient())
|
||||||
|
@ -18,9 +18,12 @@ use App\Models\Company;
|
|||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class PaymentWebhookRequest extends Request
|
class PaymentWebhookRequest extends Request
|
||||||
{
|
{
|
||||||
|
use MakesHash;
|
||||||
|
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -41,7 +44,7 @@ class PaymentWebhookRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function getCompanyGateway(): ?CompanyGateway
|
public function getCompanyGateway(): ?CompanyGateway
|
||||||
{
|
{
|
||||||
return CompanyGateway::where('gateway_key', $this->gateway_key)->firstOrFail();
|
return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id))->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +58,8 @@ class PaymentWebhookRequest extends Request
|
|||||||
if ($this->query('hash')) {
|
if ($this->query('hash')) {
|
||||||
return PaymentHash::where('hash', $this->query('hash'))->firstOrFail();
|
return PaymentHash::where('hash', $this->query('hash'))->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +129,7 @@ class CreditCard
|
|||||||
$payment->{'3ds'} = ['enabled' => true];
|
$payment->{'3ds'} = ['enabled' => true];
|
||||||
|
|
||||||
$payment->{'success_url'} = route('payment_webhook', [
|
$payment->{'success_url'} = route('payment_webhook', [
|
||||||
'gateway_key' => $this->checkout->company_gateway->gateway_key,
|
'company_gateway_id' => $this->checkout->company_gateway->hashed_id,
|
||||||
'company_key' => $this->checkout->client->company->company_key,
|
'company_key' => $this->checkout->client->company->company_key,
|
||||||
'hash' => $this->checkout->payment_hash->hash,
|
'hash' => $this->checkout->payment_hash->hash,
|
||||||
]);
|
]);
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::group(['middleware' => ['api_secret_check']], function () {
|
Route::group(['middleware' => ['api_secret_check']], function () {
|
||||||
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
|
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
|
||||||
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
||||||
@ -170,7 +172,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
|
|
||||||
Route::post('preimport', 'ImportController@preimport')->name('import.preimport');
|
Route::post('preimport', 'ImportController@preimport')->name('import.preimport');
|
||||||
Route::post('import', 'ImportController@import')->name('import.import');
|
Route::post('import', 'ImportController@import')->name('import.import');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Route::resource('tasks', 'TaskController'); // name = (tasks. index / create / show / update / destroy / edit
|
Route::resource('tasks', 'TaskController'); // name = (tasks. index / create / show / update / destroy / edit
|
||||||
|
|
||||||
@ -183,6 +185,6 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
Route::post('support/messages/send', 'Support\Messages\SendingController');
|
Route::post('support/messages/send', 'Support\Messages\SendingController');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::match(['get', 'post'], 'payment_webhook/{gateway_key}/{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');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user