updated
This commit is contained in:
@@ -30,7 +30,7 @@ class PaypalController extends Controller
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$paypal_env = "live";
|
||||
$paypal_env = "sandbox";
|
||||
$paypal_apiUrl = 'https://api.paypal.com'; // default
|
||||
|
||||
if ($paypal_env == 'live') {
|
||||
@@ -240,7 +240,7 @@ class PaypalController extends Controller
|
||||
$transaction->setInvoiceNumber(date('Ymd') . '-' . $invoice_num);
|
||||
|
||||
$redirectUrls = PayPal::RedirectUrls();
|
||||
$redirectUrls->setReturnUrl(route('getDone'));
|
||||
$redirectUrls->setReturnUrl(route('thank-you-for-your-purchase'));
|
||||
$redirectUrls->setCancelUrl(route('getCancel'));
|
||||
// var_dump($shippingAddress)
|
||||
|
||||
@@ -290,7 +290,7 @@ class PaypalController extends Controller
|
||||
$m = new TeamStoreModel;
|
||||
$UserModel = new UserModel;
|
||||
$userId = 0;
|
||||
|
||||
|
||||
if (!Auth::guest()) {
|
||||
$userId = Auth::user()->id;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ class PaypalController extends Controller
|
||||
}
|
||||
// var_dump($item->ShippingCostId);
|
||||
if ($item->ShippingCostId == 1) {
|
||||
|
||||
|
||||
$getSmallItemQty += $item->Quantity;
|
||||
} else if ($item->ShippingCostId == 2) {
|
||||
$getBulkyItemQty += $item->Quantity;
|
||||
@@ -359,15 +359,15 @@ class PaypalController extends Controller
|
||||
|
||||
// $getSmallItemQty = ceil($getSmallItemQty / 3) * 8.99;
|
||||
|
||||
if($getSmallItemQty >= 1) {
|
||||
if($getSmallItemQty >= 2) {
|
||||
if ($getSmallItemQty >= 1) {
|
||||
if ($getSmallItemQty >= 2) {
|
||||
$getSmallItemQty = ceil(($getSmallItemQty - 1) / 1) * 2.49;
|
||||
$getSmallItemQty = $getSmallItemQty + 8.99;
|
||||
}else {
|
||||
} else {
|
||||
$getSmallItemQty = 8.99;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$getBulkyItemQty = ceil($getBulkyItemQty / 1) * 8;
|
||||
$getMaskItemQty = ceil($getMaskItemQty / 25) * 8;
|
||||
@@ -378,10 +378,10 @@ class PaypalController extends Controller
|
||||
$shippingFee = $CAShippingfee;
|
||||
}
|
||||
|
||||
if($getSubtotal[0]->Subtotal >= 99 && $countryCode != "CA") {
|
||||
if ($getSubtotal[0]->Subtotal >= 99 && $countryCode != "CA") {
|
||||
return $shippingFee = 0;
|
||||
}
|
||||
|
||||
|
||||
return $shippingFee;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ class PaypalController extends Controller
|
||||
|
||||
$checkCartKey = $paypal_model->checkCartKey($cartKey);
|
||||
|
||||
if(count($checkCartKey) > 0) {
|
||||
if (count($checkCartKey) > 0) {
|
||||
$message = 'You already paid for this order. Please check your Order Page. <a href="user/orders"> <strong> <u>click here</u> </strong></a>.';
|
||||
Session::put('cartkeyError', $message);
|
||||
return Redirect::route('cart');
|
||||
@@ -600,10 +600,10 @@ class PaypalController extends Controller
|
||||
$request->session()->forget('cartkey'); // clear session for cartkey
|
||||
|
||||
// redirect to thank you page.
|
||||
return view('paypal.get_done')
|
||||
return view('paypal.payment_success')
|
||||
->with('currency', $currency)
|
||||
->with('total', $total);
|
||||
}else {
|
||||
} else {
|
||||
Session::put('cartkeyError', 'Something went wrong. Please try again.');
|
||||
return Redirect::route('cart');
|
||||
}
|
||||
@@ -632,6 +632,11 @@ class PaypalController extends Controller
|
||||
// var_dump($obj->transactions[0]->item_list->shipping_address);
|
||||
}
|
||||
|
||||
public function thankyou()
|
||||
{
|
||||
return view('paypal.payment_success');
|
||||
}
|
||||
|
||||
|
||||
public function getCancel(Request $request)
|
||||
{
|
||||
@@ -641,7 +646,7 @@ class PaypalController extends Controller
|
||||
$items = $m->myCart($cartKey);
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
|
||||
if($items == null) {
|
||||
if ($items == null) {
|
||||
return redirect()->route('cart');
|
||||
}
|
||||
|
||||
|
||||
@@ -156,11 +156,14 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
|
||||
Route::get('payPremium', ['as' => 'payPremium', 'uses' => 'paypal\PaypalController@payPremium']);
|
||||
Route::get('getCheckout', ['as' => 'getCheckout', 'uses' => 'paypal\PaypalController@getCheckout']);
|
||||
Route::get('getDone', ['as' => 'getDone', 'uses' => 'paypal\PaypalController@getDone']);
|
||||
// Route::get('getDone', ['as' => 'getDone', 'uses' => 'paypal\PaypalController@getDone']);
|
||||
Route::get('thank-you-for-your-purchase', ['as' => 'thank-you-for-your-purchase', 'uses' => 'paypal\PaypalController@getDone']);
|
||||
Route::get('getCancel', ['as' => 'getCancel', 'uses' => 'paypal\PaypalController@getCancel']);
|
||||
Route::get('getDoneTest', ['as' => 'getDoneTest', 'uses' => 'paypal\PaypalController@getDoneTest']);
|
||||
|
||||
// END PAYPAL ROUTES
|
||||
});
|
||||
// Route::get('thank-you-for-your-purchase', 'paypal\PaypalController@thankyou');
|
||||
|
||||
Route::group(['middleware' => 'admin'], function () {
|
||||
Route::get('admin', function () {
|
||||
|
||||
Reference in New Issue
Block a user