Membership

This commit is contained in:
Kevin Adametz 2020-03-07 19:44:58 +01:00
parent 37cb2b06c7
commit 21abafb8db
51 changed files with 1549 additions and 493 deletions

View file

@ -72,13 +72,16 @@ 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);
}else{
$shopping_user = ShoppingUser::findOrNew($this->getPayments('shopping_user_id'));
}
if(Util::getAuthUser()){
$shopping_user->abo_options = Util::getUserHistoryValue('abo_options');
$shopping_user->save();
}
if($shopping_user->same_as_billing === NULL){
$shopping_user->same_as_billing = true;
}
@ -91,7 +94,6 @@ class CheckoutController extends Controller
public function checkoutFinal(){
$rules = array(
'billing_salutation' => 'required',
'billing_firstname'=>'required',
@ -124,6 +126,7 @@ class CheckoutController extends Controller
$shopping_user = $this->makeShoppingUser($data);
//make Order and Items
$shopping_order = $this->makeShoppingOrder($shopping_user);
Util::setUserHistoryValue(['status'=>2, 'shopping_order_id'=>$shopping_order->id]);
//check credit Card
if(Input::get('payment_method')){
@ -183,7 +186,6 @@ class CheckoutController extends Controller
\Session::flash('elv-creditor_identifier', $ret['elv']['creditor_identifier']);
return redirect(route('checkout.checkout_card'))->withInput(Input::all());
/*
* array(4) { ["status"]=> string(5) "VALID" ["pseudocardpan"]=> string(19) "9410010000169020567" ["cardtype"]=> string(1) "V" ["truncatedcardpan"]=> string(16) "411111XXXXXX1111" }
* application through http post
@ -224,6 +226,8 @@ class CheckoutController extends Controller
$ShoppingPayment = ShoppingPayment::where('shopping_order_id', $shopping_order_id)->where('reference', $reference)->first();
if(!$ShoppingPayment){
//TODO log this
Util::setUserHistoryValue(['status'=>21]);
\Session::flash('checkout-error', 'Der Zahlungsvorgang konnte nicht abgeschlossen werden, die Zahlung wurde nicht gefunden: '.$reference);
return redirect(route('checkout.checkout_card'));
}
@ -245,11 +249,13 @@ class CheckoutController extends Controller
return view('web.templates.checkout-final', $data);
}
if($status === "cancel"){
Util::setUserHistoryValue(['status'=>22]);
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
return redirect(route('checkout.checkout_card'));
}
if($status === "error"){
Util::setUserHistoryValue(['status'=>23]);
\Session::flash('checkout-error', 'Der Zahlungsvorgang wurde abgebrochen, die Bestellung konnte nicht ausgeführt werden.');
return redirect(route('checkout.checkout_card'));
@ -276,7 +282,7 @@ class CheckoutController extends Controller
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($user && $user->account && $shopping_user->abo_options){
if(isset($ret['elv']) && is_array($ret['elv'])){
$user->account->payment_data = $ret['elv'];
$user->account->save();
@ -308,7 +314,6 @@ class CheckoutController extends Controller
private function makeShoppingOrder($shopping_user){
$user_shop = Util::getUserShop();
$data = [
@ -316,6 +321,7 @@ class CheckoutController extends Controller
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ','),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'subtotal' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ','),