Homeparty online, Cron SEPA
This commit is contained in:
parent
13fb2cfe98
commit
36872100c6
41 changed files with 1140 additions and 189 deletions
|
|
@ -7,6 +7,7 @@ use App\Mail\MailVerifyAccount;
|
|||
use App\Models\UserHistory;
|
||||
use App\Models\UserMessage;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\PaymentHelper;
|
||||
use App\User;
|
||||
use Carbon;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
|
@ -104,14 +105,39 @@ class CronController extends Controller
|
|||
dump($user->email." | ".$user->getPaymentAccountDateFormat());
|
||||
die();*/
|
||||
foreach ($users as $user){
|
||||
$this->checkReminderPayments($user);
|
||||
/*dump($user->daysActiveAccount());
|
||||
dump($user->email." | ".$user->getPaymentAccountDateFormat());
|
||||
dump('-------------------');*/
|
||||
// $this->checkReminderPayments($user);
|
||||
$this->userInitAboPayment($user);
|
||||
}
|
||||
return "TOSK";
|
||||
}
|
||||
|
||||
private function userInitAboPayment(User $user){
|
||||
if(!$user->isAcountAboPayDate()){
|
||||
return false;
|
||||
}
|
||||
//user has a open Abo Payment
|
||||
if($this->checkIsAboPaymentOpen($user)){
|
||||
return false;
|
||||
}
|
||||
if($user->payment_order_product){
|
||||
$this->buyProductAboPayment($user, $user->payment_order_product);
|
||||
}
|
||||
/*dump($user->daysActiveAccount());
|
||||
dump($user->email." | ".$user->getPaymentAccountDateFormat());
|
||||
dump('-------------------');*/
|
||||
}
|
||||
|
||||
private function checkIsAboPaymentOpen(User $user){
|
||||
$isOpen = UserHistory::whereUserId($user->id)
|
||||
->whereAction('abo_open_payment')
|
||||
->whereIdentifier($user->payment_account)
|
||||
->where('status', '>=', 1) //open //error // payment
|
||||
->get()->last();
|
||||
if($isOpen){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkReminderPayments(User $user){
|
||||
|
||||
|
|
@ -158,7 +184,6 @@ class CronController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private function checkIsReminderSend(User $user, $status){
|
||||
|
||||
$isSend = UserHistory::whereUserId($user->id)
|
||||
|
|
@ -237,4 +262,11 @@ class CronController extends Controller
|
|||
return 1;
|
||||
}
|
||||
|
||||
private function buyProductAboPayment($user, $product){
|
||||
$paymentHelper = new PaymentHelper();
|
||||
$paymentHelper->setProduct($product);
|
||||
$paymentHelper->initELVPayment($user);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue