Example #1
0
 /**
  * @throws GPWebPayException
  * @throws \Exception
  */
 public function handleCheckout()
 {
     try {
         if (!$this->operation->getResponseUrl()) {
             $this->operation->setResponseUrl($this->link('//success!'));
         }
         $url = $this->provider->createRequest($this->operation)->getRequestUrl();
         $this->onCheckout($this, $this->provider->getRequest());
         $this->getPresenter()->redirectUrl($url);
     } catch (GPWebPayException $e) {
         throw $e;
     }
 }
Example #2
0
 /**
  * @param Operation $operation
  * @return $this
  */
 public function createRequest(Operation $operation)
 {
     $this->request = new Request($operation, $this->settings->getMerchantNumber($operation->getGatewayKey()), $this->settings->getDepositFlag());
     $this->signer = new Signer($this->settings->getPrivateKey($operation->getGatewayKey()), $this->settings->getPrivateKeyPassword($operation->getGatewayKey()), $this->settings->getPublicKey());
     return $this;
 }
Example #3
0
 /**
  * Sets params to array
  */
 private function setParams()
 {
     $this->params['MERCHANTNUMBER'] = $this->merchantNumber;
     $this->params['OPERATION'] = 'CREATE_ORDER';
     $this->params['ORDERNUMBER'] = $this->operation->getOrderNumber();
     $this->params['AMOUNT'] = $this->operation->getAmount();
     $this->params['CURRENCY'] = $this->operation->getCurrency();
     $this->params['DEPOSITFLAG'] = $this->depositFlag;
     if ($this->operation->getMerOrderNum()) {
         $this->params['MERORDERNUM'] = $this->operation->getMerOrderNum();
     }
     $this->params['URL'] = $this->url;
     if ($this->operation->getDescription()) {
         $this->params['DESCRIPTION'] = $this->operation->getDescription();
     }
     if ($this->operation->getMd()) {
         $this->params['MD'] = $this->operation->getMd();
     }
     if ($this->operation->getLang()) {
         $this->params['LANG'] = $this->operation->getLang();
     }
     if ($this->operation->getUserParam1()) {
         $this->params['USERPARAM1'] = $this->operation->getUserParam1();
     }
     if ($this->operation->getPayMethod()) {
         $this->params['PAYMETHOD'] = $this->operation->getPayMethod();
     }
     if ($this->operation->getDisablePayMethod()) {
         $this->params['DISABLEPAYMETHOD'] = $this->operation->getDisablePayMethod();
     }
     if ($this->operation->getPayMethods()) {
         $this->params['PAYMETHODS'] = $this->operation->getPayMethods();
     }
     if ($this->operation->getEmail()) {
         $this->params['EMAIL'] = $this->operation->getEmail();
     }
     if ($this->operation->getReferenceNumber()) {
         $this->params['REFERENCENUMBER'] = $this->operation->getReferenceNumber();
     }
     if ($this->operation->getFastPayId()) {
         $this->params['FASTPAYID'] = $this->operation->getFastPayId();
     }
 }