public function store() { // 2.1 Retrieve Parameters to variables $transidmerchant = \Input::get('TRANSIDMERCHANT'); $statuscode = \Input::get('STATUSCODE'); $transdate = \Input::get('TRANSDATE'); $ptype = \Input::get('PTYPE'); $totalamount = \Input::get('AMOUNT'); $result = strtoupper(\Input::get('RESULT')); $xtrainfo = strtoupper(\Input::get('EXTRAINFO')); $status = false; $order = \Order::where('kodeOrder', $transidmerchant)->first(); if ($order) { echo "Order tidak ditemukan.."; } if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') { // 2.2 Cross check with MYSHORTCART Database Table // $true = 1 : transaction found, 0 : transaction not found if ($result == 'SUCCESS') { //update order ke pembayaran diterima $order->status = 2; $order->save(); $detail_konfirmasi = '<p>Doku MyshopCart Detail:<br> MerchantId : ' . $transidmerchant . '<br> Total : ' . $amount . '<br> Tanggal : ' . $transdate . '</p>'; $setting = \Pengaturan::where('akunId', '=', $order->akunId)->first(); $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => $order->tanggalOrder, 'namaPengirim' => $order->konfirmasi == null ? '-' : $order->konfirmasi->nama, 'noRekening' => $order->konfirmasi == null ? '-' : $order->konfirmasi->noRekPengirim, 'rekeningTujuan' => $order->konfirmasi == null ? '-' : $order->konfirmasi->bank->atasNama . '<br>' . $order->konfirmasi->bank->noRekening . ' - ' . $order->konfirmasi->bank->bankdefault->nama, 'jumlah' => $order->konfirmasi == null ? '-' : $order->konfirmasi->jumlah, 'cart' => \View::make('admin.order.detailorder')->with('order', $order), 'namaEkspedisi' => $order->jenisPengiriman, 'noResi' => $order->noResi, 'tujuanPengiriman' => $order->alamat . ' - ' . $order->kota, 'linkRegistrasi' => \URL::to('member/create'), 'detailKonfirmasi' => $detail_konfirmasi); $order->fromEmail = $setting->email; $order->fromtoko = $setting->nama; $qtyProduk = $order->detailorder; $template = \Templateemail::where('akunId', '=', $order->akunId)->where('no', '=', 6)->first(); $email = bind_to_template($data, $template->isi); $subject = bind_to_template($data, $template->judul); $a = \Mail::send('emails.email', array('data' => $email, 'nama' => '', 'web' => '', 'email' => '', 'telp' => '', 'jmlProduk' => '', 'metatag' => 0), function ($message) use($subject, $order) { $message->from($order->fromEmail, $order->fromtoko); $message->to($order->pelanggan->email, $order->pelanggan->nama)->cc($order->fromEmail)->subject($subject); }); } } $akun = \Akun::find($order->akunId); if ($akun->alamatWeb != '') { $url = 'http://' . $akun->alamatWeb . '/konfirmasiorder/' . $order->id; } else { $url = 'http://' . $akun->alamatJarvis . '.' . \Config::get('app.domain') . '/konfirmasiorder/' . $order->id; } echo "Status : " . $status . " <a href='{$url}'> Klik disini jika halaman tidak terload..</a>"; return \Redirect::to($url)->with('message', 'Success Update Order'); }
public function store() { // 2.1 Retrieve Parameters to variables $transidmerchant = \Input::get('TRANSIDMERCHANT'); $totalamount = \Input::get('AMOUNT'); $result = strtoupper(\Input::get('RESULT')); $status = false; if ($_SERVER['REMOTE_ADDR'] == '103.10.128.11') { // 2.2 Cross check with MYSHORTCART Database Table // $true = 1 : transaction found, 0 : transaction not found $order = \Order::where('kodeOrder', $transidmerchant)->first(); if ($order) { if ($result == 'SUCCESS') { //update order ke pembayaran diterima $order->status = 2; $order->save(); $status = true; //send email to member and toko //kirim email konfirmasi pembayaran $detail_konfirmasi = '<p>Doku MyshopCart Detail:<br> MerchantId : ' . $transidmerchant . '<br> Total : ' . $amount . '<br> Tanggal : ' . $transdate . '</p>'; $setting = \Pengaturan::where('akunId', '=', $order->akunId)->first(); $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => $order->tanggalOrder, 'namaPengirim' => $order->konfirmasi == null ? '-' : $order->konfirmasi->nama, 'noRekening' => $order->konfirmasi == null ? '-' : $order->konfirmasi->noRekPengirim, 'rekeningTujuan' => $order->konfirmasi == null ? '-' : $order->konfirmasi->bank->atasNama . '<br>' . $order->konfirmasi->bank->noRekening . ' - ' . $order->konfirmasi->bank->bankdefault->nama, 'jumlah' => $order->konfirmasi == null ? '-' : $order->konfirmasi->jumlah, 'cart' => \View::make('admin.order.detailorder')->with('order', $order), 'namaEkspedisi' => $order->jenisPengiriman, 'noResi' => $order->noResi, 'tujuanPengiriman' => $order->alamat . ' - ' . $order->kota, 'linkRegistrasi' => \URL::to('member/create'), 'detailKonfirmasi' => $detail_konfirmasi); $order->fromEmail = $setting->email; $order->fromtoko = $setting->nama; $qtyProduk = $order->detailorder; $template = \Templateemail::where('akunId', '=', $order->akunId)->where('no', '=', 6)->first(); $email = bind_to_template($data, $template->isi); $subject = bind_to_template($data, $template->judul); $a = \Mail::send('emails.email', array('data' => $email, 'nama' => '', 'web' => '', 'email' => '', 'telp' => '', 'jmlProduk' => '', 'metatag' => 0), function ($message) use($subject, $order) { $message->from($order->fromEmail, $order->fromtoko); $message->to($order->pelanggan->email, $order->pelanggan->nama)->cc($order->fromEmail)->subject($subject); }); } } } if ($status == true) { echo 'Continue'; } else { echo 'Stop'; } }
private function sendEmailOrder($order, $cart_part, $pembayaran_part) { $bank = \View::make('admin.pengaturan.bank')->with('banks', \BankDefault::all())->with('banktrans', \Bank::where('akunId', '=', $this->akunId)->where('status', '=', 1)->get()); $akun = Akun::find($this->akunId); if ($akun->alamatWeb != '') { $url = 'http://' . $akun->alamatWeb . '/konfirmasiorder'; } else { $url = 'http://' . $akun->alamatJarvis . '.jstore.co/konfirmasiorder'; } $data = array('pelanggan' => $order->nama, 'pelangganalamat' => $order->alamat, 'pelangganphone' => $order->telp, 'toko' => $this->setting->nama, 'kodeorder' => $order->kodeOrder, 'tanggal' => date("d F Y", strtotime($order->tanggalOrder)) . ' ' . date("g:ha", strtotime($order->tanggalOrder)), 'cart' => $cart_part, 'ekspedisi' => $order->jenisPengiriman, 'totalbelanja' => $order->total, 'phone' => $this->setting->telepon, 'handphone' => $this->setting->hp, 'email' => $this->setting->email, 'pembayaran' => $pembayaran_part, 'rekeningbank' => $bank, 'url' => $url); $template_email = \Templateemail::where('akunId', '=', $this->akunId)->where('no', '=', 1)->first(); $template = \View::make('checkout::email.main'); $pengirim = $this->datapengirim; $pengaturan = $this->setting; $pengirim['emailtoko'] = $pengaturan->email; $datapengirim['fromemail'] = $this->setting->email; $datapengirim['fromtoko'] = $this->setting->nama; $email = bind_to_template($data, $template_email->isi); $subject = 'Pemberitahuan Order -- ' . bind_to_template($data, $template_email->judul); Mail::later(3, 'emails.email', array('data' => $email), function ($message) use($subject, $pengirim) { $message->from($pengirim['emailtoko']); $message->to($pengirim['email'], $pengirim['nama'])->subject($subject); }); //kirik email konfirmasi ke email toko $subject2 = 'Pemberitahuan Order -- ' . bind_to_template($data, $template_email->judul); Mail::later(5, 'emails.email', array('data' => $email), function ($message) use($subject2, $pengaturan) { $message->to($pengaturan->emailAdmin, $pengaturan->nama)->subject($subject2); }); }