/** * @return \PagSeguroPaymentRequest */ public function createPaymentRequest() { // Currency $this->_paymentRequest->setCurrency("BRL"); // Order ID $this->_paymentRequest->setReference($this->getOrderStoreReference()); //Shipping $this->setShippingInformation(); $this->_paymentRequest->setShipping()->setType()->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type $this->_paymentRequest->setShipping()->setCost()->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast // Sender $this->setSenderInformation(); // Itens $this->setItemsInformation(); //Redirect Url $this->_paymentRequest->setRedirectUrl($this->getRedirectUrl()); // Notification Url $this->_paymentRequest->setNotificationUrl($this->getNotificationUrl()); try { $this->_library->setEnvironment(); $this->_library->setCharset(); $this->_library->setLog(); return $this->_paymentRequest->register($this->_library->getPagSeguroCredentials(), $this->_library->isLightboxCheckoutType()); } catch (PagSeguroServiceException $ex) { $this->logger->debug($ex->getMessage()); $this->getCheckoutRedirectUrl(); } }
/** * Register a new payment * * @return string */ private function register() { return $this->_paymentRequest->register($this->_library->getPagSeguroCredentials()); }