Sammelbestellung von Extern
This commit is contained in:
parent
d01b4bd560
commit
582ca8299d
33 changed files with 3437 additions and 1466 deletions
|
|
@ -133,13 +133,14 @@ class InvoiceRepository extends BaseRepository {
|
|||
$pdfMerger->addPDF($path.$this->dir.$this->filename);
|
||||
$file = $pdfMerger->myMerge('string', $this->filename, 'template_invoice_de');
|
||||
Storage::disk('public')->put($this->dir.$this->filename, $file);
|
||||
|
||||
$pdf_file = new InvoicePDF('pdf.delivery');
|
||||
$pdf_file->create($data, $this->delivery_filename, 'save', $path.$this->delivery_dir);
|
||||
$pdfMerger = new MyPDFMerger();
|
||||
$pdfMerger->addPDF($path.$this->delivery_dir.$this->delivery_filename);
|
||||
$file = $pdfMerger->myMerge('string', $this->delivery_filename, 'template_invoice_de');
|
||||
Storage::disk('public')->put($this->delivery_dir.$this->delivery_filename, $file);
|
||||
if(!$this->model->shopping_collect_order){
|
||||
$pdf_file = new InvoicePDF('pdf.delivery');
|
||||
$pdf_file->create($data, $this->delivery_filename, 'save', $path.$this->delivery_dir);
|
||||
$pdfMerger = new MyPDFMerger();
|
||||
$pdfMerger->addPDF($path.$this->delivery_dir.$this->delivery_filename);
|
||||
$file = $pdfMerger->myMerge('string', $this->delivery_filename, 'template_invoice_de');
|
||||
Storage::disk('public')->put($this->delivery_dir.$this->delivery_filename, $file);
|
||||
}
|
||||
}
|
||||
|
||||
public function userSalesVolume()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,16 @@ namespace App\Repositories;
|
|||
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\ShopApiOrderCart;
|
||||
use App\Services\UserService;
|
||||
use App\Services\Util;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use Auth;
|
||||
use Yard;
|
||||
use App\User;
|
||||
|
||||
|
||||
|
||||
class ShopApiRepository extends BaseRepository {
|
||||
|
||||
|
|
@ -34,12 +44,62 @@ class ShopApiRepository extends BaseRepository {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function checkout($data){
|
||||
|
||||
public function checkout($data)
|
||||
{
|
||||
$user = User::find(Auth::user()->id);
|
||||
$shopApiOrderCart = $this->performCheckout($data);
|
||||
$time = time();
|
||||
$date = date('d.m.Y H:i:s', $time);
|
||||
Yard::instance('shopping')->destroy();
|
||||
$cartItem = Yard::instance('shopping')->add($shopApiOrderCart->id, 'Sammelbestellung Extern '.$date, 1, $shopApiOrderCart->price_total, false, false, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
$shipping_country = ShippingCountry::whereCountryId($user->account->country_id)->first();
|
||||
UserService::checkUserTaxShippingCountry($user, $shipping_country->id);
|
||||
|
||||
$data = [];
|
||||
$data['is_from'] = 'collection';
|
||||
|
||||
$data['shop_price'] = $shopApiOrderCart->price_total;
|
||||
$data['shop_price_net'] = $shopApiOrderCart->price_total_net;
|
||||
$data['shop_price_tax'] = $shopApiOrderCart->tax_total;
|
||||
$data['user_tax_free'] = false;
|
||||
$data['shopping_collect_order_id'] = $shopApiOrderCart->id;
|
||||
$data['is_for'] = 'co'; //colection
|
||||
$data['user_price_infos'] = UserService::getYardInfo();
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for nuy intern
|
||||
'auth_user_id' => $user->id,
|
||||
'payment' => 2, //Berater Shop
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'shopping_data' => $data,
|
||||
'back' => route('user_shop_api_orders'),
|
||||
|
||||
]);
|
||||
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'payment_collection', 'status'=>1, 'referenz'=>$shopApiOrderCart->id, 'identifier'=>$identifier]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
}
|
||||
|
||||
|
||||
private function performCheckout($data){
|
||||
$this->shopApiOrderCart = new ShopApiOrderCart();
|
||||
$this->performOrderCheckoutList($data, 1);
|
||||
return $this->shopApiOrderCart;
|
||||
}
|
||||
|
||||
|
||||
private function performActionList($data, $status){
|
||||
if(isset($data['api_action_list'])){
|
||||
foreach($data['api_action_list'] as $orderItemId=>$v){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue