110 lines
No EOL
2.9 KiB
PHP
Executable file
110 lines
No EOL
2.9 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers\Web;
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Pay\PayoneController;
|
|
use App\Models\Product;
|
|
use Validator;
|
|
use App\Services\Util;
|
|
use Yard;
|
|
use Input;
|
|
|
|
class CheckoutController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
|
|
|
|
public function checkout(){
|
|
|
|
$user_shop = Util::getUserShop();
|
|
|
|
if(Input::get('selected_country')){
|
|
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
|
}else{
|
|
// $ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
|
// $selected_country = $ShippingCountry->id;
|
|
}
|
|
$data = [
|
|
'user_shop' => Util::getUserShop(),
|
|
];
|
|
return view('web.templates.checkout', $data);
|
|
}
|
|
|
|
public function checkoutFinal(){
|
|
|
|
/*$rules = array(
|
|
'billing.firstname'=>'required',
|
|
'billing.lastname'=>'required',
|
|
'billing.email'=>'required|email',
|
|
'billing.address'=>'required',
|
|
'billing.zipcode'=>'required',
|
|
'billing.city' => 'required',
|
|
'accepted_data_checkbox' => 'accepted',
|
|
);
|
|
|
|
if(!Input::get('shipping.same_as_billing')){
|
|
$rules = array_merge($rules, [
|
|
'shipping.firstname'=>'required',
|
|
'shipping.lastname'=>'required',
|
|
'shipping.address'=>'required',
|
|
'shipping.zipcode'=>'required',
|
|
'shipping.city' => 'required',
|
|
]);
|
|
}
|
|
$validator = Validator::make(Input::all(), $rules);
|
|
if ($validator->fails()) {
|
|
return back()->withErrors($validator)->withErrors($validator)->withInput(Input::all());
|
|
}*/
|
|
|
|
if(Input::get('payment_method')){
|
|
$pay = new PayoneController(Input::get('payment_method'));
|
|
$pay->setPrePayment([]);
|
|
$pay->setPersonalData([]);
|
|
$pay->ResponseData([]);
|
|
}
|
|
|
|
|
|
$data = [
|
|
'user_shop' => Util::getUserShop(),
|
|
];
|
|
return view('web.templates.checkout-final', $data);
|
|
}
|
|
|
|
|
|
public function transactionStatus($check){
|
|
|
|
if($check == "cancel"){
|
|
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
|
|
return $this->checkout();
|
|
}
|
|
$pay = new PayoneController([]);
|
|
$pay->checkStatus();
|
|
$data = \Request::all();
|
|
var_dump($data);
|
|
$data = \Input::all();
|
|
var_dump($data);
|
|
die();
|
|
}
|
|
|
|
public function removeCard($rowId){
|
|
Yard::instance('shopping')->remove($rowId);
|
|
return back();
|
|
}
|
|
|
|
public function deleteCard(){
|
|
|
|
Yard::instance('shopping')->destroy();
|
|
return back();
|
|
}
|
|
|
|
} |