/**
  * Store a delivered order
  * 
  * 1. Check transaction
  * 2. Check input
  * 3. Store transaction
  * 4. Check response
  * 5. Generate view
  * @param id
  * @return object view
  */
 public function store($id = null)
 {
     //1. Check transaction
     if (Input::has('transaction_id')) {
         $saleid = Input::get('transaction_id');
     } else {
         \App::abort(404);
     }
     $APISale = new APISale();
     $prev_sale = $APISale->getShow($saleid);
     if ($prev_sale['status'] != 'success') {
         $this->errors = $prev_sale['message'];
         return $this->generateRedirectRoute('shop.shipping.create');
     }
     $sale = $prev_sale['data'];
     //2. Check input
     $sale['status'] = 'delivered';
     $sale['notes'] = 'Diterima Oleh ' . Input::get('notes');
     //3. Store Transction
     $result = $APISale->postData($sale);
     //4. Check response
     if ($result['status'] != 'success') {
         $this->errors = $result['message'];
     } else {
         $mail = new APISendMail();
         $mail->deliveredorder($result['data'], $this->balininfo());
     }
     //5. Generate view
     $this->page_attributes->success = ['title' => 'Pesanan sudah diterima pembeli. ', 'action' => route('report.product.sale.detail', ['id' => $saleid]), 'actionTitle' => 'Klik disini untuk melihat Invoice barang.'];
     return $this->generateRedirectRoute('admin.dashboard', ['tab' => 'toko']);
 }
 /**
  * Store a packing transaction
  * 
  * 1. Check transaction
  * 2. Check input
  * 3. Store transaction
  * 4. Check response
  * 5. Generate view
  * @param id
  * @return object view
  */
 public function store($id = null)
 {
     //1. Check transaction
     if (Input::has('transaction_id')) {
         $saleid = Input::get('transaction_id');
     } else {
         \App::abort(404);
     }
     $APISale = new APISale();
     $prev_sale = $APISale->getShow($saleid);
     $sale = $prev_sale['data'];
     //2. Check input
     $sale['status'] = 'packed';
     //3. Store transaction
     $result = $APISale->postData($sale);
     //4. Check response
     if ($result['status'] != 'success') {
         $this->errors = $result['message'];
     }
     //5. Generate view
     //5. Generate view
     $this->page_attributes->success = ['title' => 'Pesanan sudah dipacking! ', 'action' => route('report.product.sale.detail', ['id' => $saleid]), 'actionTitle' => 'Klik disini untuk melihat Invoice barang.'];
     return $this->generateRedirectRoute('admin.dashboard', ['tab' => 'toko']);
 }
예제 #3
0
 /**
  * Store a payment notes
  * 
  * 1. Check transaction
  * 2. Check input
  * 3. Store Payment
  * 4. Check response
  * 5. Generate view
  * @param id
  * @return object view
  */
 public function store($id = null)
 {
     //1. Check transaction
     if (Input::has('transaction_id')) {
         $saleid = Input::get('transaction_id');
     } else {
         \App::abort(404);
     }
     $APISale = new APISale();
     $prev_sale = $APISale->getShow($saleid);
     if ($prev_sale['status'] != 'success') {
         $this->errors = $prev_sale['message'];
         return $this->generateRedirectRoute('shop.pay.create');
     }
     $sale = $prev_sale['data'];
     //2. Check input
     $inputPayment = Input::only('method', 'destination', 'account_name', 'account_number');
     $inputPayment['id'] = '';
     $inputPayment['amount'] = $sale['bills'];
     $inputPayment['ondate'] = date('Y-m-d H:i:s', strtotime(Input::get('ondate')));
     $sale['payment'] = $inputPayment;
     $sale['status'] = 'paid';
     //3. Store Payment
     $result = $APISale->postData($sale);
     //4. Check response
     if ($result['status'] != 'success') {
         $this->errors = $result['message'];
     } else {
         $mail = new APISendMail();
         $mail->paidorder($result['data'], $this->balininfo());
     }
     //5. Generate view
     $this->page_attributes->success = ['title' => 'Pesanan sudah divalidasi. ', 'action' => route('report.product.sale.detail', ['id' => $saleid]), 'actionTitle' => 'Klik disini untuk melihat Invoice barang.'];
     return $this->generateRedirectRoute('admin.dashboard', ['tab' => 'toko']);
 }