public function load(ObjectManager $manager)
 {
     $userC4D3R = new User();
     $userC4D3R->setEmail("*****@*****.**");
     $userC4D3R->setUsername("c4d3r");
     $userC4D3R->setPassword("1839a056396a1385bc387dfa2973c632722f0346");
     $userC4D3R->addGroup($this->getReference('group-admin'));
     $manager->persist($userC4D3R);
     $manager->flush();
     $this->addReference('c4d3r-user', $userC4D3R);
 }
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('General')->add('username', 'text', array('label' => 'Username'))->add('email', 'email', array('label' => 'E-mail'))->add('lastIp', 'text', array('label' => 'last Ip-address', 'required' => false))->end()->with('Profile')->add('location', 'country', array('required' => false, 'attr' => array('class' => 'form-control')))->add('skype', 'text', array('label' => 'Skype', 'required' => false))->add('dateOfBirth', 'date', array('years' => range(1910, 2014), 'label' => 'Date of birth', 'required' => false))->add('gender', 'choice', array('required' => false, 'multiple' => false, 'choices' => User::getGenderList(), 'attr' => array('class' => 'form-control')))->end()->with('Groups')->add('groups', null, array('required' => false, 'multiple' => true, 'attr' => array('class' => 'form-control')))->end()->with('Forums')->add('awards', null, array('required' => false, 'multiple' => true, 'attr' => array('class' => 'form-control')))->end();
 }
 public function paymentBitpay(User $user, $mcuser, StoreItem $item)
 {
     //https://bitpay.com/api/invoice
     # item price calculations
     $total = $item->getAmount() * 1;
     $tax = 0;
     if ($item->getTax() > 0) {
         $tax = $total * ($item->getTax() / 100);
     }
     # get custom field
     $custom = array("user_id" => $user->getId(), "amount" => $total, "name" => $mcuser, "ip" => $user->getLastip(), "item_id" => $item->getId(), "discount" => $item->getReduction());
     # start REST call
     $rest = $this->get('maxim_cms.rest.helper');
     $apiKey = "WV3IhdH0ysNsWSJtieYlLygwblFEJAXMo3tIWvH0I";
     $uname = base64_encode($apiKey);
     $data = array("price" => $total, "currency" => "GBP", "notificationURL" => "http://google.com", "posData" => $custom);
     $data = json_encode($data);
     $length = strlen($data);
     $headers = array('Content-Type: application/json', "Content-Length: {$length}", "Authorization: Basic {$uname}");
     $rest->open("https://bitpay.com/api/invoice");
     $curl = $rest->getCurl();
     # set extra curls
     curl_setopt($curl, CURLOPT_PORT, 443);
     curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
     // verify certificate
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
     // check existence of CN and verify that it matches hostname
     curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
     curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
     $holder = $rest->execute(RESTHelper::METHOD_POST, $headers, $data)->getData();
     # the data contains the array
     $holder = json_decode($holder, true);
     return new \Symfony\Component\HttpFoundation\Response($holder["url"] . "&view=iframe&theme=dark");
     //return $this->redirect("https://coinbase.com/checkouts/" . $holder['button']['code']);
 }
 protected function buildUserForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('phone', 'text', array('label' => 'phone number', 'required' => false))->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))->add('skype', 'text', array('label' => 'skype'))->add('forumText', 'text', array('required' => false))->add('dateOfBirth', 'date', array('label' => 'Date of birth', 'years' => range(1910, 2014), 'attr' => array('class' => 'sf_date')))->add('gender', 'choice', array('multiple' => false, 'choices' => User::getGenderList()))->add('timezone', 'timezone', array('label' => 'timezone'))->add('location', 'country', array('label' => 'country'))->add('biography', 'textarea', array('label' => 'biography', 'attr' => array('class' => 'redactor-init')));
 }