Example #1
0
 /**
  * function to resend invoice only order status 'wait'
  */
 public function resend_invoice($id = null)
 {
     //1. Get order detail
     $APIUser = new APIUser();
     $order = $APIUser->getMeOrderDetail(['user_id' => Session::get('whoami')['id'], 'order_id' => $id]);
     //2. Check order
     if ($order['status'] != 'success') {
         $this->errors = $order['message'];
     } else {
         $infos = [];
         foreach ($this->balin['info'] as $key => $value) {
             $infos[$value['type']] = $value['value'];
         }
         $mail = new APISendMail();
         $result = $mail->invoice($order['data'], $infos);
         // if (isset($result['message']))
         // {
         // 	$this->errors					= $result['message'];
         // }
     }
     $this->page_attributes->success = "Resend invoice terkirim.";
     return $this->generateRedirectRoute('my.balin.profile');
 }
 /**
  * function to post summary of balin checkout
  * 
  * 1. Get Session Cart & transaction
  * 2. Parsing variable
  * 3. Store checkout
  * 4. Check result, send mail
  * 5. Redirect url
  * @return redirect url
  */
 public function vtprocessing($order_id = null)
 {
     //1. Ambil data order detail dari API
     $APIUser = new APIUser();
     $me_order_detail = $APIUser->getMeOrderDetail(['user_id' => Session::get('whoami')['id'], 'order_id' => $order_id]);
     if ($me_order_detail['status'] != 'success') {
         \App::abort(404);
     }
     // Set our server key
     Veritrans_Config::$serverKey = env('VERITRANS_KEY', 'VT_KEY');
     // Uncomment for production environment
     Veritrans_Config::$isProduction = env('VERITRANS_PRODUCTION', false);
     // Comment to disable sanitization
     Veritrans_Config::$isSanitized = true;
     // Comment to disable 3D-Secure
     Veritrans_Config::$is3ds = true;
     // Fill transaction data
     $transaction = ['transaction_details' => ['order_id' => $me_order_detail['data']['ref_number'], 'gross_amount' => $me_order_detail['data']['bills']]];
     $vtweb_url = Veritrans_Vtweb::getRedirectionUrl($transaction);
     Session::forget('veritrans_payment');
     // Redirect
     dd(header('Location: ' . $vtweb_url));
 }