public function setUp()
 {
     parent::setUp();
     Terminal::truncate();
     Payment::truncate();
     $this->term = new Terminal();
     $this->term->id = 123;
     $this->term->secret = 'secret';
     $this->term->save();
     $this->makeCity();
     $this->makeFee();
 }
 /**
  * Terminal info
  * auto-create new term if not exists
  */
 public function term()
 {
     $terminal = Terminal::whereUserId($this->userId())->first();
     if (!$terminal) {
         $terminal = new Terminal();
         $terminal->user_id = $this->userId();
         $terminal->secret = md5($terminal->user_id . time() . uniqid());
         $terminal->mode = Terminal::C_STATE_ENABLED;
         $terminal->save();
     }
     $this->make('term', compact('terminal'));
 }