API Shopping Order backend
This commit is contained in:
parent
7a040c3e19
commit
d01b4bd560
24 changed files with 1584 additions and 34 deletions
|
|
@ -26,7 +26,7 @@ class ShoppingUserController extends Controller
|
|||
|
||||
|
||||
protected $successStatus = 200;
|
||||
protected $member_id = 3; //thomas.krummel@gmail.com
|
||||
protected $member_id = 3; //service@aloe-vera.bio
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -363,12 +363,12 @@ class ShoppingUserController extends Controller
|
|||
$wp_advertising = isset($request->wp_advertising) ? $request->wp_advertising : '';
|
||||
$wp_incentives = isset($request->wp_incentives) ? $request->wp_incentives : '';
|
||||
|
||||
$wp_notice = [
|
||||
$api_notice = [
|
||||
'wp_advertising' => $wp_advertising,
|
||||
'wp_incentives' => $wp_incentives,
|
||||
];
|
||||
|
||||
$wp_order = $this->prepareOrder($wp_order, $shopping_user, $wp_invoice_path, $wp_notice);
|
||||
$wp_order = $this->prepareOrder($wp_order, $shopping_user, $wp_invoice_path, $api_notice);
|
||||
|
||||
if ($wp_order){
|
||||
$user = $this->prepareForShow($shopping_user);
|
||||
|
|
@ -573,7 +573,7 @@ class ShoppingUserController extends Controller
|
|||
return $ret;
|
||||
}
|
||||
|
||||
private function prepareOrder($wp_shopping_order, $shopping_user, $wp_invoice_path, $wp_notice){
|
||||
private function prepareOrder($wp_shopping_order, $shopping_user, $wp_invoice_path, $api_notice){
|
||||
Yard::instance('shopping')->destroy();
|
||||
$ret = [];
|
||||
|
||||
|
|
@ -593,7 +593,8 @@ class ShoppingUserController extends Controller
|
|||
if ($order->price != ($product->price * 100)) {
|
||||
$error[] = "different price: " . ($product->price * 100);
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith());
|
||||
}
|
||||
}
|
||||
$order->message = $error;
|
||||
|
|
@ -604,7 +605,7 @@ class ShoppingUserController extends Controller
|
|||
if($ShippingCountry){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($ShippingCountry->id);
|
||||
}
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user, $wp_invoice_path, $wp_notice);
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user, $wp_invoice_path, $api_notice);
|
||||
$this->orderStatusSendMail($shopping_order);
|
||||
|
||||
$shopping_user->shopping_order = $shopping_order;
|
||||
|
|
@ -613,7 +614,7 @@ class ShoppingUserController extends Controller
|
|||
return $ret;
|
||||
}
|
||||
|
||||
private function makeShoppingOrder($shopping_user, $wp_invoice_path, $wp_notice){
|
||||
private function makeShoppingOrder($shopping_user, $wp_invoice_path, $api_notice){
|
||||
|
||||
$data = [
|
||||
'shopping_user_id' => $shopping_user->id,
|
||||
|
|
@ -634,7 +635,8 @@ class ShoppingUserController extends Controller
|
|||
'paid' => true,
|
||||
'txaction' => 'extern',
|
||||
'wp_invoice_path' => $wp_invoice_path,
|
||||
'wp_notice' => $wp_notice,
|
||||
'api_notice' => $api_notice,
|
||||
'api_status' => 0,
|
||||
'mode' => $shopping_user->mode,
|
||||
];
|
||||
$shopping_order = $shopping_user->shopping_order;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue