checkout, register, payment,
checkout correction, register wizard, payment packege,
This commit is contained in:
parent
6e3adac4d7
commit
446bc4561b
48 changed files with 2580 additions and 1493 deletions
|
|
@ -11,6 +11,7 @@ use App\Models\ShoppingOrder;
|
|||
use App\Models\ShoppingOrderItem;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\User;
|
||||
use Illuminate\Session\SessionManager;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -37,7 +38,7 @@ class CheckoutController extends Controller
|
|||
|
||||
public function checkout(){
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
// $user_shop = Util::getUserShop();
|
||||
|
||||
if(Input::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
|
|
@ -46,7 +47,42 @@ class CheckoutController extends Controller
|
|||
// $selected_country = $ShippingCountry->id;
|
||||
}
|
||||
|
||||
$shopping_user = ShoppingUser::findOrNew($this->getPayments('shopping_user_id'));
|
||||
if(!$this->getPayments('shopping_user_id') && Util::getAuthUser()){
|
||||
|
||||
$user = Util::getAuthUser();
|
||||
$user->email;
|
||||
$account = $user->account;
|
||||
$shopping_user = new ShoppingUser();
|
||||
$shopping_user->auth_user_id = $user->id;
|
||||
$shopping_user->billing_salutation = $user->account->salutation;
|
||||
$shopping_user->billing_company = $user->account->company;
|
||||
$shopping_user->billing_firstname = $user->account->first_name;
|
||||
$shopping_user->billing_lastname = $user->account->last_name;
|
||||
$shopping_user->billing_address = $user->account->address;
|
||||
$shopping_user->billing_address_2 = $user->account->address_2;
|
||||
$shopping_user->billing_zipcode = $user->account->zipcode;
|
||||
$shopping_user->billing_city = $user->account->city;
|
||||
$shopping_user->billing_country_id = $user->account->country_id;
|
||||
$shopping_user->billing_phone = $user->account->phone;
|
||||
$shopping_user->billing_email = $user->email;
|
||||
$shopping_user->accepted_data_checkbox = 1;
|
||||
$shopping_user->same_as_billing = $user->account->same_as_billing;
|
||||
$shopping_user->shipping_salutation = $user->account->shipping_salutation;
|
||||
$shopping_user->shipping_company = $user->account->shipping_company;
|
||||
$shopping_user->shipping_firstname = $user->account->shipping_firstname;
|
||||
$shopping_user->shipping_lastname = $user->account->shipping_lastname;
|
||||
$shopping_user->shipping_address = $user->account->shipping_address;
|
||||
$shopping_user->shipping_address_2 = $user->account->shipping_address_2;
|
||||
$shopping_user->shipping_zipcode = $user->account->shipping_zipcode;
|
||||
$shopping_user->shipping_city = $user->account->shipping_city;
|
||||
$shopping_user->shipping_country_id = $user->account->shipping_country_id;
|
||||
$shopping_user->shipping_phone = $user->account->shipping_phone;
|
||||
$shopping_user->save();
|
||||
$this->putPayments('shopping_user_id', $shopping_user->id);
|
||||
|
||||
}else{
|
||||
$shopping_user = ShoppingUser::findOrNew($this->getPayments('shopping_user_id'));
|
||||
}
|
||||
if($shopping_user->same_as_billing === NULL){
|
||||
$shopping_user->same_as_billing = true;
|
||||
}
|
||||
|
|
@ -59,7 +95,7 @@ class CheckoutController extends Controller
|
|||
|
||||
public function checkoutFinal(){
|
||||
|
||||
/*
|
||||
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
'billing_firstname'=>'required',
|
||||
|
|
@ -86,7 +122,7 @@ class CheckoutController extends Controller
|
|||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$data = Input::all();
|
||||
//make User
|
||||
|
|
@ -203,15 +239,16 @@ class CheckoutController extends Controller
|
|||
|
||||
$data = [
|
||||
'key' => '698fb2555f8b2efc74f60b2121421f45',
|
||||
'txaction' => 'appointed',
|
||||
'clearingtype' => 'vor',
|
||||
'userid' => '157787236',
|
||||
'txid' => '319655873',
|
||||
'price' => '13.80',
|
||||
'param' => '6', //$this->shopping_order->id,
|
||||
'reference' => '15c76c0d470cf9',
|
||||
'txaction' => 'paid',
|
||||
'clearingtype' => 'wlt',
|
||||
'userid' => '158006846',
|
||||
'txid' => '320267294',
|
||||
'price' => '59.00',
|
||||
'param' => '18', //$this->shopping_order->id,
|
||||
'reference' => '15c79ba77992e2',
|
||||
];
|
||||
|
||||
|
||||
if(!isset($data['key']) || !isset($data['param']) || !isset($data['userid']) || !isset($data['txid']) || !isset($data['reference']) || !isset($data['price'])){
|
||||
\Log::channel('payone')->error('PaymentStatus: parameter incomplete: '.json_encode($data));
|
||||
abort(404);
|
||||
|
|
@ -274,6 +311,28 @@ class CheckoutController extends Controller
|
|||
if($data['txaction'] == 'paid'){
|
||||
$shopping_order->paid = true;
|
||||
$shopping_order->save();
|
||||
//if product has actions
|
||||
if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
|
||||
foreach($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product){
|
||||
if($shopping_order_item->product->action){
|
||||
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
foreach ($shopping_order_item->product->action as $do){
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_account'){
|
||||
$user->payment_account = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) == 'payment_for_shop'){
|
||||
$user->payment_shop = date("Y-m-d H:i:s", strtotime("+1 years"));
|
||||
$user->wizard = 10;
|
||||
}
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($data['txaction'] == 'appointed'){
|
||||
|
|
@ -321,6 +380,7 @@ class CheckoutController extends Controller
|
|||
|
||||
$data = [
|
||||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ','),
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ class SiteController extends Controller
|
|||
$products = ['aloe-vera-gel-99', 'aloe-vera-saft-500-ml', 'aloe-vera-lippenbalsam'];
|
||||
$set_products = ['aloe-vera-cleaner-set', 'aloe-vera-koerper-set', 'aloe-vera-repair-set'];
|
||||
$data = [
|
||||
'products' => Product::whereIn('slug', $products)->get(),
|
||||
'set_products' => Product::whereIn('slug', $set_products)->get(),
|
||||
'products' => Product::whereIn('slug', $products)->where('active', true)->where('show_at', '<=', 1)->get(),
|
||||
'set_products' => Product::whereIn('slug', $set_products)->where('active', true)->where('show_at', '<=', 1)->get(),
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.index', $data);
|
||||
|
|
@ -36,12 +36,12 @@ class SiteController extends Controller
|
|||
public function site($site, $subsite = false, $product_slug = false)
|
||||
{
|
||||
|
||||
$subsite = trim($subsite, '/');
|
||||
$product_slug = trim($product_slug, '/');
|
||||
$subsite = trim($subsite, '/');
|
||||
$product_slug = trim($product_slug, '/');
|
||||
if($product_slug){
|
||||
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
$product = Product::where('slug', $product_slug)->where('active', true)->first();
|
||||
$product = Product::where('slug', $product_slug)->where('active', true)->where('show_at', '<=', 1)->first();
|
||||
if ($category && $product) {
|
||||
|
||||
$data = [
|
||||
|
|
@ -49,7 +49,7 @@ class SiteController extends Controller
|
|||
'subsite' => $subsite,
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'product' => $product,
|
||||
'p_count' => Product::where('active', true)->count(),
|
||||
'p_count' => Product::where('active', true)->where('show_at', '<=', 1)->count(),
|
||||
|
||||
];
|
||||
return view('web.templates.produkte-show', $data);
|
||||
|
|
@ -57,7 +57,6 @@ class SiteController extends Controller
|
|||
}
|
||||
|
||||
if($site == 'produkte'){
|
||||
|
||||
if($subsite || $subsite != 'alle-produkte') {
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
if ($category) {
|
||||
|
|
@ -68,8 +67,8 @@ class SiteController extends Controller
|
|||
'products' => Product::whereHas('categories', function ($query) use ($category) {
|
||||
$query->where('category_id', '=', $category->id);
|
||||
|
||||
})->where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'p_count' => Product::where('active', true)->count(),
|
||||
})->where('active', true)->where('show_at', '<=', 1)->orderBy('pos', 'DESC')->get(),
|
||||
'p_count' => Product::where('active', true)->where('show_at', '<=', 1)->count(),
|
||||
|
||||
];
|
||||
return view('web.templates.' . $site, $data);
|
||||
|
|
@ -80,8 +79,8 @@ class SiteController extends Controller
|
|||
'user_shop' => Util::getUserShop(),
|
||||
'subsite' => 'alle-produkte',
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'p_count' => Product::where('active', true)->count(),
|
||||
'products' => Product::where('active', true)->where('show_at', '<=', 1)->orderBy('pos', 'ASC')->get(),
|
||||
'p_count' => Product::where('active', true)->where('show_at', '<=', 1)->count(),
|
||||
];
|
||||
return view('web.templates.'.$site, $data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue