/**
  * Queue payment and save gift details.
  */
 function execute()
 {
     $journal =& $this->request->getJournal();
     $journalId = $journal->getId();
     // Create new gift and save details
     import('classes.gift.Gift');
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($this->request);
     $paymentPlugin =& $paymentManager->getPaymentPlugin();
     $gift = new Gift();
     if ($paymentPlugin->getName() == 'ManualPayment') {
         $gift->setStatus(GIFT_STATUS_AWAITING_MANUAL_PAYMENT);
     } else {
         $gift->setStatus(GIFT_STATUS_AWAITING_ONLINE_PAYMENT);
     }
     $gift->setAssocType(ASSOC_TYPE_JOURNAL);
     $gift->setAssocId($journalId);
     $gift->setGiftType(GIFT_TYPE_SUBSCRIPTION);
     $gift->setGiftAssocId($this->getData('typeId'));
     $gift->setBuyerFirstName($this->getData('buyerFirstName'));
     $gift->setBuyerMiddleName($this->getData('buyerMiddleName'));
     $gift->setBuyerLastName($this->getData('buyerLastName'));
     $gift->setBuyerEmail($this->getData('buyerEmail'));
     $gift->setBuyerUserId($this->buyerUserId ? $this->buyerUserId : null);
     $gift->setRecipientFirstName($this->getData('recipientFirstName'));
     $gift->setRecipientMiddleName($this->getData('recipientMiddleName'));
     $gift->setRecipientLastName($this->getData('recipientLastName'));
     $gift->setRecipientEmail($this->getData('recipientEmail'));
     $gift->setRecipientUserId(null);
     $gift->setLocale($this->getData('giftLocale'));
     $gift->setGiftNoteTitle($this->getData('giftNoteTitle'));
     $gift->setGiftNote($this->getData('giftNote'));
     $giftDao =& DAORegistry::getDAO('GiftDAO');
     $giftId = $giftDao->insertObject($gift);
     // Create new queued payment
     $subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
     $subscriptionType =& $subscriptionTypeDao->getSubscriptionType($this->getData('typeId'));
     $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_GIFT, null, $giftId, $subscriptionType->getCost(), $subscriptionType->getCurrencyCodeAlpha());
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
 }