diff --git a/.env b/.env
index 9c7c8eb..9c7ed0a 100644
--- a/.env
+++ b/.env
@@ -8,8 +8,8 @@ APP_PROTOCOL=http://
APP_URL_MAIN=
APP_URL_CHECKOUT=checkout.
#APP_URL_MAIN=dev.
-APP_URL_CRM=mein.
-APP_CHECKOUT_MAIL=k.adametz@kagado.de
+APP_URL_CRM=my.
+APP_CHECKOUT_MAIL=no-replay@mivita.care
LOG_CHANNEL=stack
@@ -41,8 +41,8 @@ REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=w017f6e4.kasserver.com
MAIL_PORT=587
-MAIL_USERNAME=m04804ba
-MAIL_PASSWORD=4xyFrgy5y98ZhpAr
+MAIL_USERNAME=m04a9fbc
+MAIL_PASSWORD=3tQ72oCHZgncCTpK
MAIL_ENCRYPTION=null
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e42969f..142f87a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,52 +2,32 @@
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
+
@@ -61,127 +41,91 @@
/usr/local/bin/composer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- count
- put
- get
- setShippingCountry
- Util
- use Util
hidde
country_id
user_shop
@@ -206,6 +150,12 @@
select
back_to_shop
secu
+ checkUserShopName
+ shop_name_description
+ shop_contact_help
+ user_shop_name_check
+ ok
+ billing_cou
@@ -254,23 +204,6 @@
@@ -417,9 +367,9 @@
-
-
-
+
+
+
@@ -428,7 +378,6 @@
-
@@ -454,6 +403,14 @@
+
+
+
+
+
+
+
+
@@ -477,12 +434,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -498,31 +467,37 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -553,6 +528,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -562,6 +587,7 @@
+
@@ -572,18 +598,18 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -652,11 +678,15 @@
+
+
+
+
-
+
@@ -668,10 +698,10 @@
-
+
-
+
@@ -698,210 +728,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -909,23 +735,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -961,101 +770,316 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KasController.php b/KasController.php
new file mode 100644
index 0000000..cf6d450
--- /dev/null
+++ b/KasController.php
@@ -0,0 +1,111 @@
+ Sekunden ab, bei Y verlängert sich die Session mit jeder Benutzung
+ private $CredentialToken = false;
+ private $kas_flood_delay = 2;
+
+ /**
+ * Create a new controller instance.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->login();
+ }
+
+
+ public function action($func, $para = array()){
+
+ $this->checkSession($func);
+ try
+ {
+ $Params = array(); // Parameter für die API-Funktion
+ $SoapRequest = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
+ $req = $SoapRequest->KasApi(json_encode(array(
+ 'KasUser' => $this->kas_user, // KAS-User
+ 'KasAuthType' => 'session', // Auth per Sessiontoken
+ 'KasAuthData' => $this->CredentialToken, // Auth-Token
+ 'KasRequestType' => $func, // API-Funktion
+ 'KasRequestParams' => $para // Parameter an die API-Funktion
+ )));
+ Session::put('flood_protection.'.$func, time() + $this->kas_flood_delay + 0.2);
+
+ if(isset($req['Response']['ReturnString']) && $req['Response']['ReturnString'] == "TRUE"){
+ return $req['Response']['ReturnInfo'];
+ }
+ return $req;
+ }
+
+ // Fehler abfangen und ausgeben
+ catch (SoapFault $fault)
+ {
+ trigger_error(" Fehlernummer: {$fault->faultcode},
+ Fehlermeldung: {$fault->faultstring},
+ Verursacher: {$fault->faultactor},
+ Details: {$fault->detail}", E_USER_ERROR);
+ }
+ }
+
+
+ private function login(){
+
+ $this->checkSession('auth');
+ try
+ {
+
+ $SoapLogon = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasAuth.wsdl');
+ $this->CredentialToken = $SoapLogon->KasAuth(json_encode(array(
+ 'KasUser' => $this->kas_user,
+ 'KasAuthType' => 'sha1',
+ 'KasPassword' => sha1($this->kas_pass),
+ 'SessionLifeTime' => $this->session_lifetime,
+ 'SessionUpdateLifeTime' => $this->session_update_lifetime
+ )));
+ Session::put('flood_protection.auth', time() + $this->kas_flood_delay + 0.2);
+
+ }
+
+ // Fehler abfangen und ausgeben
+ catch (SoapFault $fault)
+ {
+ trigger_error("Fehlernummer: {$fault->faultcode},
+ Fehlermeldung: {$fault->faultstring},
+ Verursacher: {$fault->faultactor},
+ Details: {$fault->detail}", E_USER_ERROR);
+ }
+
+ }
+
+ private function checkSession($func)
+ {
+ $name = 'flood_protection.'.$func;
+
+ if(Session::exists($name)){
+ $time_to_wait = (float)Session::get($name) - time();
+ Session::forget($name);
+ }else {
+ $time_to_wait = 0;
+ }
+ if ( $time_to_wait >= 0 ) {
+ usleep( intval( $time_to_wait*1000000 ) );
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Api/PayoneController.php b/app/Http/Controllers/Api/PayoneController.php
new file mode 100755
index 0000000..c1da3d9
--- /dev/null
+++ b/app/Http/Controllers/Api/PayoneController.php
@@ -0,0 +1,161 @@
+ '698fb2555f8b2efc74f60b2121421f45',
+ '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));
+ echo "PaymentStatus: parameter incomplete:";
+ var_dump($data);
+ die();
+ }
+
+ if($data['key'] != config('payone.defaults.key')) {
+ \Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
+ echo "PaymentStatus: Key error:";
+ var_dump($data);
+ die();
+ }
+
+ $shopping_order = ShoppingOrder::find($data['param']);
+ if(!$shopping_order){
+ \Log::channel('payone')->error('PaymentStatus: ShoppingOrder not found: '.json_encode($data));
+ echo "PaymentStatus: ShoppingOrder not found:";
+ var_dump($data);
+ die();
+ }
+
+ $shopping_payment = ShoppingPayment::where('reference', $data['reference'])->first();
+ if(!$shopping_payment){
+ \Log::channel('payone')->error('PaymentStatus: ShoppingPayment not found: '.json_encode($data));
+ echo "PaymentStatus: ShoppingPayment not found:";
+ var_dump($data);
+ die();
+ }
+
+ if($shopping_payment->shopping_order_id != $shopping_order->id){
+ \Log::channel('payone')->error('PaymentStatus: ShoppingPayment no realation ShoppingOrder: '.json_encode($data));
+ echo "PaymentStatus: ShoppingPayment no realation ShoppingOrder:";
+ var_dump($data);
+ die();
+ }
+
+ if($data['key'] != config('payone.defaults.key')) {
+ \Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
+ echo "PaymentStatus: ShoppingPayment no realation ShoppingOrder:";
+ var_dump($data);
+ die();
+ }
+
+ $price = intval($data['price']*100);
+ if($shopping_payment->amount != $price){
+ \Log::channel('payone')->error('PaymentStatus: Price error: '.json_encode($data));
+ echo "PaymentStatus: Price error:";
+ var_dump($data);
+ die();
+ }
+
+ //create transaction
+ PaymentTransaction::create([
+ 'shopping_payment_id' => $shopping_payment->id,
+ 'request' => 'transaction',
+ 'txid' => $data['txid'],
+ 'userid' => $data['userid'],
+ 'status' => 'PAYONE',
+ 'key' => $data['key'],
+ 'txaction' => $data['txaction'],
+ 'transmitted_data' => $data,
+ ]);
+
+ $shopping_order->txaction = $data['txaction'];
+ $shopping_order->save();
+ $shopping_payment->txaction = $data['txaction'];
+ $shopping_payment->save();
+
+
+ if($data['txaction'] == 'failed'){
+
+ }
+ 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'){
+
+ }
+ $billing_email = $shopping_order->shopping_user->billing_email;
+ $user_shop_email = $shopping_order->user_shop->user->email;
+ if(!$billing_email){
+ $billing_email = config('app.checkout_mail');
+ }
+ $checkout_mail = config('app.checkout_mail');
+ if($user_shop_email){
+ Mail::to($billing_email)->bcc([$user_shop_email, $checkout_mail])->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment));
+ }else{
+ Mail::to($billing_email)->bcc($checkout_mail)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment));
+ }
+
+ print("TSOK");
+ exit;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Pay/PayoneController.php b/app/Http/Controllers/Pay/PayoneController.php
index d4870a2..6978a4d 100644
--- a/app/Http/Controllers/Pay/PayoneController.php
+++ b/app/Http/Controllers/Pay/PayoneController.php
@@ -111,40 +111,18 @@ class PayoneController extends Controller
return $this->reference;
}
- public function setPersonalData($data){
-
+ public function setPersonalData(){
$this->personalData = [
- // "salutation" => "Mr.",
- // "firstname" => "Henry",
- "lastname" => "Player", // mandatory
- // "street" => "Royal Street 1",
- // "zip" => "24118",
- // "city" => "Kiel",
- "country" => "DE", // mandatory
- //"email" => " info-buyer@mivita.care",
- "language" => "de"
+ "firstname" => $this->shopping_user->billing_firstname,
+ "lastname" => $this->shopping_user->billing_lastname, // mandatory
+ "street" => $this->shopping_user->billing_address,
+ "zip" => $this->shopping_user->billing_zipcode,
+ "city" => $this->shopping_user->billing_city,
+ "country" => ($this->shopping_user->billing_country) ? $this->shopping_user->billing_country->code : "DE", // mandatory
+ "email" => $this->shopping_user->billing_email,
+ "language" => ($this->shopping_user->billing_country) ? strtolower($this->shopping_user->billing_country->code) : "DE", // mandatory
];
-
- /* $this->personalData = array(
- "salutation" => "Herr",
- "title" => "Dr.",
- "firstname" => "Paul",
- "lastname" => "Neverpayer",
- "street" => "Fraunhoferstraße 2-4",
- "addressaddition" => "EG",
- "zip" => "24118",
- "city" => "Kiel",
- "country" => "DE",
- "email" => "paul.neverpayer@payone.de",
- "telephonenumber" => "043125968500",
- "birthday" => "19700204",
- "language" => "de",
- "gender" => "m",
- "ip" => "8.8.8.8"
- );
- */
-
/**
* Paydirekt requires both, personal data and shipping data
*/
@@ -157,9 +135,6 @@ class PayoneController extends Controller
"shipping_country" => "DE"
);*/
-
-
-
}
private function setMethod($payment_method, $cc_ret = []){
diff --git a/app/Http/Controllers/UserDataController.php b/app/Http/Controllers/UserDataController.php
index e276727..07f97d8 100755
--- a/app/Http/Controllers/UserDataController.php
+++ b/app/Http/Controllers/UserDataController.php
@@ -43,23 +43,31 @@ class UserDataController extends Controller
/*if(!$user->account){
$user->account = new UserAccount();
}*/
+
$rules = array(
'salutation' => 'required',
- 'last_name' => 'required|max:255',
- 'country_id' => 'required|integer|min:1',
+ 'first_name'=>'required',
+ 'last_name'=>'required',
+ 'address'=>'required',
+ 'zipcode'=>'required',
+ 'city' => 'required',
'email' => 'required|string|email|max:255|exists:users,email',
'email-confirm' => 'required|same:email',
);
+ if(!Input::get('same_as_billing')){
+ $rules = array_merge($rules, [
+ 'shipping_firstname'=>'required',
+ 'shipping_lastname'=>'required',
+ 'shipping_address'=>'required',
+ 'shipping_zipcode'=>'required',
+ 'shipping_city' => 'required',
+ 'shipping_salutation' => 'required'
- if(Input::get('company') == 1){
- $rules['company_name'] = 'required|max:255';
- $rules['company_country_id'] = 'required|integer|min:1';
+ ]);
}
-
$data = [
'user' => $user,
];
-
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
diff --git a/app/Http/Controllers/UserShopController.php b/app/Http/Controllers/UserShopController.php
index 85f249f..0483f39 100755
--- a/app/Http/Controllers/UserShopController.php
+++ b/app/Http/Controllers/UserShopController.php
@@ -7,6 +7,7 @@ use App\Models\UserShop;
use App\Models\UserShopOnSite;
use App\Repositories\UserRepository;
use Auth;
+use Cviebrock\EloquentSluggable\Services\SlugService;
use Input;
use Response;
use Validator;
@@ -370,22 +371,19 @@ class UserShopController extends Controller
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
- $messages = $validator->messages();
-
+ //$messages = $validator->messages();
return Response::json(array(
'success' => false,
'errors' => $validator->getMessageBag()->toArray()
));
}
- return Response::json(array(
- 'success' => true,
- ));
+ $slug = SlugService::createSlug(UserShop::class, 'slug', Input::get('user_shop_name'));
+ return Response::json(array(
+ 'success' => true,
+ 'preview_user_shop_name' => "http://".$slug.".".config('app.domain'),
+ ));
}
-
-
-
-
}
\ No newline at end of file
diff --git a/app/Http/Controllers/Web/CardController.php b/app/Http/Controllers/Web/CardController.php
index 2806e5c..c488ffd 100755
--- a/app/Http/Controllers/Web/CardController.php
+++ b/app/Http/Controllers/Web/CardController.php
@@ -35,6 +35,8 @@ class CardController extends Controller
$image = $product->images->first()->slug;
}
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product_slug, 'weight' => $product->weight]);
+ Yard::instance('shopping')->reCalculateShippingPrice();
+
\Session()->flash('show-card-after-add', true);
}
@@ -54,6 +56,8 @@ class CardController extends Controller
}
$quantity = Input::get('quantity') ? Input::get('quantity') : 1;
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
+ Yard::instance('shopping')->reCalculateShippingPrice();
+
\Session()->flash('show-card-after-add', true);
}
return back();
@@ -66,8 +70,7 @@ class CardController extends Controller
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;
+ Yard::instance('shopping')->reCalculateShippingPrice();
}
$data = [
'user_shop' => Util::getUserShop(),
@@ -81,6 +84,7 @@ class CardController extends Controller
if(isset($data['quantity'])){
foreach ($data['quantity'] as $rowId => $qty){
Yard::instance('shopping')->update($rowId, $qty);
+ Yard::instance('shopping')->reCalculateShippingPrice();
}
}else{
$this->deleteCard();
diff --git a/app/Http/Controllers/Web/CheckoutController.php b/app/Http/Controllers/Web/CheckoutController.php
index fcb5e66..bbeb19c 100755
--- a/app/Http/Controllers/Web/CheckoutController.php
+++ b/app/Http/Controllers/Web/CheckoutController.php
@@ -5,16 +5,13 @@ namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Pay\PayoneController;
-use App\Mail\MailCheckout;
use App\Models\PaymentTransaction;
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;
use Validator;
use App\Services\Util;
use Yard;
@@ -167,7 +164,7 @@ class CheckoutController extends Controller
$amount = intval(floatval(Yard::instance('shopping')->totalWithShipping(2, '.', ',')) *100);
$reference = $pay->setPrePayment(Input::get('payment_method'), $amount, 'EUR', $cc_ret);
$this->putPayments('payment_reference', $reference);
- $pay->setPersonalData([]);
+ $pay->setPersonalData();
return $pay->ResponseData();
}
@@ -231,127 +228,6 @@ class CheckoutController extends Controller
return view('web.templates.checkout-final', $data);
}
- public function paymentStatus(){
-
- $data = \Request::all();
-
- // test para
-
- $data = [
- 'key' => '698fb2555f8b2efc74f60b2121421f45',
- '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);
- }
-
- if($data['key'] != config('payone.defaults.key')) {
- \Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
- abort(404);
- }
-
- $shopping_order = ShoppingOrder::find($data['param']);
- if(!$shopping_order){
- \Log::channel('payone')->error('PaymentStatus: ShoppingOrder not found: '.json_encode($data));
- abort(404);
- }
-
- $shopping_payment = ShoppingPayment::where('reference', $data['reference'])->first();
- if(!$shopping_payment){
- \Log::channel('payone')->error('PaymentStatus: ShoppingPayment not found: '.json_encode($data));
- abort(404);
- }
-
- if($shopping_payment->shopping_order_id != $shopping_order->id){
- \Log::channel('payone')->error('PaymentStatus: ShoppingPayment no realation ShoppingOrder: '.json_encode($data));
- abort(404);
- }
-
- if($data['key'] != config('payone.defaults.key')) {
- \Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
- abort(404);
- }
-
- $price = intval($data['price']*100);
- if($shopping_payment->amount != $price){
- \Log::channel('payone')->error('PaymentStatus: Price error: '.json_encode($data));
- abort(404);
- }
-
- //create transaction
- PaymentTransaction::create([
- 'shopping_payment_id' => $shopping_payment->id,
- 'request' => 'transaction',
- 'txid' => $data['txid'],
- 'userid' => $data['userid'],
- 'status' => 'PAYONE',
- 'key' => $data['key'],
- 'txaction' => $data['txaction'],
- 'transmitted_data' => $data,
- ]);
-
- $shopping_order->txaction = $data['txaction'];
- $shopping_order->save();
- $shopping_payment->txaction = $data['txaction'];
- $shopping_payment->save();
-
-
- if($data['txaction'] == 'failed'){
-
- }
- 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'){
-
- }
- $billing_email = $shopping_order->shopping_user->billing_email;
- $user_shop_email = $shopping_order->user_shop->user->email;
- if(!$billing_email){
- $billing_email = config('app.checkout_mail');
- }
- $checkout_mail = config('app.checkout_mail');
- if($user_shop_email){
- Mail::to($billing_email)->bcc([$user_shop_email, $checkout_mail])->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment));
- }else{
- Mail::to($billing_email)->bcc($checkout_mail)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment));
- }
- die("ok");
- }
-
private function makeShoppingUser($data){
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
diff --git a/app/Http/Controllers/Web/SiteController.php b/app/Http/Controllers/Web/SiteController.php
index 8c4498d..e890876 100755
--- a/app/Http/Controllers/Web/SiteController.php
+++ b/app/Http/Controllers/Web/SiteController.php
@@ -33,6 +33,9 @@ class SiteController extends Controller
return view('web.index', $data);
}
+ public function domainCheck(){
+ die("checked");
+ }
public function site($site, $subsite = false, $product_slug = false)
{
diff --git a/app/Http/Controllers/WizardController.php b/app/Http/Controllers/WizardController.php
index 38fb98b..d8d9713 100755
--- a/app/Http/Controllers/WizardController.php
+++ b/app/Http/Controllers/WizardController.php
@@ -181,7 +181,7 @@ class WizardController extends Controller
//add to DB
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
- $path = str_replace('http', 'https', $path);
+ //$path = str_replace('http', 'https', $path);
return redirect()->secure($path);
diff --git a/app/Models/UserShop.php b/app/Models/UserShop.php
index cea31c2..94e6dac 100644
--- a/app/Models/UserShop.php
+++ b/app/Models/UserShop.php
@@ -99,6 +99,10 @@ class UserShop extends Model
return FALSE;
}
+ $url = "http://".$this->attributes['slug'].".mivita.care/domain/check";
+ if(@file_get_contents($url) != 'checked'){
+ return FALSE;
+ }
return TRUE;
}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 5ea48d3..7592f33 100755
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -65,9 +65,17 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapApiRoutes()
{
- Route::prefix('api')
+
+ Route::domain('api.'.config('app.domain'))
+ ->middleware('api')
+ ->namespace($this->namespace)
+ ->group(base_path('routes/api.php'));
+
+ //.
+ /* Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
+ */
}
}
diff --git a/app/Services/Yard.php b/app/Services/Yard.php
index 77d17b1..3beaaeb 100644
--- a/app/Services/Yard.php
+++ b/app/Services/Yard.php
@@ -46,7 +46,7 @@ class Yard extends Cart
return config('cart.tax');
}
-
+
public function putShippingExtra($key, $value){
$content = $this->getYContent();
@@ -71,6 +71,14 @@ class Yard extends Cart
}
return "";
}
+ public function getShippingCountryCountryId()
+ {
+ $shippingCountry = ShippingCountry::find($this->shipping_country_id);
+ if($shippingCountry && $shippingCountry->country){
+ return $shippingCountry->country->id;
+ }
+ return 1; //default DE
+ }
public function getShippingCountryId()
{
@@ -86,27 +94,68 @@ class Yard extends Cart
return $this->ysession->get($this->yinstance);
}
+
+ public function reCalculateShippingPrice(){
+ $this->calculateShippingPrice();
+ }
+
public function setShippingCountryWithPrice($shipping_country_id)
{
$this->shipping_country_id = $shipping_country_id;
$this->putShippingExtra('shipping_country_id', $shipping_country_id);
+ $this->calculateShippingPrice();
+
+ }
+
+ private function calculateShippingPrice(){
+
+ $shippingCountry = ShippingCountry::find($this->shipping_country_id);
+ $shipping = $shippingCountry->shipping;
+
+ if(intval($this->weight()) == 0){
+ $price = $shipping->prices->first();
+ $price->price = 0;
+ }else{
+ //first by price
+ $price = $this->shippingPriceByTotal($shipping->prices, floatval($this->total(2, '.', ',')));
+ //sec by weight
+ if(!$price){
+ $price = $this->shippingPriceByWeight($shipping->prices, intval($this->weight()));
- if($shipping_country_id > 0){
- $shippingCountry = ShippingCountry::find($shipping_country_id);
- $shipping = $shippingCountry->shipping;
- if($this->weight() == 0){
- $price = $shipping->prices->first();
- $price->price = 0;
- }else{
- $price = $shipping->prices->first();
}
- if($price){
- $this->shipping = floatval($price->price);
- $this->putShippingExtra('shipping_price', $this->shipping);
+ //default
+ if(!$price){
+ $price = $shipping->prices->first();
}
}
+ if($price){
+ $this->shipping = floatval($price->price);
+ $this->putShippingExtra('shipping_price', $this->shipping);
+ }
}
+ private function shippingPriceByTotal($prices, $total){
+ foreach ($prices as $price){
+ if($price->total_from > 0 && $price->total_to > 0){
+ if($total >= $price->total_from && $total <= $price->total_to){
+ return $price;
+ }
+ }
+ }
+ return false;
+ }
+ private function shippingPriceByWeight($prices, $weight){
+ foreach ($prices as $price){
+ if($price->weight_from > 0 && $price->weight_to > 0){
+ if($weight >= $price->weight_from && $weight <= $price->weight_to){
+ return $price;
+ }
+ }
+ }
+ return false;
+ }
+
+
/**
@@ -169,7 +218,7 @@ class Yard extends Cart
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
- return $total + ($cartItem->options->weight ? intval($cartItem->options->weight) : 0);
+ return $total + ($cartItem->options->weight ? intval($cartItem->options->weight*$cartItem->qty) : 0);
}, 0);
return $total;
diff --git a/config/app.php b/config/app.php
index 20dfa42..a21208f 100755
--- a/config/app.php
+++ b/config/app.php
@@ -52,13 +52,13 @@ return [
|
*/
- 'url' => env('APP_URL', 'mivita.local/'),
- 'domain' => env('APP_DOMAIN', 'https://mivita.local'),
+ 'url' => env('APP_URL', 'https://mivita.local/'),
+ 'domain' => env('APP_DOMAIN', 'mivita.local'),
'protocol' => env('APP_PROTOCOL', 'https://'),
'pre_url_main' => env('APP_URL_MAIN', ''),
- 'pre_url_crm' => env('APP_URL_CRM', 'mein.'),
+ 'pre_url_crm' => env('APP_URL_CRM', 'my.'),
'checkout_url' => env('APP_URL_CHECKOUT', 'checkout.'),
- 'checkout_mail' => env('APP_CHECKOUT_MAIL', 'k.adametz@kagado.de'),
+ 'checkout_mail' => env('APP_CHECKOUT_MAIL', 'no-replay@mivita.care'),
/* 'url_backend' => env('APP_URL', 'http://mivita.local/'),
diff --git a/config/mail.php b/config/mail.php
index 2ad6b89..53c518f 100755
--- a/config/mail.php
+++ b/config/mail.php
@@ -56,7 +56,7 @@ return [
*/
'from' => [
- 'address' => env('MAIL_FROM_ADDRESS', 'support@mivita.care'),
+ 'address' => env('MAIL_FROM_ADDRESS', 'checkout@mivita.care'),
'name' => env('MAIL_FROM_NAME', 'mivita.care'),
],
diff --git a/config/profanity.php b/config/profanity.php
index 1f390ff..f309e72 100644
--- a/config/profanity.php
+++ b/config/profanity.php
@@ -119,7 +119,7 @@ return [
'whore',
'wtf',
'mivita',
- 'aloe',
- 'vera',
+ 'shop',
+ 'myaloe',
],
];
diff --git a/public/.htaccess b/public/.htaccess
index b75525b..8033756 100755
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -5,10 +5,21 @@
RewriteEngine On
+
+
+ #RewriteCond %{HTTPS} off
+ #RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
+ #RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
+
+ #RewriteCond %{HTTPS} on
+ #RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
+ #RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
+
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
diff --git a/resources/lang/de.json b/resources/lang/de.json
index ba5b3e3..5b2bd67 100755
--- a/resources/lang/de.json
+++ b/resources/lang/de.json
@@ -179,12 +179,12 @@
"Choose Your Shop Name" : "Wähle einen einprägsamen Shop-Namen, der zu Dir passt.",
"shop_name_error_1":"Dein Shop-Name darf nur lateinische Buchstaben ohne Akzent sowie Ziffern enthalten, keine Leerzeichen.",
"shop_name_error_2":"Shop-Namen müssen 4 bis 20 Zeichen lang sein.",
- "shop_name_description":"Dein Shop-Name wird in Deinem Shop angezeigt. Aus Deinem Shop-Namen wird die InternetAdresse (Domain) erstellt, mit der Dein Shop aufgerufen werden kann. Der Shop Name ist später nicht mehr änderbar.",
+ "shop_name_description":"Dein Shop-Name wird in Deinem Shop angezeigt. Aus Deinem Shop-Namen wird die Internet-Adresse (Domain) erstellt, mit der Dein Shop aufgerufen werden kann. Wähle Deinen Shop-Namen sorgfältig aus, dieser ist später nur gegen eine Gebühr von 50,- Euro änderbar.",
"save and continue":"speichern und fortfahren",
"shop_title": "Shop Inhaber",
"shop_title_help": "Gib Deinen Namen zum Shop an.",
"shop_contact": "Shop Kontakt",
- "shop_contac_help": "Vervollständige Deine Kontaktdaten die im Shop angezeigt werden.",
+ "shop_contact_help": "Vervollständige Deine Kontaktdaten die im Shop angezeigt werden.",
"shop_accessibility": "Shop Erreichbarkeit",
"shop_accessibility_help": "Gib Deine Erreichbarkeit an.",
"shop_about": "Shop persönlicher Text",
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index 6339cf1..f871fff 100755
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -41,7 +41,6 @@
{{__('Shop nicht gebucht')}}
@endif
-
@endif
diff --git a/resources/views/user/components/user_shop_edit.blade.php b/resources/views/user/components/user_shop_edit.blade.php
index faae53c..86a5138 100644
--- a/resources/views/user/components/user_shop_edit.blade.php
+++ b/resources/views/user/components/user_shop_edit.blade.php
@@ -66,16 +66,18 @@
{{ __('Status') }}
@if($user->shop->getSubdomainStatus())
- {{ __('available') }} DNS
+ {{ __('available') }} DNS
@else
{{ __('not available') }} DNS
@endif
- @if($user->shop->getSubdomainAvailable())
- {{ __('available') }} HTTP
- @else
- {{ __('not available') }} HTTP
- @endif
+ @if($user->shop->getSubdomainAvailable())
+ {{ __('available') }} HTTP
+ @else
+ {{ __('not available') }} HTTP
+ @endif
+
+
@@ -105,22 +107,18 @@
-
+
@include('user.components.user_shop_image')
-
-
-
-
-
- @include('user.components.user_shop_on_site')
-
+
+
+ @include('user.components.user_shop_on_site')
+
-
diff --git a/resources/views/user/components/user_shop_image.blade.php b/resources/views/user/components/user_shop_image.blade.php
index 75c11d0..81c2d09 100755
--- a/resources/views/user/components/user_shop_image.blade.php
+++ b/resources/views/user/components/user_shop_image.blade.php
@@ -21,7 +21,7 @@
@else
diff --git a/resources/views/user/components/user_shop_on_site.blade.php b/resources/views/user/components/user_shop_on_site.blade.php
index 4047d6b..eba9f5f 100755
--- a/resources/views/user/components/user_shop_on_site.blade.php
+++ b/resources/views/user/components/user_shop_on_site.blade.php
@@ -23,18 +23,18 @@
@if(count($user->shop->on_sites) <= 5)
-
+
@foreach($user->shop->on_sites as $image)
@endforeach
-
+
diff --git a/resources/views/user/components/user_shop_register.blade.php b/resources/views/user/components/user_shop_register.blade.php
index 8d5c577..a5c2e1e 100644
--- a/resources/views/user/components/user_shop_register.blade.php
+++ b/resources/views/user/components/user_shop_register.blade.php
@@ -40,9 +40,14 @@
@endif
{{__('shop_name_description')}}
-
+
+ {{ Form::text('preview_user_shop_name', '', array('placeholder'=>__('Vorschau Shop-Internet Adresse'), 'class'=>'form-control', 'id'=>'preview_user_shop_name', 'readonly')) }}
+
+
Hier siehtst du eine Vorschau, wie Deine Shop-Internet Adresse lauten wird.
+
+
-
+
@@ -111,10 +116,13 @@
dataFilter: function(response) {
response = $.parseJSON(response);
console.log(response);
-
- if (response.success === true) return true;
+ if (response.success === true){
+ $('#preview_user_shop_name').val(response.preview_user_shop_name);
+ return true;
+ }
else {
message = response.errors.user_shop_name;
+ $('#preview_user_shop_name').val('');
return false;
}
}
diff --git a/resources/views/user/edit.blade.php b/resources/views/user/edit.blade.php
index e3e50d2..1d4c0a1 100644
--- a/resources/views/user/edit.blade.php
+++ b/resources/views/user/edit.blade.php
@@ -22,8 +22,7 @@
{!! Form::open(['url' => route('user_edit'), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
- @include('user.form')
-
+ @include('user.user_form')
{{ __('back') }}
diff --git a/resources/views/web/templates/checkout.blade.php b/resources/views/web/templates/checkout.blade.php
index 60f328e..ab9420c 100644
--- a/resources/views/web/templates/checkout.blade.php
+++ b/resources/views/web/templates/checkout.blade.php
@@ -224,7 +224,7 @@
-
+
@@ -374,7 +374,7 @@
-
+
@@ -391,7 +391,15 @@
-
zurück zum Warenkorb
+ @if(isset($order_reference))
+
+ zurück zum Shop
+
+ @else
+
+ zurück zum Warenkorb
+
+ @endif
diff --git a/routes/api.php b/routes/api.php
index c641ca5..ebbc2e5 100755
--- a/routes/api.php
+++ b/routes/api.php
@@ -13,6 +13,17 @@ use Illuminate\Http\Request;
|
*/
-Route::middleware('auth:api')->get('/user', function (Request $request) {
- return $request->user();
+//Route::post('login', 'API\UserController@login');
+//Route::post('register', 'API\UserController@register');
+
+
+
+
+
+Route::get('/payment/status', 'Api\PayoneController@paymentStatus')->name('api.payment_status');
+Route::post('/payment/status', 'Api\PayoneController@paymentStatus')->name('api.payment_status');
+ Route::group(['middleware' => 'auth:api'], function(){
+
});
+
+
diff --git a/routes/web.php b/routes/web.php
index 90ad6d7..f759e8c 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -51,6 +51,7 @@ Route::get('/shop/product/image/{slug}', function($slug = null)
})->name('shop_product_image');
+
//main site mivita
Route::domain(config('app.pre_url_main').config('app.domain'))->group(function () {
@@ -74,7 +75,7 @@ Route::domain(config('app.pre_url_main').config('app.domain'))->group(function (
});
-/* ROUTING FOR CRM mein.mivita / CMS*/
+/* ROUTING FOR CRM my.mivita / CMS*/
Route::domain(config('app.pre_url_crm').config('app.domain'))->group(function () {
Auth::routes();
@@ -246,9 +247,6 @@ Route::domain(config('app.pre_url_crm').config('app.domain'))->group(function ()
Route::domain(config('app.checkout_url').config('app.domain'))->group(function () {
- Route::get('/payment/status', 'Web\CheckoutController@paymentStatus')->name('checkout.payment_status');
- Route::post('/payment/status', 'Web\CheckoutController@paymentStatus')->name('checkout.payment_status');
-
Route::group(['middleware' => ['checkout']], function() {
Route::get('/checkout/card/{identifier?}', 'Web\CheckoutController@checkout')->name('checkout.checkout_card');
@@ -281,80 +279,9 @@ Route::domain('{subdomain}.'.config('app.domain'))->group(function () {
Route::get('/card/remove/{rowId}', 'Web\CardController@removeCard')->name('user.card_remove');
Route::get('/card/delete', 'Web\CardController@deleteCard')->name('user.card_delete');
Route::get('/back/to/shop/{reference?}', 'Web\CardController@backToShop')->name('user.back_to_shop');
+ Route::get('/domain/check', 'Web\SiteController@domainCheck')->name('user.domain_check');
Route::get('/{site}/{subsite?}/{product_slug?}', 'Web\SiteController@site')->name('user.site');
});
-});
-
-
-
-
-
-
-
-
-/*
-
-//Route::get('/', 'HomeController@index')->name('/');
-
-/*Route::post('/register/data', 'HomeController@register')->name('register_data');
-Route::post('/user/check/mail', 'HomeController@checkMail')->name('user_check_mail');
-
-Route::get('/register/verify/{confirmationCode}', 'HomeController@verify')->name('register_verify');
-
-Route::get('/status/register', 'HomeController@statusRegister')->name('status_register');
-Route::get('/status/verify', 'HomeController@statusVerify')->name('status_verify');
-Route::get('/status/error', 'HomeController@statusError')->name('status_error');
-
-
-Route::get('/user/update_email_confirm/{token}', 'UpdateEmailController@activateMail')->name('user_update_email_confirm');
-*/
-
-
-
-
-
-/*Route::get('storage/{what}/{path}/{id}/{file_name}', function($what = null, $path = null, $id = null, $file_name = null)
-{
- $path = storage_path().'/app/'.$path.'/'.$id.'/images/'.$what.'/'.$file_name;
- if (file_exists($path)) {
- return Response::file($path);
- }
-});
-
-Route::get('storage/{user_id}/{file_name}', function($user_id = null, $file_name = null)
-{
- $path = storage_path().'/'.'app'.'/user/' . $user_id . '/verification/' . $file_name;
- if (file_exists($path)) {
- return Response::file($path);
- }
-});
-*/
-
-/*
-use App\Mail\MailResetPassword;
-
-Route::get('/send_test_email', function(){
-
- try {
- // Mail::to('kevin.adametz@me.com')->send(new MailResetPassword('asdasd', Auth::user()));
-
- Mail::raw('Sending emails with Mailgun and Laravel is easy!', function($message) {
- $message->to('kevin.adametz@me.com', 'Kevin Adametz');
- $message->subject('testing Networktrips');
- });
-
-
-
- } catch (\Exception $e) {
- dd($e->getMessage());
- }
-
- $fail = Mail::failures();
-
- if(!empty($fail)) throw new \Exception('Could not send message to '.$fail[0]);
-
- });
-
-*/
\ No newline at end of file
+});
\ No newline at end of file