/** * 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']); }
/** * 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']); }
/** * resend sale * * @return redirect */ public function sale($id = 0, $status = '') { $APISale = new APISale(); $result = $APISale->getShow($id); if ($result['status'] != 'success') { $this->errors = $result['message']; } $type = 'Email'; $mail = new APISendMail(); switch ($status) { case 'wait': $mail->invoice($result['data'], $this->balininfo()); $type = 'Invoice'; break; case 'paid': $mail->paidorder($result['data'], $this->balininfo()); $type = 'Validasi Pembayaran'; break; case 'shipping': $mail->shippingorder($result['data'], $this->balininfo()); $type = 'Nota Pengiriman'; break; case 'delivered': $mail->deliveredorder($result['data'], $this->balininfo()); $type = 'Konfirmasi Pesanan Delivered'; break; case 'canceled': $mail->cancelorder($result['data'], $this->balininfo()); $type = 'Konfirmasi Pembatalan Pesanan'; break; case 'abandoned': $mail->abandoned($result['data'], $this->balininfo()); $type = 'Email Pengingat'; break; default: $this->errors = 'Status tidak valid'; break; } $this->page_attributes->success = $type . " sudah di kirim "; $from = Input::get('from'); if ($from != null) { return Redirect::to($from)->with('msg', 'Email pengingat berhasil dikirim.')->with('msg-type', 'success'); } return $this->generateRedirectRoute('report.product.sale', ['id' => $id]); }
public function show($id) { //1. Get data from API $APISale = new APISale(); $sale = $APISale->getShow($id); //2. Check return status if ($sale['status'] != 'success') { $this->errors = $sale['message']; return $this->generateRedirectRoute('report.product.cancel'); } $this->page_attributes->subtitle = $sale['data']['ref_number']; $this->page_attributes->data = ['sale' => $sale]; //3. Generate breadcrumb $breadcrumb = ['Laporan Transaksi Batal' => route('report.product.cancel'), $sale['data']['ref_number'] => route('report.product.cancel.detail', ['id' => $id])]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //4. Generate view $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }
public function FindTransactionByRefNumber($ref_number = null) { //get input $input = Input::get('ref_number'); //get data $APISale = new APISale(); $sale = $APISale->getIndex(['search' => ['refnumber' => $input], 'sort' => []]); //check if success if ($sale['status'] != 'success') { return abort(404); } //formating data $datas = []; foreach ($sale['data']['data'] as $key => $data) { $datas[$key]['id'] = $data['id']; $datas[$key]['ref_number'] = ucwords(str_replace('_', ' ', $data['ref_number'])); } //return return $datas; }
/** * 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']); }
public function index() { $APIwarehouse = new APIWarehouse(); $warehouse = $APIwarehouse->getCritical()['data']; $APISale = new APISale(); $wait = $APISale->getIndex(['search' => ['status' => ['wait', 'veritrans_processing_payment']]])['data']; $paid = $APISale->getIndex(['search' => ['status' => 'paid', 'productnotes' => true]])['data']; $packed = $APISale->getIndex(['search' => ['status' => 'packed', 'addressnotes' => true]])['data']; $shipped = $APISale->getIndex(['search' => ['status' => 'shipping', 'shippingnotes' => true]])['data']; $expired = $APISale->getIndex(['search' => ['expiredwait' => true]])['data']; $this->page_attributes->data = ['warehouse' => $warehouse, 'wait' => $wait, 'paid' => $paid, 'packed' => $packed, 'shipped' => $shipped, 'expired' => $expired]; $this->page_attributes->source = 'pages.dashboard'; return $this->generateView(); }
/** * Display a customer detail * * 1. Get data from API * 2. Check return status * 3. Generate breadcrumb * 4. Generate view * @param id * @return Object View */ public function show($id) { //1. Get data from API $APICustomer = new APICustomer(); $customer = $APICustomer->getShow($id); // filters if (Input::has('q')) { $search = ['refnumber' => Input::get('q'), 'userid' => $id]; $this->page_attributes->search = Input::get('q'); } else { $search = ['userid' => $id]; $this->page_attributes->search = null; } // sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal', 'nota', 'tagihan'], 'tanggal' => $SortList->getSortingList('tanggal'), 'nota' => $SortList->getSortingList('nota'), 'tagihan' => $SortList->getSortingList('tagihan')]; //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } // get data $APISale = new APISale(); $sale = $APISale->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $customer['data']['sales'] = $sale['data']['data']; //data paging $this->paginate(route('customer.customer.show', ['id' => $id]), $sale['data']['count'], $page); //2. Check return status if ($customer['status'] != 'success') { $this->errors = $customer['message']; return $this->generateRedirectRoute('customer.customer.index'); } $this->page_attributes->subtitle = $customer['data']['name']; $this->page_attributes->data = ['customer' => $customer]; //3. Generate breadcrumb $breadcrumb = [$customer['data']['name'] => route('customer.customer.show', ['id' => $id])]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //4. Generate view $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }