This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -5,6 +5,7 @@ namespace App\Services;
use App\User;
use App\Models\UserLevel;
use App\Mail\MailCheckout;
use App\Services\UserUtil;
use App\Models\ProductBuying;
use App\Models\ShoppingOrder;
use App\Models\UserCreditItem;
@ -18,52 +19,52 @@ class Payment
{
public static $txaction_text = [
'paid' => "bezahlt",
'appointed' => "offen",
'failed' => "abbruch",
'extern' => "offen", //offen
'extern_paid' => "bezahlt",
'invoice_open' => "offen",
'invoice_paid' => "bezahlt",
'invoice_non' => "keine Zahlung",
'NULL' => 'keine Zahlung',
'paid' => 'paid',
'appointed' => 'open',
'failed' => 'failed',
'extern' => 'open', //offen
'extern_paid' => 'paid',
'invoice_open' => 'open',
'invoice_paid' => 'paid',
'invoice_non' => 'no_payment',
'NULL' => 'no_payment',
];
public static $txaction_filter_text = [
'paid' => "Zahlung bezahlt",
'appointed' => "Zahlung offen",
'failed' => "Zahlung abbruch",
'extern' => "Extern offen", //offen
'extern_paid' => "Extern bezahlt",
'invoice_open' => "Rechnung offen",
'invoice_paid' => "Rechnung bezahlt",
'invoice_non' => "Rechnung keine Zahlung",
'NULL' => 'keine Zahlung',
'paid' => 'paymend_paid',
'appointed' => 'paymend_open',
'failed' => 'paymend_failed',
'extern' => 'extern_open', //offen
'extern_paid' => 'extern_paid',
'invoice_open' => 'invoice_open',
'invoice_paid' => 'invoice_paid',
'invoice_non' => 'invoice_no_payment',
'NULL' => 'no_payment',
];
public static $txaction_invoice = [
'invoice_open' => "Rechnung offen",
'invoice_paid' => "Rechnung bezahlt",
'invoice_non' => 'keine Zahlung',
'invoice_open' => 'invoice_open',
'invoice_paid' => 'invoice_paid',
'invoice_non' => 'no_payment',
];
public static $txaction_color = [
'paid' => "success",
'appointed' => "warning",
'failed' => "danger",
'extern' => "warning",
'extern_paid' => "success",
'invoice_open' => "warning",
'invoice_paid' => "success",
'invoice_non' => "failed",
'paid' => 'success',
'appointed' => 'warning',
'failed' => 'danger',
'extern' => 'warning',
'extern_paid' => 'success',
'invoice_open' => 'warning',
'invoice_paid' => 'success',
'invoice_non' => 'failed',
];
public static function getFormattedTxaction($txaction){
if($txaction && isset(self::$txaction_text[$txaction])){
return self::$txaction_text[$txaction];
return __('payment.'.self::$txaction_text[$txaction]);
}
return self::$txaction_text['NULL'];
return __('payment.'.self::$txaction_text['NULL']);
}
public static function getFormattedTxactionColor($txaction){
@ -73,6 +74,22 @@ class Payment
return "warning";
}
public static function getTransTxactionFilterText(){
$ret = [];
foreach(self::$txaction_filter_text as $key=>$val){
$ret[$key] = trans('payment.'.$val);
}
return $ret;
}
public static function getTransTxactionInvoice(){
$ret = [];
foreach(self::$txaction_invoice as $key=>$val){
$ret[$key] = trans('payment.'.$val);
}
return $ret;
}
public static function getShoppingOrderBadge(ShoppingOrder $shopping_order){
if($shopping_order->mode === 'test'){
return '<span class="badge badge-pill badge-default">'.strtoupper($shopping_order->mode).' - '.self::getFormattedTxaction($shopping_order->txaction).'</span>';
@ -95,6 +112,8 @@ class Payment
'user_id' => $user->id,
'credit' => $credit,
'message' => $message,
'from_month' => date('n'),
'from_year' => date('Y'),
'status' => $status,
]);
}
@ -171,6 +190,14 @@ class Payment
$user->payment_order_id = $shopping_order_item->product->id; //34
$user->payment_account = $date;
$user->wizard = 100;
//only date is > now and acount is deactive.
if($date > \Carbon::now()){
if($user->active === 0){
$user->active = true;
UserUtil::reactiveUserResetChilds($user->id, 'on payment_for_account Payment');
}
}
$shopping_order->setUserHistoryValue(['status' => 9]);
}
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop'){
@ -210,7 +237,6 @@ class Payment
}
//make Invoice and
$invoice_repo = new InvoiceRepository($shopping_order);
if(!$shopping_order->isInvoice()){
$invoice_repo->createAndSalesVolume();
@ -237,6 +263,6 @@ class Payment
if(!$shopping_order->shopping_user->is_like && $shopping_order->shopping_user->member){
$bcc[] = $shopping_order->shopping_user->member->email;
}
Mail::to($billing_email)->bcc($bcc)->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $data['send_link'], $data['mode']));
Mail::to($billing_email)->bcc($bcc)->locale($shopping_order->getLocale())->send(new MailCheckout($data['txaction'], $shopping_order, $shopping_payment, $data['send_link'], $data['mode']));
}
}