Inheritance: extends Payum\Core\Action\PaymentAwareAction, implements Payum\Core\ApiAwareInterface
 /**
  * {@inheritDoc}
  *
  * @param Authorize $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $details = ArrayObject::ensureArrayObject($request->getModel());
     if (!empty($details['PayerID'])) {
         return parent::execute($request);
     }
     if (empty($details['approval_url'])) {
         $this->createPayment($details);
     }
     $paypalConfig = ['approvalUrl' => $details['approval_url'], 'preselection' => 'none', 'mode' => $this->api->get('mode'), 'country' => $details['PAYMENTREQUEST_SHIPPING_ADDRESS']['country_code'], 'showPuiOnSandbox' => true, 'useraction' => 'commit'];
     $renderTemplate = new RenderTemplate(self::TEMPLATE, ['config' => $paypalConfig]);
     $this->gateway->execute($renderTemplate);
     throw new HttpResponse($renderTemplate->getResult());
 }
Exemple #2
0
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\UnsupportedApiException
  */
 public function throwIfNotSupportedApiContext()
 {
     $action = new CaptureAction();
     $action->setApi(new \stdClass());
 }