User Order all Margins / Checkout

This commit is contained in:
Kevin Adametz 2021-01-22 15:54:51 +01:00
parent a96d7d5c77
commit 224bf9e951
92 changed files with 3551 additions and 561 deletions

View file

@ -141,6 +141,21 @@ class Payment
}
}
//if the order has action
if($shopping_order->shopping_user->is_from === 'user_order'){
//is margin -> set paid
$shopping_order->shopping_order_margin->paid = true;
$shopping_order->shopping_order_margin->save();
//is payment credit, reduce
if($shopping_order->shopping_order_margin->from_payment_credit > 0){
$new_credit = $shopping_order->auth_user->payment_credit - $shopping_order->shopping_order_margin->from_payment_credit;
$new_credit = $new_credit < 0 ? 0 : $new_credit;
$shopping_order->auth_user->payment_credit = $new_credit;
$shopping_order->auth_user->save();
}
}
return $send_link;
}