Cocker Setup

This commit is contained in:
Kevin Adametz 2025-08-29 14:48:03 +02:00
parent 8fdaa0ba1d
commit 8c11130b5d
191 changed files with 8152 additions and 18186 deletions

View file

@ -25,7 +25,7 @@ class CheckoutController extends Controller
{
private $checkoutRepo;
private $instance = 'checkout';
/**
* Create a new controller instance.
*
@ -50,7 +50,7 @@ class CheckoutController extends Controller
<a href="{{ Util::getMyMivitaPortalUrl() }}" class="btn btn-primary btn-block mt-3 faa-parent animated-hover"><i class="fa fa-sign-in"></i> {{ __('website.to_customer_portal') }} </a>
@endif
@if(Auth::guard('user')->check())
*/
*/
$shopping_data = Yard::instance($this->instance)->getYardExtra('shopping_data');
$is_from = $shopping_data['is_from'] ?? 'shopping';
$is_for = $shopping_data['is_for'] ?? false;
@ -70,14 +70,17 @@ class CheckoutController extends Controller
}
}
if (Session::has('new_session')) {
$this->checkoutRepo->sessionDestroy();
$this->checkoutRepo->sessionDestroy();
Session::forget('new_session');
}
}
$shopping_user = $this->initializeShoppingUserSession($is_from, $is_for, $shopping_data, $homeparty_id);
$this->prepareShoppingUserData($shopping_user);
$payment_methods = $this->checkoutRepo->getPaymentsMethods($is_from, $is_abo);
if ($shopping_user === null) {
abort(403, 'ShoppingUser not found');
}
$data = [
'is_from' => $is_from,
'is_for' => $is_for,
@ -97,8 +100,8 @@ class CheckoutController extends Controller
return view('web.templates.checkout', $data);
}
/**
* Bereitet die ShoppingUser-Daten vor
*
@ -142,7 +145,7 @@ class CheckoutController extends Controller
if (isset($data['payment_method'])) {
$this->checkoutRepo->isPaymentsMethodsActive($data['payment_method'], $data['is_from'], $data['is_abo']);
}
Util::setInstanceStatus(2, true); // link_check
// Länderwechsel verarbeiten
@ -155,16 +158,16 @@ class CheckoutController extends Controller
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
// Benutzer und Bestellung erstellen
$shopping_user = $this->checkoutRepo->makeShoppingUser($data);
$shopping_order = $this->checkoutRepo->makeShoppingOrder($shopping_user, $data);
// CustomerPriority prüfen
if ($shopping_user->is_from === 'shopping') {
CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
}
Util::setUserHistoryValue(['status' => 2, 'shopping_order_id' => $shopping_order->id]);
// Zahlungsmethode verarbeiten
@ -188,7 +191,7 @@ class CheckoutController extends Controller
} else {
Yard::instance($this->instance)->setShippingCountryWithPrice($data['shipping_state'], $data['is_for']);
}
return back()->withInput(Request::all());
}
@ -220,7 +223,7 @@ class CheckoutController extends Controller
'shipping_salutation' => 'required'
]);
}
return Validator::make(Request::all(), $rules);
}
@ -236,7 +239,7 @@ class CheckoutController extends Controller
{
$result = [];
$payment_method = Request::get('payment_method');
// Kreditkarte prüfen
if ($payment_method === 'cc') {
$result = $this->checkCreditCard($data, $shopping_user, $shopping_order);
@ -260,7 +263,7 @@ class CheckoutController extends Controller
$reference = $pay->setPrePayment($payment_method, $amount, 'EUR', $result);
$this->checkoutRepo->putSessionPayments('payment_reference', $reference);
$pay->setPersonalData();
return $pay->ResponseData();
}
@ -277,7 +280,7 @@ class CheckoutController extends Controller
$pay = new PayoneController();
$pay->init($shopping_user, $shopping_order);
$ret['cc'] = $pay->checkCreditCard($data);
if ($ret['cc']['status'] === 'ERROR' || $ret['cc']['status'] === 'INVALID') {
Session::flash('cc-error', 1);
Session::flash('errormessage', $ret['cc']['errormessage']);
@ -303,14 +306,14 @@ class CheckoutController extends Controller
$pay->init($shopping_user, $shopping_order);
$amount = Yard::instance($this->instance)->totalWithShipping(2, '.', '') * 100;
$ret['elv'] = $pay->checkBankAccount($data, $amount, 'EUR', $shopping_user);
if ($ret['elv']['status'] === 'ERROR' || $ret['elv']['status'] === 'INVALID') {
Session::flash('elv-error', 1);
Session::flash('errormessage', $ret['elv']['errormessage']);
Session::flash('customermessage', $ret['elv']['customermessage']);
return redirect(route('checkout.checkout_card'))->withInput(Request::all());
}
if ($ret['elv']['status'] === 'APPROVED' && $ret['elv']['mandate_status'] !== "active") {
Session::flash('elv-managemandate', 1);
Session::flash('elv-mandate_identification', $ret['elv']['mandate_identification']);
@ -318,7 +321,7 @@ class CheckoutController extends Controller
Session::flash('elv-creditor_identifier', $ret['elv']['creditor_identifier']);
return redirect(route('checkout.checkout_card'))->withInput(Request::all());
}
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
} else {
$ret['elv'] = [
@ -328,7 +331,7 @@ class CheckoutController extends Controller
'bic' => $data['elv_bic'],
'bankaccountholder' => $data['elv_bankaccountholder']
];
$this->storeUserPaymentsData($shopping_user, $ret);
}
$ret['returnstatus'] = 'VALID';
@ -347,7 +350,7 @@ class CheckoutController extends Controller
'is_checkout' => true,
'yard_instance' => $this->instance,
];
return view('web.templates.checkout-is-final', $data);
}
@ -364,13 +367,13 @@ class CheckoutController extends Controller
$ShoppingPayment = ShoppingPayment::where('shopping_order_id', $shopping_order_id)
->where('reference', $reference)
->first();
if (!$ShoppingPayment) {
Util::setUserHistoryValue(['status' => 21]);
Session::flash('checkout-error', 'Der Zahlungsvorgang konnte nicht abgeschlossen werden, die Zahlung wurde nicht gefunden: ' . $reference);
return redirect(route('checkout.checkout_card'));
}
$ShoppingPayment->status = $status;
$ShoppingPayment->save();
@ -384,7 +387,7 @@ class CheckoutController extends Controller
Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
return redirect(route('checkout.checkout_card'));
}
if ($status === "error") {
Util::setUserHistoryValue(['status' => 23]);
Util::setInstanceStatus(6); // link_failed
@ -419,7 +422,7 @@ class CheckoutController extends Controller
'is_checkout' => true,
'yard_instance' => $this->instance,
];
return view('web.templates.checkout-final', $data);
}
@ -457,7 +460,7 @@ class CheckoutController extends Controller
'is_checkout' => true,
'yard_instance' => $this->instance,
];
return view('web.templates.checkout-final', $data);
}
@ -493,20 +496,20 @@ class CheckoutController extends Controller
$shopping_order = ShoppingOrder::find($payt->transmitted_data['param']);
$shopping_order->txaction = 'invoice_open';
$shopping_order->save();
$shopping_payment = ShoppingPayment::where('reference', $payt->transmitted_data['reference'])->first();
if ($shopping_payment) {
$shopping_payment->txaction = 'invoice_open';
$shopping_payment->save();
}
$send_link = Payment::paymentStatusPaidAction($shopping_order, false, $shopping_payment);
$data = [
'mode' => $payt->transmitted_data['mode'],
'txaction' => $payt->txaction,
'send_link' => $send_link,
];
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
}
}
@ -539,7 +542,7 @@ class CheckoutController extends Controller
//Bestelllink
if ($is_for === 'ot-customer' || $is_for === 'abo-ot-customer') {
//customer shop mit den Daten aus dem Salescenter shopping_data
return $this->checkoutRepo->makeCustomerShoppingUser($shopping_data, $is_for, $is_from);
return $this->checkoutRepo->makeCustomerShoppingUser($shopping_data, $is_for, $is_from);
}
//Webshop
return $this->checkoutRepo->initShoppingUser($is_for, $is_from, $homeparty_id);
@ -548,7 +551,7 @@ class CheckoutController extends Controller
return $this->getExistingShoppingUser();
}
/**
/**
* Holt den existierenden ShoppingUser und bereitet ihn vor
*
* @return ShoppingUser
@ -559,8 +562,7 @@ class CheckoutController extends Controller
$shopping_user->billing_state = Shop::getCountryShippingCountryId($shopping_user->billing_country_id);
$shopping_user->shipping_state = Shop::getCountryShippingCountryId($shopping_user->shipping_country_id);
$shopping_user->same_as_billing = $shopping_user->same_as_billing ? false : true; // reinvert
return $shopping_user;
}
}
}