Fixes for redirection route

This commit is contained in:
David Bomba 2024-04-26 14:13:22 +10:00
parent 642fdc7139
commit 399da26976
2 changed files with 33 additions and 12 deletions

View File

@ -444,8 +444,8 @@ return render('gateways.paypal.pay', $data);
"card" => [ "card" => [
"attributes" => [ "attributes" => [
"verification" => [ "verification" => [
"method" => "SCA_WHEN_REQUIRED", //SCA_ALWAYS // "method" => "SCA_WHEN_REQUIRED", //SCA_ALWAYS
// "method" => "SCA_ALWAYS", //SCA_ALWAYS "method" => "SCA_ALWAYS", //SCA_ALWAYS
], ],
"vault" => [ "vault" => [
"store_in_vault" => "ON_SUCCESS", //must listen to this webhook - VAULT.PAYMENT-TOKEN.CREATED webhook. "store_in_vault" => "ON_SUCCESS", //must listen to this webhook - VAULT.PAYMENT-TOKEN.CREATED webhook.
@ -478,26 +478,38 @@ return render('gateways.paypal.pay', $data);
} }
return [ $order = [
"paypal" => [ "paypal" => [
"name" => [ "name" => [
"given_name" => $this->client->present()->first_name(), "given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name(), "surname" => $this->client->present()->last_name(),
], ],
"email_address" => $this->client->present()->email(), "email_address" => $this->client->present()->email(),
"address" => [ "experience_context" => [
"user_action" => "PAY_NOW"
],
],
];
if(
strlen($this->client->address1 ?? '') > 2 &&
strlen($this->client->city ?? '') > 2 &&
strlen($this->client->state ?? '') >= 2 &&
strlen($this->client->postal_code ?? '') > 2 &&
strlen($this->client->country->iso_3166_2 ?? '') >= 2
)
{
$order['paypal']['address'] = [
"address_line_1" => $this->client->address1, "address_line_1" => $this->client->address1,
"address_line_2" => $this->client->address2, "address_line_2" => $this->client->address2,
"admin_area_2" => $this->client->city, "admin_area_2" => $this->client->city,
"admin_area_1" => $this->client->state, "admin_area_1" => $this->client->state,
"postal_code" => $this->client->postal_code, "postal_code" => $this->client->postal_code,
"country_code" => $this->client->country->iso_3166_2, "country_code" => $this->client->country->iso_3166_2,
], ];
"experience_context" => [ }
"user_action" => "PAY_NOW"
], return $order;
],
];
} }

View File

@ -146,9 +146,18 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'clie
Route::get('route/{hash}', function ($hash) { Route::get('route/{hash}', function ($hash) {
return redirect(decrypt($hash)); $route = '/';
}); try {
$route = decrypt($hash);
}
catch (\Exception $e) {
abort(404);
}
return redirect($route);
})->middleware('throttle:404');
Route::get('phantom/{entity}/{invitation_key}', [Phantom::class, 'displayInvitation'])->middleware(['invite_db', 'phantom_secret'])->name('phantom_view'); Route::get('phantom/{entity}/{invitation_key}', [Phantom::class, 'displayInvitation'])->middleware(['invite_db', 'phantom_secret'])->name('phantom_view');
Route::get('blade/', [Phantom::class, 'blade'])->name('blade'); Route::get('blade/', [Phantom::class, 'blade'])->name('blade');