protected function seeds_model_PaymentModel()
 {
     foreach ($this->payments as $key => $val) {
         $payment = new PaymentModel();
         $payment->name = $key;
         $payment->title = $val['title'];
         $payment->desc = $val['desc'];
         $payment->partner_id = $val['partner_id'];
         $payment->partner_key = $val['partner_key'];
         $payment->seller_email = $val['seller_email'];
         $payment->options = array('ca_cert_path' => $val['ca_cert']);
         $payment->save();
     }
     return null;
 }
 public function notify_return($id)
 {
     $payment = PaymentModel::find($id);
     if (!$payment) {
         die('fail');
     }
     $gateway = $payment->getOmniPayGateway();
     $options = $payment->options;
     if (isset($options['ca_cert_path'])) {
         $options['ca_cert_path'] = Config::get('laravel-payments::config.cert') . $options['ca_cert_path'];
     }
     $options['request_params'] = Input::all();
     $request = $gateway->completePurchase($options)->send();
     $debug_data = $request->getData();
     $out_trade_no = Input::get('out_trade_no');
     if ($request->isSuccessful()) {
         #####
         # eg: $order = Order::find($out_trade_no);
         # !!!!you should check your order status here for duplicate request.
         #####
         \Event::fire('payment.success.notify', ['payment' => $payment, 'order_no' => $out_trade_no, 'meta' => Input::all()]);
         die('success');
         //it should be string 'success'
     } else {
         \Event::fire('payment.fail.notify', ['payment' => $payment, 'order_no' => $out_trade_no, 'meta' => Input::all(), 'debug' => $debug_data]);
         die('fail');
         //it should be string 'fail'
     }
 }