promotion 1.0
This commit is contained in:
parent
1cc8e025a1
commit
570d428b1c
60 changed files with 1596 additions and 272 deletions
|
|
@ -265,7 +265,7 @@ class ShoppingUserController extends Controller
|
|||
$shopping_user = ShoppingUser::create($data);
|
||||
|
||||
//Kundenhoheit prüfen
|
||||
$priority = CustomerPriority::checkOne($shopping_user, true, false);
|
||||
$priority = CustomerPriority::checkOne($shopping_user, true, false, true);
|
||||
\App\Services\Shop::newUserOrder($shopping_user->number);
|
||||
//exists //like //update
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class PayController extends Controller
|
|||
|
||||
private $reference;
|
||||
|
||||
private $payment_method;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
|
@ -77,6 +79,7 @@ class PayController extends Controller
|
|||
public function setPrePayment($payment_method, $amount, $currency, $ret = []){
|
||||
|
||||
$this->reference = $this->shopping_order->created_at->format('Ym').$this->shopping_order->id;//substr(uniqid('m', false), 0, 16);
|
||||
$this->payment_method = $payment_method;
|
||||
$this->setMethod($payment_method, $ret);
|
||||
|
||||
$this->prepayment = [
|
||||
|
|
@ -86,7 +89,6 @@ class PayController extends Controller
|
|||
"param" => $this->shopping_order->id,
|
||||
|
||||
];
|
||||
|
||||
$this->shopping_payment = ShoppingPayment::create([
|
||||
'shopping_order_id' => $this->shopping_order->id,
|
||||
'clearingtype' => $this->method["clearingtype"],
|
||||
|
|
@ -119,6 +121,15 @@ class PayController extends Controller
|
|||
private function setMethod($payment_method, $ret = []){
|
||||
|
||||
//vorkasse
|
||||
if($payment_method === 'non'){
|
||||
$this->method = [
|
||||
"clearingtype" => "non",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "authorization",
|
||||
];
|
||||
}
|
||||
|
||||
if($payment_method === 'vor'){
|
||||
$this->method = [
|
||||
"clearingtype" => "vor",
|
||||
|
|
@ -138,12 +149,21 @@ class PayController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
//Rechnungskauf
|
||||
if($payment_method === 'pp'){
|
||||
$this->method = [
|
||||
"clearingtype" => "pp",
|
||||
"wallettype" => "",
|
||||
'onlinebanktransfertype' => "",
|
||||
"request" => "CAPTURE",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function ResponseData($identifier){
|
||||
public function ResponseData($identifier, $payment_for = false){
|
||||
|
||||
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->urls);
|
||||
//RECHNUNG MIV
|
||||
|
||||
$payt = PaymentTransaction::create([
|
||||
'shopping_payment_id' => $this->shopping_payment->id,
|
||||
|
|
@ -155,10 +175,26 @@ class PayController extends Controller
|
|||
'txaction' => 'prev',
|
||||
'mode' => $this->shopping_payment->mode,
|
||||
]);
|
||||
//paypal
|
||||
if($this->payment_method === 'pp'){
|
||||
$paypal = new PayPalController;
|
||||
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $this->shopping_order->promotion_user_id);
|
||||
Util::setUserHistoryValue(['status'=>4], $identifier);
|
||||
return $redirect;
|
||||
|
||||
}
|
||||
|
||||
Util::setUserHistoryValue(['status'=>5], $identifier);
|
||||
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
|
||||
switch ($payment_for) {
|
||||
case 4: //promotion
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $this->shopping_order->promotion_user_id, $payt->id, $this->reference, $identifier]));
|
||||
break;
|
||||
|
||||
default:
|
||||
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
95
app/Http/Controllers/Pay/PayPalController.php
Normal file
95
app/Http/Controllers/Pay/PayPalController.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Pay;
|
||||
use Request;
|
||||
use App\Models\PromotionUser;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Srmklive\PayPal\Services\PayPal as PayPalClient;
|
||||
|
||||
|
||||
class PayPalController extends Controller
|
||||
{
|
||||
|
||||
public function payment($shopping_payment, $payt, $identifier, $promotion_user_id)
|
||||
{
|
||||
$provider = new PayPalClient;
|
||||
// Through facade. No need to import namespaces
|
||||
|
||||
$provider = \PayPal::setProvider();
|
||||
$provider->setApiCredentials(config('paypal'));
|
||||
$provider->setAccessToken($provider->getAccessToken());
|
||||
$provider->setCurrency('EUR');
|
||||
|
||||
$order = $provider->createOrder([
|
||||
"intent"=> "CAPTURE",
|
||||
"purchase_units"=> [
|
||||
[
|
||||
"reference_id" => $shopping_payment->reference,
|
||||
"shopping_order_id" => $shopping_payment->shopping_order_id,
|
||||
"amount"=> [
|
||||
"currency_code"=> "USD",
|
||||
"value"=> ($shopping_payment->amount / 100)
|
||||
],
|
||||
'description' => 'test'
|
||||
]
|
||||
],
|
||||
'application_context' => [
|
||||
'cancel_url' => route('cancel.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier]),
|
||||
'return_url' => route('success.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier])
|
||||
]
|
||||
|
||||
]);
|
||||
$payt->key = $order['id'];
|
||||
$payt->save();
|
||||
return redirect($order['links'][1]['href'])->send();
|
||||
|
||||
}
|
||||
|
||||
public function paymentSuccess($id, $transactionId=false, $reference=false, $identifier=false)
|
||||
{
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
$payt = PaymentTransaction::findOrFail($transactionId);
|
||||
if($payt->shopping_payment->reference != $reference){
|
||||
abort(404);
|
||||
}
|
||||
// Init PayPal
|
||||
$provider = \PayPal::setProvider();
|
||||
$provider->setApiCredentials(config('paypal'));
|
||||
$provider->setAccessToken($provider->getAccessToken());
|
||||
|
||||
// Get PaymentOrder using our transaction ID
|
||||
$order = $provider->capturePaymentOrder($payt->key);
|
||||
if(isset($order['type'])){
|
||||
abort(403, 'PayPal Type: '.$order['type']);
|
||||
}
|
||||
|
||||
if(!isset($order['status']) || $order['status'] !== "COMPLETED"){
|
||||
abort(403, 'Error: Order Status ');
|
||||
}
|
||||
|
||||
if(Request::get('token') !== $payt->key){
|
||||
abort(403, 'Error: PayPal token');
|
||||
}
|
||||
$payt->request = $order['status'];
|
||||
$payt->save();
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
|
||||
|
||||
}
|
||||
|
||||
public function paymentCancel($id, $transactionId=false, $reference=false, $identifier=false)
|
||||
{
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
|
||||
return redirect(url($PromotionUser->url));
|
||||
dd('Your payment has been declend. The payment cancelation page goes here!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -224,8 +224,8 @@ class SalesController extends Controller
|
|||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'hp'){
|
||||
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
|
||||
if($ShoppingOrder->shopping_user->is_for === 'pr'){
|
||||
return '<span class="badge badge-pill badge-dark">Promotion</span>';
|
||||
}
|
||||
return '-';
|
||||
})
|
||||
|
|
@ -249,6 +249,7 @@ class SalesController extends Controller
|
|||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('is_for', 'is_for $1')
|
||||
->orderColumn('member_id', 'member_id $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ class CheckoutController extends Controller
|
|||
$shopping_user->billing_state = Shop::getCountryShippingCountryId($shopping_user->billing_country_id);
|
||||
$shopping_user->shipping_state = Shop::getCountryShippingCountryId($shopping_user->shipping_country_id);
|
||||
$shopping_user->same_as_billing = $shopping_user->same_as_billing ? false : true; //reinvert
|
||||
|
||||
}
|
||||
if($shopping_user->same_as_billing === NULL){
|
||||
$shopping_user->same_as_billing = false;
|
||||
|
|
@ -518,6 +517,7 @@ class CheckoutController extends Controller
|
|||
$this->putPayments('shopping_order_margin_id', $shopping_order_margin->id);
|
||||
}
|
||||
}
|
||||
|
||||
private function putPayments($key, $value){
|
||||
$content = $this->getContent();
|
||||
$content->put($key, $value);
|
||||
|
|
@ -581,8 +581,6 @@ class CheckoutController extends Controller
|
|||
];
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -45,10 +45,12 @@ class PaymentController extends Controller
|
|||
->addColumn('message', function (UserPayCredit $user_pay_credit) {
|
||||
if($user_pay_credit->status === 3){
|
||||
return nl2br($user_pay_credit->message);
|
||||
}elseif($user_pay_credit->status === 5 || $user_pay_credit->status === 6){
|
||||
return trans('payment.'.$user_pay_credit->message).
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_sales_order_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
}else{
|
||||
return trans('payment.'.$user_pay_credit->message).
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_order_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
|
||||
}
|
||||
})
|
||||
->addColumn('credit', function (UserPayCredit $user_pay_credit) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ class PromotionController extends Controller
|
|||
if($user_promotion->user_id != Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
$user_promotion->about_you = !$user_promotion->about_you ? $user_promotion->user->account->about_you : $user_promotion->about_you;
|
||||
|
||||
$user_promotion->description = $user_promotion->description ? $user_promotion->description : $user_promotion->promotion_admin->user_description;
|
||||
$about_you = $user_promotion->user->account->about_you ?$user_promotion->user->account->about_you : $user_promotion->promotion_admin->user_about;
|
||||
$user_promotion->about_you = $user_promotion->about_you ? $user_promotion->about_you : $about_you;
|
||||
$data = [
|
||||
'checkPaymentCredit' => $user_promotion->checkPaymentCredit(),
|
||||
'user_promotion_cart' => PromotionUser::preCalculateCart($user_promotion, 'user_promotion'),
|
||||
|
|
@ -66,7 +69,6 @@ class PromotionController extends Controller
|
|||
return redirect(route('user_promotion_detail', [$id]))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$model = $this->promoRepo->update($id, Request::all());
|
||||
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('user_promotion_detail', [$model->id]));
|
||||
|
|
|
|||
84
app/Http/Controllers/User/SalesController.php
Executable file
84
app/Http/Controllers/User/SalesController.php
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\Payment;
|
||||
use App\User;
|
||||
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.account');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('user.sales.orders', $data);
|
||||
}
|
||||
|
||||
public function orderDetail($id)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
'shopping_order' => $shopping_order,
|
||||
'isAdmin' => false,
|
||||
];
|
||||
return view('user.sales.order_detail', $data);
|
||||
}
|
||||
|
||||
public function ordersDatatable(){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->select('shopping_orders.*')->where('shopping_orders.member_id', $user->id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('user_sales_order_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->created_at->format("d.m.Y");
|
||||
})
|
||||
->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
|
||||
return Payment::getShoppingOrderBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getFormattedTotalShipping();
|
||||
})
|
||||
->addColumn('orders', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
})
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
|
||||
})
|
||||
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->shopping_user->is_for === 'me'){
|
||||
return '<span class="badge badge-pill badge-secondary">Vertriebspartnerbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'ot'){
|
||||
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user->is_for === 'pr'){
|
||||
return '<span class="badge badge-pill badge-dark">Promotion</span>';
|
||||
}
|
||||
return '-';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->rawColumns(['id', 'is_for', 'txaction', 'user_shop_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ use App\Services\Payment;
|
|||
use App\User;
|
||||
|
||||
|
||||
class ShopSalesController extends Controller
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
|
|
|||
|
|
@ -2,16 +2,22 @@
|
|||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use Yard;
|
||||
use Request;
|
||||
use Response;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\PromotionUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Services\PromotionCart;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\CheckoutRepository;
|
||||
use App\Services\Payment;
|
||||
|
||||
class PromotionController extends Controller
|
||||
{
|
||||
|
|
@ -47,9 +53,8 @@ class PromotionController extends Controller
|
|||
return view('web.promotion.index', $data);
|
||||
}
|
||||
|
||||
public function goto($load, $id){
|
||||
public function goto($load, $id, $transactionId=false, $reference=false, $identifier=false){
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
|
||||
$data = [
|
||||
'promotion_user' => $PromotionUser,
|
||||
];
|
||||
|
|
@ -57,15 +62,29 @@ class PromotionController extends Controller
|
|||
if($load === 'thanksreminder'){
|
||||
return view('web.promotion.thanksreminder', $data);
|
||||
}
|
||||
if($load === 'thanksorder'){
|
||||
return view('web.promotion.thanksorder', $data);
|
||||
}
|
||||
if($load === 'notactive'){
|
||||
return view('web.promotion.notactive', $data);
|
||||
}
|
||||
if($load === 'thanksorder'){
|
||||
$payt = PaymentTransaction::findOrFail($transactionId);
|
||||
if($payt->shopping_payment->reference != $reference){
|
||||
abort(404);
|
||||
}
|
||||
Yard::instance('shopping')->destroy();
|
||||
$checkRepo = new CheckoutRepository();
|
||||
$checkRepo->destroy();
|
||||
if(($payt->status === 'fnc' || $payt->status === 'vor' || $payt->status === 'pp' || $payt->status === 'non') && $payt->txaction === 'prev'){
|
||||
$this->directPaymentStatus($payt, $identifier);
|
||||
}
|
||||
$data = [
|
||||
'promotion_user' => $PromotionUser,
|
||||
'order_reference' => $payt->shopping_payment->reference,
|
||||
'pay_trans' => $payt,
|
||||
];
|
||||
return view('web.promotion.thanksorder', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function store($id){
|
||||
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
|
|
@ -78,13 +97,106 @@ class PromotionController extends Controller
|
|||
return redirect(route('web_promotion_goto', ['thanksreminder', $PromotionUser->id]));
|
||||
|
||||
}
|
||||
|
||||
if($data['action'] === 'submit-promotion-order'){
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $PromotionUser->id]));
|
||||
$rules = array(
|
||||
'billing_firstname'=>'required',
|
||||
'billing_lastname'=>'required',
|
||||
'billing_address'=>'required',
|
||||
'billing_zipcode'=>'required',
|
||||
'billing_city' => 'required',
|
||||
'billing_state' => 'required',
|
||||
'billing_email'=>'required|email',
|
||||
);
|
||||
|
||||
if(Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
'shipping_address'=>'required',
|
||||
'shipping_zipcode'=>'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required'
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$identifier = Util::getToken();
|
||||
$data['is_from'] = 'shopping';
|
||||
$data['is_for'] = 'pr';
|
||||
unset($data['_token']);
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
|
||||
UserHistory::create(['user_id' => $PromotionUser->user_id, 'action'=>'web_promotion_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier]);
|
||||
$checkRepo = new CheckoutRepository();
|
||||
$checkRepo->setPromotion(4, $PromotionUser);
|
||||
$checkRepo->init($identifier, $data);
|
||||
return $checkRepo->makePayment();
|
||||
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
//return redirect()->secure($path);
|
||||
// return redirect(route('user_checkout', [$identifier]));
|
||||
|
||||
}
|
||||
|
||||
dd($PromotionUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function directPaymentStatus(PaymentTransaction $payt, $identifier){
|
||||
|
||||
if(isset($payt->transmitted_data['param'])){
|
||||
$shopping_order = ShoppingOrder::find($payt->transmitted_data['param']);
|
||||
$shopping_payment = ShoppingPayment::where('reference', $payt->transmitted_data['reference'])->first();
|
||||
|
||||
$shopping_order->txaction = 'open';
|
||||
$shopping_order->save();
|
||||
$payt->txaction = "open";
|
||||
|
||||
//is Promotion Handel it
|
||||
if($shopping_order->promotion_user_id > 0){
|
||||
Payment::handelPromotionProduct($shopping_order);
|
||||
}
|
||||
if($shopping_payment){
|
||||
//Payment::handelUserPayCredits($shopping_order, 'deduction');
|
||||
if($payt->status === 'vor'){
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
$payt->txaction = "open";
|
||||
}
|
||||
if($payt->status === 'pp'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
}
|
||||
if($payt->status === 'fnc'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
$payt->txaction = "open";
|
||||
}
|
||||
if($payt->status === 'non'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
\App\Services\Shop::newUserOrder($shopping_order->shopping_user->number);
|
||||
}
|
||||
$shopping_payment->save();
|
||||
}
|
||||
$payt->save();
|
||||
$data = [
|
||||
'mode' => $payt->transmitted_data['mode'],
|
||||
'txaction' => $payt->txaction,
|
||||
'send_link' => false,
|
||||
];
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function load(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
|
|
@ -94,32 +206,36 @@ class PromotionController extends Controller
|
|||
$product = Product::find($data['id']); //current user form order
|
||||
$ret = view("web.promotion.show_product", compact('product', 'data'))->render();
|
||||
}
|
||||
if($data['action'] === 'switch-free-product'){
|
||||
\App\Services\PromotionCart::updateFeeProduct($data);
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
if($data['perform']){
|
||||
if($data['action'] === 'switch-free-product'){
|
||||
\App\Services\PromotionCart::updateFeeProduct($data);
|
||||
}
|
||||
if($data['action'] === 'add-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data, true);
|
||||
}
|
||||
if($data['action'] === 'update-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data);
|
||||
}
|
||||
if($data['action'] === 'remove-shop-product'){
|
||||
\App\Services\PromotionCart::updateProduct($data);
|
||||
$data['qty'] = 0;
|
||||
}
|
||||
if($data['action'] === 'clear-cart'){
|
||||
\App\Services\PromotionCart::clearCart($data);
|
||||
}
|
||||
if($data['action'] === 'switch-shipping'){
|
||||
\App\Services\PromotionCart::switchShipping($data);
|
||||
}
|
||||
$cart = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
if(Yard::instance('shopping')->isQuickShipping()){
|
||||
$invoice = view("web.promotion._invoice_details_quick")->render();
|
||||
}else{
|
||||
$invoice = view("web.promotion._invoice_details")->render();
|
||||
}
|
||||
$checkout = view("web.promotion._checkout")->render();
|
||||
|
||||
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status]);
|
||||
}
|
||||
if($data['action'] === 'add-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data, true);
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
}
|
||||
if($data['action'] === 'update-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data);
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
}
|
||||
if($data['action'] === 'remove-shop-product'){
|
||||
\App\Services\PromotionCart::updateProduct($data);
|
||||
$data['qty'] = 0;
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
}
|
||||
if($data['action'] === 'clear-cart'){
|
||||
\App\Services\PromotionCart::clearCart($data);
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === 'switch-shipping'){
|
||||
$ret = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
}
|
||||
|
||||
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue