Next Member Shopping
This commit is contained in:
parent
fb27009339
commit
16fe2fa363
23 changed files with 619 additions and 334 deletions
|
|
@ -8,6 +8,7 @@ use App\Mail\MailCheckout;
|
|||
use App\Models\PaymentTransaction;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Services\Payment;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
|
|
@ -137,76 +138,10 @@ class PayoneController extends Controller
|
|||
}
|
||||
|
||||
if($data['txaction'] === 'paid'){
|
||||
$shopping_order->setUserHistoryValue(['status' => 8]);
|
||||
Shop::userOrders();
|
||||
$shopping_order->paid = true;
|
||||
$shopping_order->save();
|
||||
|
||||
//if product has actions
|
||||
if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
|
||||
foreach($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product){
|
||||
if($shopping_order_item->product->action){
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
$user->save();
|
||||
$send_link = true;
|
||||
|
||||
//new date
|
||||
$date = \Carbon::now()->modify('1 year');
|
||||
if($user->payment_account && $user->daysActiveAccount()>0){
|
||||
$date = \Carbon::parse($user->payment_account)->modify('1 year');
|
||||
}
|
||||
foreach ($shopping_order_item->product->action as $do){
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_account'){
|
||||
$user->payment_order_id = $shopping_order_item->product->id; //34
|
||||
$user->payment_account = $date;
|
||||
$user->wizard = 100;
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop'){
|
||||
$user->payment_order_id = $shopping_order_item->product->id; //35
|
||||
$user->payment_shop = $date;
|
||||
$user->wizard = 100;
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_shop_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
$user->payment_order_id = $shopping_order_item->product->upgrade_to_id;
|
||||
}
|
||||
$user->payment_shop = $user->payment_account; //same Date, is upgrade
|
||||
$shopping_order->setUserHistoryValue(['status' => 9]);
|
||||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_lead_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
$user->m_level = $shopping_order_item->product->upgrade_to_id;
|
||||
}
|
||||
}
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
}
|
||||
$bcc = [];
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
if(!$billing_email){
|
||||
if($data['mode'] === 'test'){
|
||||
$billing_email = config('app.checkout_test_mail');
|
||||
}else{
|
||||
$billing_email = config('app.checkout_mail');
|
||||
}
|
||||
}
|
||||
if($data['mode'] === 'test'){
|
||||
$bcc[] = config('app.checkout_test_mail');
|
||||
}else{
|
||||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
|
||||
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, $send_link, $data['mode']));
|
||||
$data['send_link'] = $send_link;
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
print("TSOK");
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue