protected function registerServices() { $this->app->bind('payum.builder', function ($app) { $builder = new PayumBuilder(); $builder->setTokenFactory(function (StorageInterface $tokenStorage, StorageRegistryInterface $registry) { return new TokenFactory($tokenStorage, $registry); })->setHttpRequestVerifier(function (StorageInterface $tokenStorage) { return new HttpRequestVerifier($tokenStorage); })->setCoreGatewayFactory(function (array $defaultConfig) { $factory = new CoreGatewayFactory($defaultConfig); $factory->setContainer($this->app); return $factory; })->setCoreGatewayFactoryConfig(['payum.action.get_http_request' => 'payum.action.get_http_request', 'payum.action.obtain_credit_card' => 'payum.action.obtain_credit_card'])->setGenericTokenFactoryPaths(['capture' => 'payum_capture_do', 'notify' => 'payum_notify_do', 'authorize' => 'payum_authorize_do', 'refund' => 'payum_refund_do']); return $builder; }); $this->app['payum'] = $this->app->share(function ($app) { return $app['payum.builder']->getPayum(); }); $this->app['payum.converter.reply_to_http_response'] = $this->app->share(function ($app) { return new ReplyToSymfonyResponseConverter(); }); $this->app['payum.action.get_http_request'] = $this->app->share(function ($app) { return new GetHttpRequestAction(); }); $this->app['payum.action.obtain_credit_card'] = $this->app->share(function ($app) { return new ObtainCreditCardAction(); }); }
/** * setTokenFactory. * * @method setTokenFactory * * @return self */ protected function setTokenFactory() { $this->payumBuilder->setTokenFactory([$this, 'createTokenFactory']); return $this; }