public function preparePaypalExpressCheckoutPaymentAction(Request $request, Formule $formule)
 {
     $user = $this->getUser();
     $paymentName = 'paypal_payment';
     $storage = $this->get('payum')->getStorage('challenge\\PaymentBundle\\Entity\\Orders');
     /** @var $paymentDetails Orders */
     $paymentDetails = $storage->create();
     $paymentDetails->setNumero(uniqid());
     $paymentDetails->setcurrencyCode('EUR');
     $paymentDetails->setamount($formule->getPrix());
     $paymentDetails->setdescription($formule->getLobby()->getDescription());
     $paymentDetails->setuser($user);
     $paymentDetails->setFormule($formule);
     $paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'EUR';
     $paymentDetails['PAYMENTREQUEST_0_AMT'] = $formule->getPrix();
     $paymentDetails['NOSHIPPING'] = Api::NOSHIPPING_NOT_DISPLAY_ADDRESS;
     $paymentDetails['REQCONFIRMSHIPPING'] = Api::REQCONFIRMSHIPPING_NOT_REQUIRED;
     $paymentDetails['L_PAYMENTREQUEST_0_ITEMCATEGORY0'] = Api::PAYMENTREQUEST_ITERMCATEGORY_DIGITAL;
     $paymentDetails['L_PAYMENTREQUEST_0_AMT0'] = $formule->getPrix();
     $paymentDetails['L_PAYMENTREQUEST_0_NAME0'] = $formule->getName();
     $paymentDetails['L_PAYMENTREQUEST_0_DESC0'] = $formule->getLobby()->getDescription();
     $storage->update($paymentDetails);
     $captureToken = $this->getTokenFactory()->createCaptureToken($paymentName, $paymentDetails, 'payment_done');
     $paymentDetails['INVNUM'] = $paymentDetails->getId();
     $storage->update($paymentDetails);
     return $this->redirect($captureToken->getTargetUrl());
 }
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $lobby = new Lobby();
     $lobby->setname('LobbyUnlock');
     $lobby->setdescription('Unlock all');
     $lobby1 = new Lobby();
     $lobby1->setname('Lobby stats');
     $lobby1->setdescription('Lobby stats et plus');
     $image = new Image();
     $image->setAlt('Imagebo2');
     $image->setUrl('http://img.ozgameshop.com/posters/video_game_posters/call_of_duty_black_ops_ii_cover_mini_poster_raw.jpg');
     $game = new Game();
     $game->setName('Call of duty balck ops 2');
     $game->setImage($image);
     $image1 = new Image();
     $image1->setAlt('Imageaw');
     $image1->setUrl('http://image.jeuxvideo.com/images-md/pc/c/a/call-of-duty-advanced-warfare-pc-00d.jpg');
     $game1 = new Game();
     $game1->setName('Call of duty advanced warfare');
     $game1->setImage($image1);
     $formule = new Formule();
     $formule->setPrix('8.84');
     $formule->setName('Lobby bo2');
     $formule->setGame($game);
     $formule->setLobby($lobby);
     $formule1 = new Formule();
     $formule1->setPrix('8.84');
     $formule1->setName('Lobby aw');
     $formule1->setGame($game1);
     $formule1->setLobby($lobby1);
     $manager->persist($formule);
     $manager->persist($formule1);
     $manager->flush();
 }
Exemple #3
0
 /**
  * Set formule
  *
  * @param \challenge\PaymentBundle\Entity\Formule $formule
  *
  * @return Orders
  */
 public function setFormule(\challenge\PaymentBundle\Entity\Formule $formule)
 {
     $this->formule = $formule;
     $formule->addOrder($this);
     return $this;
 }