コード例 #1
0
 function donations()
 {
     $donations = Donation::where('amount', '>=', '10')->orderBy('amount', 'desc')->lists('name');
     $gateways = Gateway::orderBy('name')->get();
     $this->stylesheet('assets/stylesheets/donations.css');
     $this->autoRender(compact('donations', 'gateways'), 'Donations');
 }
コード例 #2
0
 public function status()
 {
     // Includes Veritrans
     include app_path() . '/packages/veritrans/Veritrans.php';
     // Veritans configuration
     Veritrans_Config::$serverKey = 'VT-server-YN3xDgcjXol4o0mgbOs-A72D';
     // init
     $data = array();
     // get input
     $param = Input::all();
     try {
         // Check status transaksi ke server Veritrans
         $check = Veritrans_Transaction::status($param['order_id']);
         var_dump($check);
         // Order id
         $cipher = 'm4t4h4r1899';
         $iv = sprintf("%016d", Auth::user()->id);
         // Mempola Initialization Vector dengan User id
         // -- Decrypt order_id dengan algoritma AES-256
         $order_id = openssl_decrypt($param['order_id'], 'AES-256-CBC', $cipher, 0, $iv);
         $order_id = explode("_", $order_id, 2);
         $donation_id = (int) $order_id[1];
         $donation = Donation::where('id', '=', $donation_id)->where('status', '!=', 3)->first();
         // Check
         $code = DB::table('payment_code')->where('order_id', $param['order_id']);
         if ($code->count() > 0) {
             $vtweb_url = 'https://vtweb.sandbox.veritrans.co.id/v2/vtweb/' . $code->pluck('code');
         } else {
             $transaction = array('transaction_details' => array('order_id' => $param['order_id'], 'gross_amount' => (int) $donation->total), "vtweb" => array("credit_card_3d_secure" => true), 'customer_details' => array('first_name' => Auth::user()->firstname, 'last_name' => Auth::user()->lastname));
             // Mendapatkan checkout url
             $vtweb_url = Veritrans_Vtweb::getRedirectionUrl($transaction);
             $insert_code = DB::table('payment_code')->insert(array('order_id' => $param['order_id'], 'user_id' => Auth::user()->id, 'donation_id' => $donation->id, 'code' => basename($vtweb_url)));
         }
         $data = array('status_code' => $check->status_code, 'donation' => $donation);
     } catch (Exception $ex) {
         $data['status_code'] = '404';
     }
     return View::make('bagikasih.donation.status', $data);
 }
コード例 #3
0
 public function getMobile($location_id = null)
 {
     $mobiles = array('') + Location::whereIn('location_type_id', array(3))->lists('code', 'id');
     $donors = [''] + Donor::all()->lists('name_with_blood_group', 'id');
     $products = [''];
     foreach (Category::all() as $cat) {
         $cat_products = $cat->products->lists('name', 'id');
         $products[$cat->name] = $cat_products;
     }
     $locations = [''] + Location::all()->lists('name_with_parent', 'id');
     if ($location_id) {
         $donations = Donation::where('location_id', '=', $location_id)->orderBy('donations.created_at', 'desc')->paginate(15);
     } else {
         $donations = Donation::mobileCampaigns()->orderBy('donations.created_at', 'desc')->paginate(15);
     }
     // $donations = Donation::orderBy('created_at', 'desc')
     // 			->paginate($this->perPage);
     if (Request::ajax()) {
         return View::make('mobiles.mdonations-table', array('donations' => $donations));
     }
     return View::make('mobiles.mdonations', array('mobiles' => $mobiles, 'donors' => $donors, 'products' => $products, 'locations' => $locations, 'donations' => $donations, 'today' => Carbon\Carbon::now()));
 }
コード例 #4
0
ファイル: User.php プロジェクト: whiterun/bagikasih-v2
 public static function getSocialActivity($id)
 {
     // init
     $data = array();
     // get user data
     /*$user = User::find($id);
     		dd($user->created_at);
     		// get signup date
     		$data[$user->created_at] = array('type' => 'user');*/
     // get social target
     $social_targets = SocialTarget::where('user_id', '=', $id)->where('status', '=', 1)->get();
     foreach ($social_targets as $social_target) {
         $data[$social_target->created_at->timestamp] = array('type' => 'social_target', 'object_name' => $social_target->name, 'object_slug' => $social_target->slug);
     }
     // get social action
     $social_actions = SocialAction::where('user_id', '=', $id)->where('status', '=', 1)->get();
     foreach ($social_actions as $social_action) {
         $data[$social_action->created_at->timestamp] = array('type' => 'social_action', 'object_name' => $social_action->name, 'object_slug' => $social_action->slug);
     }
     // get event
     $events = Events::where('user_id', '=', $id)->where('status', '=', 1)->get();
     foreach ($events as $event) {
         $data[$event->created_at->timestamp] = array('type' => 'event', 'object_name' => $event->name, 'object_slug' => $event->slug);
     }
     // get donation
     $donations = Donation::where('user_id', '=', $id)->where('status', '=', 1)->where('as_noname', '=', 0)->get();
     foreach ($donations as $donation) {
         $donation->setAppends(array('type'));
         $data[$donation->created_at->timestamp] = array('type' => 'donation', 'object_type' => $donation->type_name, 'object_name' => $donation->type->name, 'object_slug' => $donation->type->slug);
     }
     // sort
     krsort($data);
     return $data;
 }
コード例 #5
0
ファイル: Payment.php プロジェクト: whiterun/bagikasih-v2
 public static function reject($id)
 {
     $payment = Payment::with(array('user', 'donations'))->find($id);
     if ($payment == null) {
         return array('success' => false, 'errors' => array('Pembayaran tidak ditemukan.'));
     }
     if ($payment->status != 0) {
         return array('success' => false, 'errors' => array('Pembayaran sudah pernah direspon oleh admin sebelumnya.'));
     }
     // delete
     // $payment->delete();
     $payment->status = 2;
     $payment->save();
     // update donation
     Donation::where('payment_id', '=', $payment->id)->update(array('status' => 0, 'payment_id' => NULL));
     // set type for each donation
     foreach ($payment->donations as $donation) {
         $donation->setAppends(array('type'));
     }
     // send email to donor
     Newsletter::addPaymentNewsletter($payment);
     return array('success' => true, 'data' => $payment);
 }