membership register
This commit is contained in:
parent
3711fcc8d0
commit
37cb2b06c7
38 changed files with 1261 additions and 463 deletions
|
|
@ -10,6 +10,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 Validator;
|
||||
|
|
@ -43,12 +44,9 @@ class CheckoutController extends Controller
|
|||
// $ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
// $selected_country = $ShippingCountry->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;
|
||||
|
|
@ -74,6 +72,7 @@ class CheckoutController extends Controller
|
|||
$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->abo_options = $user->abo_options;
|
||||
$shopping_user->save();
|
||||
$this->putPayments('shopping_user_id', $shopping_user->id);
|
||||
|
||||
|
|
@ -200,6 +199,9 @@ class CheckoutController extends Controller
|
|||
$ret['elv']['iban'] = $data['elv_iban'];
|
||||
$ret['elv']['bic'] = $data['elv_bic'];
|
||||
$ret['elv']['bankaccountholder'] = $data['elv_bankaccountholder'];
|
||||
//check abo and save the mandate
|
||||
$this->storeUserPaymentsData($shopping_user, $ret);
|
||||
|
||||
}
|
||||
//other
|
||||
$pay = new PayoneController();
|
||||
|
|
@ -271,6 +273,18 @@ class CheckoutController extends Controller
|
|||
return view('web.templates.checkout-final', $data);
|
||||
}
|
||||
|
||||
private function storeUserPaymentsData($shopping_user, $ret){
|
||||
if($shopping_user->auth_user_id){
|
||||
$user = User::find($shopping_user->auth_user_id);
|
||||
if($user && $user->account && $user->abo_options){
|
||||
if(isset($ret['elv']) && is_array($ret['elv'])){
|
||||
$user->account->payment_data = $ret['elv'];
|
||||
$user->account->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function makeShoppingUser($data){
|
||||
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
|
|
@ -365,6 +379,7 @@ class CheckoutController extends Controller
|
|||
$this->session->put($this->instance, $content);
|
||||
|
||||
}
|
||||
|
||||
private function getPayments($key){
|
||||
$content = $this->getContent();
|
||||
if ($content->has($key)){
|
||||
|
|
@ -372,6 +387,7 @@ class CheckoutController extends Controller
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getContent()
|
||||
{
|
||||
if (is_null($this->session->get($this->instance))) {
|
||||
|
|
@ -380,7 +396,6 @@ class CheckoutController extends Controller
|
|||
return $this->session->get($this->instance);
|
||||
}
|
||||
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
$this->session->remove($this->instance);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue