This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -2,23 +2,25 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Auth;
use Yard;
use Request;
use App\User;
use Validator;
use App\Services\Shop;
use App\Services\Util;
use App\Models\Product;
use App\Services\Payment;
use App\Models\UserHistory;
use App\Models\ShoppingUser;
use App\Models\ShoppingOrder;
use App\Services\UserService;
use App\Mail\MailCustomPaymet;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use App\Models\ShoppingOrder;
use App\Models\ShoppingUser;
use App\Models\UserHistory;
use App\Models\UserShop;
use App\Services\Payment;
use App\Services\UserService;
use App\Services\Util;
use App\User;
use Auth;
use Request;
use Validator;
use Yard;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Mail;
class OrderController extends Controller
{
@ -85,7 +87,7 @@ class OrderController extends Controller
data-back=""
data-modal="modal-xl"
data-init_from="user"
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
}
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
@ -109,29 +111,31 @@ class OrderController extends Controller
->make(true);
}
/*
$for = me, ot-member, ot-customer, abo-ot-member, abo-ot-customer, abo-me
*/
public function delivery($for, $id=null)
{
$user = User::find(\Auth::user()->id);
$shopping_user = null;
$delivery_id = null;
if($for === 'ot'){
$shopping_user = $this->checkShoppingUser($id, $user);
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
$shopping_user = Shop::checkShoppingUser($id, $user);
$delivery_id = $shopping_user->id;
if(!$this->checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
if(!Shop::checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
$country = Shop::getDeliveryCountry($for, $delivery_id);
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
}
}
if(Request::get('action') === 'next'){
Yard::instance('shopping')->destroy();
if(Request::get('switchers-radio-is-for') === 'ot'){
if(strpos(Request::get('switchers-radio-is-for'), 'ot') !== false){
$delivery_id = $id;
}
return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id]));
}
$data = [
'shopping_user' => $shopping_user,
'isAdmin' => false,
@ -144,31 +148,36 @@ class OrderController extends Controller
public function list($for, $id=null)
{
$user = User::find(\Auth::user()->id);
$shopping_user = null;
$delivery_id = null;
if($for === 'ot'){
$shopping_user = $this->checkShoppingUser($id, $user);
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
$shopping_user = Shop::checkShoppingUser($id, $user);
$delivery_id = $shopping_user->id;
}
$shipping_country_id = $this->checkShoppingCountry($for, $id);
if(!$shipping_country_id){
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
//Liederung an (abo-) ot-customer (Kunden) Zahlung und Rechnung geht an Kunden
UserService::initCustomerYard($shopping_user, $for);
}else{
//Lieferung an user oder (abo-) ot-member (Kunden) rechnung geht an User
//lieferland und rechnungsland prüfen
$shipping_country_id = Shop::checkShoppingCountry($for, $id);
if(!$shipping_country_id){
$country = Shop::getDeliveryCountry($for, $id);
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
}
UserService::initUserYard($user, $shipping_country_id, $for);
}
UserService::checkUserTaxShippingCountry($user, $shipping_country_id);
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
Yard::instance('shopping')->setUserPriceInfos(UserService::getYardInfo());
$data = [
'shopping_user' => $shopping_user,
'user' => $user,
'isAdmin' => false,
'isView' => 'customer',
'for' => $for,
'template' => str_replace('abo-', '', $for),
'delivery_id' => $delivery_id,
'is_abo' => strpos($for, 'abo') !== false,
'comp_products' => $this->getCompProducts($for),
];
return view('user.order.list', $data);
@ -187,20 +196,21 @@ class OrderController extends Controller
'shipping_state' => 'required',
);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
//hier prüfen, ob versand etc richtig berechnet wurde
$this->checkSendYardForPayment($data, $id);
if(Yard::instance('shopping')->getNumComp() > 0){
if(!isset($data['switchers-comp-product'])){
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
}else{
if(!is_array($data['switchers-comp-product'])){
$validator->errors()->add('switchers-comp-product', __('Bitte wähle ein Kompensationsprodukt aus'));
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
}else{
if(count($data['switchers-comp-product']) !== Yard::instance('shopping')->getNumComp()){
$validator->errors()->add('switchers-comp-product', __('Bitte wähle :count Kompensationsprodukte aus', ['count'=>Yard::instance('shopping')->getNumComp()]));
$validator->errors()->add('switchers-comp-product', __('mdg.please_select_count_compensation_products', ['count'=>Yard::instance('shopping')->getNumComp()]));
}
}
}
@ -213,92 +223,170 @@ class OrderController extends Controller
} while( ShoppingInstance::where('identifier', $identifier)->count() );
$data['is_from'] = 'user_order';
$data['is_for'] = $for;
$data['is_abo'] = $data['is_abo'] ?? 0;
$data['abo_interval'] = $data['abo_interval'] ?? 0;
$data['shopping_user_id'] = $id;
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
unset($data['quantity']);
unset($data['_token']);
$data['mode'] = 'live';
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
'payment' => 2, //Berater Shop
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
'back' => url()->previous(),
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => $user->shop->id,
'payment' => 6, //Berater Shop to Customer Shop
'subdomain' => $user->shop->getSubdomain(),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'shopping_data' => $data,
'back' => url()->previous(),
]);
$yard_shopping_items = Shop::getYardShoppingItems();
Yard::instance('shopping')->store($identifier);
// send Mail to Customer
$this->customPaymentSendMail($user, $identifier, $yard_shopping_items, $data);
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_customer', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
]);
Yard::instance('shopping')->store($identifier);
//eine Abschließen bestellseite für den User + Link zum Kunden Shop + Mail an den Kunden / Berater
return redirect(route('user_order_my_custom_payment', ['identifier'=>$identifier]));
}else{
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
'payment' => 2, //Berater Shop
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'shopping_data' => $data,
'back' => url()->previous(),
//add to DB
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'abo_options'=>0]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);
]);
Yard::instance('shopping')->store($identifier);
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);
}
}
private function checkShoppingCountry($for, $id=null){
private function checkSendYardForPayment($data, $id){
$country_id = null;
if($for === 'me'){
$user = User::find(\Auth::user()->id);
if($user->account->same_as_billing){
$country_id = $user->account->country_id;
}else{
$country_id = $user->account->shipping_country_id;
}
$user = User::find(\Auth::user()->id);
$shopping_user = null;
if(strpos($data['shipping_is_for'], 'ot') !== false){
$shopping_user = Shop::checkShoppingUser($id, $user);
}
if($for === 'ot' && $id){
$shopping_user = ShoppingUser::findOrFail($id);
if($shopping_user->same_as_billing){
$country_id = $shopping_user->billing_country_id;
}else{
$country_id = $shopping_user->shipping_country_id;
}
}
if($country_id){
if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){
if($shipping_country->shipping && $shipping_country->shipping->active){
return $shipping_country->id;
}
}
}
return false;
}
private function checkShoppingUser($id, $user){
if($id === null){
abort(403, 'Error: Keine User ID');
$shipping_country_id = Shop::checkShoppingCountry($data['shipping_is_for'], $id);
if(!$shipping_country_id){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'no shipping_country_id found | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_country_was_not_found'));
}
$shopping_user = ShoppingUser::findOrFail($id);
if($shopping_user->member_id !== $user->id){
abort(403, 'Error: Falsche User ID');
//must be the same shipping country
if($shipping_country_id != Yard::instance('shopping')->getShippingCountryId()){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'shipping_country_id is not the same from Yard | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_country_was_not_correctly'));
}
$shopping_user = ShoppingUser::findOrFail($id);
if($shopping_user->is_like){
abort(403, 'Error: Kunde in Prüfung');
if($data['shipping_is_for'] !== 'ot-customer'){
if(Yard::instance('shopping')->shipping_free){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard can by not shipping_free | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shopping_cart_was_shipping_free'));
}
}
if($data['shipping_is_for'] === 'ot-customer'){
if(!$user->shop){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'User has no Shop for an User to Customer order| Yard identifier: '.$identifier, $data);
abort(403, __('msg.shopping_cart_was_not_user_shop'));
}
}
$shipping_price = Shop::getShippingPriceByShippingCountryId($shipping_country_id, Yard::instance('shopping')->weight());
//for other and has weight - check
if(strpos($data['shipping_is_for'], 'ot') !== false && $data['shipping_is_for'] !== 'ot-customer' && Yard::instance('shopping')->weight() > 0){
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is 0 or | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_cost_cannot_be_0'));
}
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
}
}
if(($data['shipping_is_for'] == 'me' || $data['shipping_is_for'] == 'abo-me') && Yard::instance('shopping')->weight() > 0){
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is 0 or | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_cost_cannot_be_0'));
}
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price_comp){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
}
if(Yard::instance('shopping')->getNumComp() != $shipping_price->num_comp){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard num_comp is 0 | Yard identifier: '.$identifier, $data);
abort(403, __('msg.compensation_products_cannot_be_0'));
}
}
return $shopping_user;
}
public function datatable(){
if(Request::get('shipping_is_for') === 'me'){
// $query = Product::with('product_buyings')->select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
if(Request::get('shipping_is_for') === 'me' || Request::get('shipping_is_for') === 'abo-me'){
$show_on = Request::get('is_abo') ? '12' : '2';
$query = Product::with('product_buyings')
->select('products.*')->where('products.active', true)
->whereJsonContains('products.show_on', '2')
->whereJsonContains('products.show_on', $show_on)
->whereDoesntHave('product_buyings', function ($q){
$q->where('product_buyings.user_id', '=', \Auth::user()->id);
});
}else{
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '3');
$show_on = Request::get('is_abo') ? '13' : '3';
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', $show_on);
}
return \DataTables::eloquent($query)
@ -306,7 +394,7 @@ class OrderController extends Controller
$cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
$qty = isset($cartItem->qty) ? $cartItem->qty : 0;
$rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
return '<strong>'.$product->name.'</strong><br>
return '<strong>'.$product->getLang('name').'</strong><br>
<div class="no-line-break input-group-min-w">
<div class="input-group d-inline-flex w-auto">
<span class="input-group-prepend">
@ -358,6 +446,15 @@ class OrderController extends Controller
->addColumn('price_vk_gross', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('customer_price_net', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('customer_price_gross', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('my_commission_net', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry(), true). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry(), true).'</span>';
})
->addColumn('action', function (Product $product) {
return '<button class="btn btn-default btn-sm icon-btn md-btn-flat product-tooltip" title="details" data-modal="modal-lg"
data-toggle="modal" data-target="#modals-load-content" data-id="'.$product->id.'" data-route="'.route('modal_load').'"
@ -375,10 +472,13 @@ class OrderController extends Controller
->orderColumn('price_net', 'price_net $1')
->orderColumn('price_gross', 'price_gross $1')
->orderColumn('price_vk_gross', 'price $1')
->orderColumn('customer_price_net', 'price $1')
->orderColumn('customer_price_gross', 'price $1')
->orderColumn('my_commission_net', 'price $1')
->orderColumn('contents_total', 'contents_total $1')
->orderColumn('weight', 'weight $1')
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'product', 'quantity', 'picture', 'action'])
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'customer_price_net', 'customer_price_gross', 'my_commission_net', 'product', 'quantity', 'picture', 'action'])
->make(true);
}
@ -387,8 +487,9 @@ class OrderController extends Controller
if(Request::ajax()) {
$data = Request::all();
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot';
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot-member';
$data['for'] = $is_for;
$data['comp_products'] = $this->getCompProducts($is_for);
if($data['action'] === 'updateCart' && isset($data['product_id'])){
@ -399,17 +500,28 @@ class OrderController extends Controller
}
//get the card item
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
if($is_for === 'ot-customer' || $is_for === 'abo-ot-customer'){
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), 1,
round($product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), 1), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
}else{
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), 1,
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), true, Yard::instance('shopping')->getUserCountry()), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
}
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
}
if(isset($data['qty']) && $data['qty'] > 0){
Yard::instance('shopping')->update($cartItem->rowId, $data['qty']);
}else{
//if 0 get the item by qty:1 and remove it
Yard::instance('shopping')->remove($cartItem->rowId);
}
//
Yard::instance('shopping')->reCalculateShippingPrice();
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
$html_card = view("user.order.yard_view_form", $data)->render();
@ -460,6 +572,7 @@ class OrderController extends Controller
}
}
}
private function updateCompProduct($data){
//clear old
foreach (Yard::instance('shopping')->content() as $row) {
@ -485,9 +598,79 @@ class OrderController extends Controller
}
private function getCompProducts($for){
if($for === 'me'){
return Product::whereActive(true)->whereJsonContains('show_on', ['1', '2', '3', '4'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
if(Shop::isCompProducts($for)){
$show_on = '0';
switch($for){
case 'me':
$show_on = '2';
break;
case 'abo-me':
$show_on = '12';
break;
case 'ot-member':
$show_on = '3';
break;
case 'ot-customer':
$show_on = '3';
break;
case 'abo-ot-member':
$show_on = '13';
break;
case 'abo-ot-customer':
$show_on = '13';
break;
}
return Product::whereActive(true)->where('shipping_addon', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'DESC')->get();
}
return null;
}
public function customPayment($identifier){
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
if(!$shopping_instance){
abort(403, __('msg.shopping_instance_not_found'));
}
$shopping_data = $shopping_instance->shopping_data;
$shopping_user = $shopping_data['shopping_user_id'] ? ShoppingUser::find($shopping_data['shopping_user_id']) : null;
if(!$shopping_user){
abort(403, __('msg.shopping_user_not_found'));
}
$yard_shopping_items = Shop::getYardShoppingItems();
$data = [
'shopping_instance' => $shopping_instance,
'shopping_user' => $shopping_user,
'yard_shopping_items' => $yard_shopping_items,
'identifier' => $identifier,
];
return view('user.order.custom_payment', $data);
}
private static function customPaymentSendMail($user, $identifier, $yard_shopping_items, $data){
$bcc = [];
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
if(!$shopping_instance){
abort(403, __('msg.shopping_instance_not_found'));
}
$shopping_user = $data['shopping_user_id'] ? ShoppingUser::find($data['shopping_user_id']) : null;
if(!$shopping_user){
abort(403, __('msg.shopping_user_not_found'));
}
$route = route('checkout.checkout_card', ['identifier'=>$identifier]);
$billing_email = $shopping_user->billing_email;
if(!$billing_email){
$billing_email = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
}
$bcc[] = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
$bcc[] = $shopping_user->member ? $shopping_user->member->email : $user->email;
Mail::to($billing_email)->bcc($bcc)->locale(\App::getLocale())
->send(new MailCustomPaymet($route, $shopping_user, $shopping_instance, $yard_shopping_items, $data['mode']));
}
}