Пример #1
0
 /**
  * Inits and saves given ThePayPaymentInterface tepmplate
  * @param ThePayPaymentSourceInterface $source given source
  * @param ThePayPaymentInterface $template given template
  */
 public static function createFromSource(ThePayPaymentSourceInterface $source, ThePayPaymentInterface $template)
 {
     $template->setSource($source);
     if ($template->save()) {
         return $template;
     }
     return false;
 }
Пример #2
0
 /**
  * Retrieves payment url
  */
 public function getPaymentUrl(ThePayPaymentInterface $payment, $returnUrl = false)
 {
     $tpp = new TpPayment($this->apiConfig);
     $tpp->setValue($payment->getSource()->getSourceAmount());
     $tpp->setDescription($payment->getSource()->getSourceDesc());
     $tpp->setMerchantData($payment->getSessionId());
     $tpp->setMethodId($payment->getPaymentType());
     $tpp->setCustomerEmail($payment->getSource()->getSourceCustomerEmail());
     if ($returnUrl) {
         $tpp->setReturnUrl($returnUrl);
     }
     return ThePayGatewayHandler::getUrl($this->apiConfig, ThePayGatewayHandler::buildPaymentQuery($tpp));
 }