Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:39:21 +02:00
parent 6167273a48
commit 9b54eb0512
348 changed files with 34535 additions and 5774 deletions

View file

@ -177,11 +177,18 @@ class PayController extends Controller
]);
//paypal
if($this->payment_method === 'pp'){
$paypal = new PayPalController;
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $this->shopping_order->promotion_user_id);
Util::setUserHistoryValue(['status'=>4], $identifier);
return $redirect;
switch ($payment_for) {
case 7: //promotion
$paypal = new PayPalController;
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $payment_for, $this->shopping_order->promotion_user_id);
Util::setUserHistoryValue(['status'=>4], $identifier);
return $redirect;
case 8: //shop
$paypal = new PayPalController;
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $payment_for, $this->shopping_order->user_shop_id);
Util::setUserHistoryValue(['status'=>4], $identifier);
return $redirect;
}
}
Util::setUserHistoryValue(['status'=>5], $identifier);
@ -189,7 +196,10 @@ class PayController extends Controller
case 7: //promotion
return redirect(route('web_promotion_goto', ['thanksorder', $this->shopping_order->promotion_user_id, $payt->id, $this->reference, $identifier]));
break;
case 8: //shop
return redirect(route('web_shop_goto', ['thanksorder', $this->shopping_order->user_shop_id, $payt->id, $this->reference, $identifier]));
break;
default:
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
break;

View file

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Pay;
use Request;
use App\Models\UserShop;
use App\Models\PromotionUser;
use App\Models\PaymentTransaction;
use App\Http\Controllers\Controller;
@ -12,7 +13,7 @@ use Srmklive\PayPal\Services\PayPal as PayPalClient;
class PayPalController extends Controller
{
public function payment($shopping_payment, $payt, $identifier, $promotion_user_id)
public function payment($shopping_payment, $payt, $identifier, $payment_for, $payment_for_user_id)
{
$provider = new PayPalClient;
// Through facade. No need to import namespaces
@ -36,8 +37,8 @@ class PayPalController extends Controller
]
],
'application_context' => [
'cancel_url' => route('cancel.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier]),
'return_url' => route('success.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier])
'cancel_url' => route('cancel.paypal_payment', [$payment_for, $payment_for_user_id, $payt->id, $shopping_payment->reference, $identifier]),
'return_url' => route('success.paypal_payment', [$payment_for, $payment_for_user_id, $payt->id, $shopping_payment->reference, $identifier])
]
]);
@ -47,9 +48,8 @@ class PayPalController extends Controller
}
public function paymentSuccess($id, $transactionId=false, $reference=false, $identifier=false)
public function paymentSuccess($payment_for, $id, $transactionId=false, $reference=false, $identifier=false)
{
$PromotionUser = PromotionUser::findOrFail($id);
$payt = PaymentTransaction::findOrFail($transactionId);
if($payt->shopping_payment->reference != $reference){
abort(404);
@ -74,16 +74,34 @@ class PayPalController extends Controller
}
$payt->request = $order['status'];
$payt->save();
return redirect(route('web_promotion_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
switch ($payment_for) {
case 7: //promotion
$PromotionUser = PromotionUser::findOrFail($id);
return redirect(route('web_promotion_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
case 8: //shop
$userShop = UserShop::findOrFail($id);
return redirect(route('web_shop_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
dd('Your payment has been declend. The payment cancelation page goes here!');
}
}
public function paymentCancel($id, $transactionId=false, $reference=false, $identifier=false)
public function paymentCancel($payment_for, $id, $transactionId=false, $reference=false, $identifier=false)
{
$PromotionUser = PromotionUser::findOrFail($id);
return redirect(url($PromotionUser->url));
dd('Your payment has been declend. The payment cancelation page goes here!');
switch ($payment_for) {
case 7: //promotion
$PromotionUser = PromotionUser::findOrFail($id);
return redirect(url($PromotionUser->url));
dd('Your payment has been declend. The payment cancelation page goes here!');
case 8: //shop
$userShop = UserShop::findOrFail($id);
return redirect(url($userShop->url));
dd('Your payment has been declend. The payment cancelation page goes here!');
}
}