/** * {@inheritDoc} */ public function createConfig(array $config = array()) { $config = ArrayObject::ensureArrayObject($config); $config->defaults($this->defaultConfig); $config->defaults(array( 'payum.template.layout' => '@PayumCore/layout.html.twig', 'buzz.client' => ClientFactory::createCurl(), 'twig.env' => TwigFactory::createGeneric(), 'payum.action.get_http_request' => new GetHttpRequestAction(), 'payum.action.capture_order' => new CaptureOrderAction(), 'payum.action.execute_same_request_with_model_details' => new ExecuteSameRequestWithModelDetailsAction(), 'payum.action.render_template' => function (ArrayObject $config) { return new RenderTemplateAction($config['twig.env'], $config['payum.template.layout']); }, 'payum.extension.endless_cycle_detector' => new EndlessCycleDetectorExtension(), 'payum.prepend_actions' => array(), 'payum.prepend_extensions' => array(), 'payum.prepend_apis' => array(), 'payum.default_options' => array(), 'payum.required_options' => array(), )); return (array) $config; }
/** * @param array $options * @param ClientInterface $client */ public function __construct(array $options, ClientInterface $client = null) { $this->client = $client ?: ClientFactory::createCurl(); $this->options = $options; if (false == (isset($this->options['sandbox']) && is_bool($this->options['sandbox']))) { throw new InvalidArgumentException('The boolean sandbox option must be set.'); } }
public function __construct(array $options, ClientInterface $client = null) { $this->client = $client ?: ClientFactory::createCurl(); $this->options = array_replace($this->options, $options); if (true == empty($this->options['vendor'])) { throw new InvalidArgumentException('The vendor option must be set.'); } if (false == is_bool($this->options['sandbox'])) { throw new InvalidArgumentException('The boolean sandbox option must be set.'); } }
/** * @param array $options * @param ClientInterface|null $client */ public function __construct(array $options, ClientInterface $client = null) { $this->options = array_replace($this->options, $options); if (true == empty($this->options['merchant_id'])) { throw new \InvalidArgumentException('The merchant id option must be set.'); } if (true == empty($this->options['merchant_password'])) { throw new \InvalidArgumentException('The merchant password option must be set.'); } if (true == empty($this->options['receiver_email'])) { throw new \InvalidArgumentException('The receiver email as NL account option must be set.'); } if (false == is_bool($this->options['sandbox'])) { throw new \InvalidArgumentException('The boolean sandbox option must be set.'); } $this->client = $client ?: ClientFactory::createCurl(); }
/** * @test */ public function shouldReturnCurlClient() { $client = ClientFactory::createCurl(); $this->assertInstanceOf('Buzz\\Client\\Curl', $client); }
<?php //config.php use Payum\Core\Bridge\Buzz\ClientFactory; use Payum\Core\Bridge\PlainPhp\Security\HttpRequestVerifier; use Payum\Core\Bridge\PlainPhp\Security\TokenFactory; use Payum\Core\Registry\SimpleRegistry; use Payum\Core\Security\GenericTokenFactory; use Payum\Core\Storage\FilesystemStorage; use winzou\PayumLimonetik\LimonetikPaymentFactory; $curl = ClientFactory::createCurl(); // Uncomment this if you're facing some SSL issues on Windows -- for development purpose only! // $curl->setVerifyPeer(false); $orderClass = 'Payum\\Core\\Model\\Order'; $storages = array($orderClass => new FilesystemStorage('./order', $orderClass, 'number')); $paymentFactory = new LimonetikPaymentFactory(array('merchant_id' => 'your-id', 'key' => 'your-key', 'sandbox' => true, 'buzz.client' => $curl)); $payments = array(); $payments['limonetik'] = $paymentFactory->create(); $payum = new SimpleRegistry($payments, $storages); $tokenStorage = new FilesystemStorage('./token', 'Payum\\Core\\Model\\Token', 'hash'); $requestVerifier = new HttpRequestVerifier($tokenStorage); $tokenFactory = new GenericTokenFactory(new TokenFactory($tokenStorage, $payum), array('capture' => 'payum-limonetik/examples/capture.php', 'notify' => 'payum-limonetik/examples/notify.php', 'authorize' => 'payum-limonetik/examples/authorize.php', 'refund' => 'payum-limonetik/examples/refund.php'));
/** * @param array $options * @param ClientInterface|null $client */ public function __construct(array $options, ClientInterface $client = null) { $this->options = array_replace($this->options, $options); if (true == empty($this->options['username'])) { throw new InvalidArgumentException('The username option must be set.'); } if (true == empty($this->options['password'])) { throw new InvalidArgumentException('The password option must be set.'); } if (true == empty($this->options['signature'])) { throw new InvalidArgumentException('The signature option must be set.'); } if (false == is_bool($this->options['sandbox'])) { throw new InvalidArgumentException('The boolean sandbox option must be set.'); } $this->client = $client ?: ClientFactory::createCurl(); }