fix: 🐛 PayPalSuccess payment status "paid" & Require auth on payment routes
This commit is contained in:
parent
3a87bf303c
commit
41f8fd9550
3 changed files with 26 additions and 20 deletions
|
@ -118,7 +118,7 @@ function PaypalSuccess(Request $laravelRequest)
|
|||
if ($response->statusCode == 201 || $response->statusCode == 200) {
|
||||
//update payment
|
||||
$payment->update([
|
||||
'status' => 'success',
|
||||
'status' => 'paid',
|
||||
'payment_id' => $response->result->id,
|
||||
]);
|
||||
|
||||
|
@ -133,7 +133,7 @@ function PaypalSuccess(Request $laravelRequest)
|
|||
dd($response);
|
||||
} else {
|
||||
$payment->update([
|
||||
'status' => 'failed',
|
||||
'status' => 'cancelled',
|
||||
'payment_id' => $response->result->id,
|
||||
]);
|
||||
abort(500);
|
||||
|
@ -145,7 +145,7 @@ function PaypalSuccess(Request $laravelRequest)
|
|||
dd($ex->getMessage());
|
||||
} else {
|
||||
$payment->update([
|
||||
'status' => 'failed',
|
||||
'status' => 'cancelled',
|
||||
'payment_id' => $response->result->id,
|
||||
]);
|
||||
abort(422);
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
include_once(__DIR__ . '/index.php');
|
||||
|
||||
Route::get('payment/PayPalPay/{shopProduct}', function () {
|
||||
PaypalPay(request());
|
||||
})->name('payment.PayPalPay');
|
||||
Route::middleware(['web', 'auth'])->group(function () {
|
||||
Route::get('payment/PayPalPay/{shopProduct}', function () {
|
||||
PaypalPay(request());
|
||||
})->name('payment.PayPalPay');
|
||||
|
||||
Route::get('payment/PayPalSuccess', function () {
|
||||
PaypalSuccess(request());
|
||||
}
|
||||
)->name('payment.PayPalSuccess');
|
||||
Route::get(
|
||||
'payment/PayPalSuccess',
|
||||
function () {
|
||||
PaypalSuccess(request());
|
||||
}
|
||||
)->name('payment.PayPalSuccess');
|
||||
});
|
||||
|
|
|
@ -3,17 +3,18 @@
|
|||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
include_once(__DIR__ . '/index.php');
|
||||
Route::middleware(['web', 'auth'])->group(function () {
|
||||
Route::get('payment/StripePay/{shopProduct}', function () {
|
||||
StripePay(request());
|
||||
})->name('payment.StripePay');
|
||||
|
||||
Route::get('payment/StripePay/{shopProduct}', function () {
|
||||
StripePay(request());
|
||||
})->name('payment.StripePay');
|
||||
|
||||
Route::get(
|
||||
'payment/StripeSuccess',
|
||||
function () {
|
||||
StripeSuccess(request());
|
||||
}
|
||||
)->name('payment.StripeSuccess');
|
||||
Route::get(
|
||||
'payment/StripeSuccess',
|
||||
function () {
|
||||
StripeSuccess(request());
|
||||
}
|
||||
)->name('payment.StripeSuccess');
|
||||
});
|
||||
|
||||
|
||||
// Stripe WebhookRoute -> validation in Route Handler
|
||||
|
|
Loading…
Add table
Reference in a new issue