Пример #1
0
 /**
  * Completes an off site purchase with the provided payment gateway
  * @param	\Omnipay\Common\GatewayInterface			$gateway Omnipay payment gateway
  * @param	array										$params pass this to the gateway
  * @return	\Omnipay\Common\Message\ResponseInterface	$response payment gateway response
  */
 public function execute_complete_purchase(GatewayInterface $gateway, array $params = array())
 {
     $include_card = isset($params['card']) && isset($params['card']['number']);
     $params = Arr::merge($params, $this->convert_purchase($include_card));
     $response = $gateway->completePurchase($params)->send();
     $this->payment_id = $response->getTransactionReference();
     $this->raw_response = $response->getData();
     if ($response->isSuccessful()) {
         $this->status = Model_Payment::PAID;
     }
     return $response;
 }
 /**
  * This is a proxy for gateway->completePurchase
  *
  * @param array $parameters
  *
  * @return \Omnipay\Common\Message\Response
  */
 public function completePurchase(array $parameters = array())
 {
     return $this->gateway->completePurchase($parameters)->send();
 }
 /**
  * @param GatewayInterface $gateway
  * @param Store $session
  * @param Dispatcher $dispatcher
  *
  * @return array
  */
 public function handle(GatewayInterface $gateway, Store $session, Dispatcher $dispatcher)
 {
     $response = $gateway->completePurchase($session->get('params'))->setToken($this->token)->setPayerId($this->payerId)->send();
     $dispatcher->fire(new TransactionSuccessful(array_merge($response->getData(), $session->get('params'))));
     return $response->getData();
 }