当前位置: 首页>>代码示例>>PHP>>正文


PHP Omnipay::getFactory方法代码示例

本文整理汇总了PHP中Omnipay\Omnipay::getFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP Omnipay::getFactory方法的具体用法?PHP Omnipay::getFactory怎么用?PHP Omnipay::getFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Omnipay\Omnipay的用法示例。


在下文中一共展示了Omnipay::getFactory方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addConfiguration

    /**
     * {@inheritdoc}
     */
    public function addConfiguration(ArrayNodeDefinition $builder)
    {
        parent::addConfiguration($builder);

        $builder->children()
            ->scalarNode('type')->isRequired()->cannotBeEmpty()->end()
            ->arrayNode('options')->isRequired()
                ->useAttributeAsKey('key')
                ->prototype('scalar')->end()
            ->end()
        ->end();

        $builder
            ->validate()
            ->ifTrue(function ($v) {
                $gatewayFactory = Omnipay::getFactory();
                $gatewayFactory->find();

                $supportedTypes = $gatewayFactory->all();
                if (false == in_array($v['type'], $supportedTypes) && !class_exists($v['type'])) {
                    throw new LogicException(sprintf(
                        'Given type %s is not supported. Try one of supported types: %s or use the gateway full class name.',
                        $v['type'],
                        implode(', ', $supportedTypes)
                    ));
                }

                return false;
            })
            ->thenInvalid('A message')
        ;
    }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:35,代码来源:OmnipayDirectPaymentFactory.php

示例2: createConfig

 /**
  * {@inheritDoc}
  */
 public function createConfig(array $config = array())
 {
     $config = ArrayObject::ensureArrayObject($config);
     $config->defaults($this->defaultConfig);
     $config->defaults($this->coreGatewayFactory->createConfig());
     $config->defaults(array('payum.action.capture' => new CaptureAction(), 'payum.action.convert_payment' => new ConvertPaymentAction(), 'payum.action.status' => new StatusAction()));
     if (false == $config['payum.api']) {
         $config['payum.required_options'] = array('type');
         $config->defaults(array('options' => array()));
         $config['payum.api.gateway'] = function (ArrayObject $config) {
             $config->validateNotEmpty($config['payum.required_options']);
             $gatewayFactory = Omnipay::getFactory();
             $gatewayFactory->find();
             $supportedTypes = $gatewayFactory->all();
             if (false == in_array($config['type'], $supportedTypes)) {
                 throw new LogicException(sprintf('Given type %s is not supported. Try one of supported types: %s.', $config['type'], implode(', ', $supportedTypes)));
             }
             $gateway = $gatewayFactory->create($config['type']);
             foreach ($config['options'] as $name => $value) {
                 $gateway->{'set' . strtoupper($name)}($value);
             }
             return $gateway;
         };
     }
     return (array) $config;
 }
开发者ID:artkonekt,项目名称:OmnipayBridge,代码行数:29,代码来源:OmnipayDirectGatewayFactory.php

示例3: testRefund

 /**
  * @covers ::refund
  */
 public function testRefund()
 {
     $gateway = Omnipay::getFactory()->create('Dummy');
     $refund = $this->getMock('CL\\Purchases\\Refund', ['execute']);
     $params = ['test', 'test2'];
     $response = 'result response';
     $refund->expects($this->once())->method('execute')->with($this->identicalTo($gateway), $this->equalTo('refund'), $this->equalTo($params))->will($this->returnValue($response));
     $result = $refund->refund($gateway, $params);
     $this->assertEquals($response, $result);
 }
开发者ID:clippings,项目名称:purchases,代码行数:13,代码来源:RefundTest.php

示例4: createGateway

 public function createGateway(array $parameters)
 {
     if (array_key_exists($parameters['name'], $this->gateways)) {
         return $this->gateways[$parameters['name']];
     }
     /** @var $gateway \Omnipay\Common\AbstractGateway */
     $gateway = Omnipay::getFactory()->create($parameters['name']);
     $this->gatewayBuilders[$parameters['name']]->build($gateway, $parameters);
     $this->gateways[$parameters['name']] = $gateway;
     return $gateway;
 }
开发者ID:topstarsmith,项目名称:Adserver-Project,代码行数:11,代码来源:OmnipayGatewayFactory.php

示例5: testStorePurchase

 public function testStorePurchase()
 {
     $purchase = new Purchase();
     $address = Address::find(1);
     $product1 = Product::find(5);
     $product2 = Product::find(6);
     $product3 = Product::find(7);
     $purchase->setBilling($address);
     $purchase->addProduct($product1, 4)->addProduct($product2)->addProduct($product3)->addProduct($product1);
     Purchase::save($purchase);
     $gateway = Omnipay::getFactory()->create('Dummy');
     $parameters = ['card' => ['number' => '4242424242424242', 'expiryMonth' => 12, 'expiryYear' => date('Y'), 'cvv' => 123], 'clientIp' => '192.168.0.1'];
     $response = $purchase->purchase($gateway, $parameters);
     $this->assertTrue($response->isSuccessful());
     $this->assertEquals('Success', $response->getMessage());
 }
开发者ID:clippings,项目名称:purchases,代码行数:16,代码来源:IntegrationTest.php

示例6: testTest

 /**
  * @covers ::testMethod
  */
 public function testTest()
 {
     $basket = new Basket();
     $product1 = Product::find(1);
     $product2 = Product::find(2);
     $item1 = new ProductItem(['quantity' => 2]);
     $item1->setProduct($product1);
     $item2 = new ProductItem(['quantity' => 4]);
     $item2->setProduct($product2);
     $basket->getItems()->add($item1)->add($item2);
     Basket::save($basket);
     $gateway = Omnipay::getFactory()->create('Dummy');
     $parameters = ['card' => ['number' => '4242424242424242', 'expiryMonth' => 12, 'expiryYear' => date('Y'), 'cvv' => 123], 'clientIp' => '192.168.0.1'];
     $basket->freeze();
     $response = $basket->purchase($gateway, $parameters);
     $this->assertTrue($response->isSuccessful());
     $this->assertTrue($basket->isSuccessful);
     $this->assertQueries(['SELECT Product.* FROM Product WHERE (id = 1) LIMIT 1', 'SELECT Product.* FROM Product WHERE (id = 2) LIMIT 1', 'INSERT INTO Basket (id, currency, isSuccessful, completedAt, responseData, deletedAt, isFrozen, value) VALUES (NULL, "GBP", , NULL, NULL, NULL, , 0)', 'INSERT INTO ProductItem (id, basketId, productId, quantity, deletedAt, isFrozen, value) VALUES (NULL, NULL, NULL, 2, NULL, , 0), (NULL, NULL, NULL, 4, NULL, , 0)', 'UPDATE ProductItem SET basketId = CASE id WHEN 1 THEN "1" WHEN 2 THEN "1" ELSE basketId END, productId = CASE id WHEN 1 THEN 1 WHEN 2 THEN 2 ELSE productId END WHERE (id IN (1, 2))', 'UPDATE Basket SET isSuccessful = 1, completedAt = "' . $basket->completedAt . '", responseData = "{"amount":"1000.00","reference":"' . $basket->responseData['reference'] . '","success":true,"message":"Success"}", isFrozen = 1, value = 100000 WHERE (id = "1")', 'UPDATE ProductItem SET isFrozen = CASE id WHEN 1 THEN 1 WHEN 2 THEN 1 ELSE isFrozen END, value = CASE id WHEN 1 THEN 10000 WHEN 2 THEN 20000 ELSE value END WHERE (id IN (1, 2))']);
 }
开发者ID:clippings,项目名称:transfer,代码行数:22,代码来源:InitegrationTest.php

示例7: attachEvents

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     $activeProviders = Configuration::get("OMNIPAY.ACTIVEPROVIDERS");
     if (!is_array($activeProviders)) {
         $activeProviders = [];
     }
     foreach ($activeProviders as $provider) {
         $gateway = \Omnipay\Omnipay::getFactory()->create($provider);
         $config = Configuration::get("OMNIPAY." . strtoupper($provider));
         if (is_null($config)) {
             $config = [];
         }
         $shopProvider = new Provider($gateway, $config);
         \Pimcore::getEventManager()->attach("coreshop.payment.getProvider", function ($e) use($shopProvider) {
             return $shopProvider;
         });
     }
 }
开发者ID:coreshop,项目名称:omnipay,代码行数:22,代码来源:Shop.php

示例8: buildOmnipayGatewayFactories

 /**
  * @param GatewayFactoryInterface $coreGatewayFactory
  *
  * @return GatewayFactoryInterface[]
  */
 protected function buildOmnipayGatewayFactories(GatewayFactoryInterface $coreGatewayFactory)
 {
     $gatewayFactories = [];
     if (false == class_exists(\Omnipay\Omnipay::class)) {
         return $gatewayFactories;
     }
     $factory = \Omnipay\Omnipay::getFactory();
     $gatewayFactories['omnipay'] = new OmnipayGatewayFactory('', $factory, [], $coreGatewayFactory);
     $gatewayFactories['omnipay_direct'] = new OmnipayGatewayFactory('', $factory, [], $coreGatewayFactory);
     $gatewayFactories['omnipay_offsite'] = new OmnipayGatewayFactory('', $factory, [], $coreGatewayFactory);
     foreach ($factory->getSupportedGateways() as $type) {
         // omnipay throws exception on these gateways https://github.com/thephpleague/omnipay/issues/312
         // skip them for now
         if (in_array($type, ['Buckaroo', 'Alipay Bank', 'AliPay Dual Func', 'Alipay Express', 'Alipay Mobile Express', 'Alipay Secured', 'Alipay Wap Express', 'Cybersource', 'DataCash', 'Ecopayz', 'Neteller', 'Pacnet', 'PaymentSense', 'Realex Remote', 'SecPay (PayPoint.net)', 'Sisow', 'Skrill', 'YandexMoney', 'YandexMoneyIndividual'])) {
             continue;
         }
         $gatewayFactories[strtolower('omnipay_' . $type)] = new OmnipayGatewayFactory($type, $factory, [], $coreGatewayFactory);
     }
     return $gatewayFactories;
 }
开发者ID:Gundars,项目名称:Core,代码行数:25,代码来源:PayumBuilder.php

示例9: getProviderArray

 /**
  * @param $name
  * @return array
  */
 protected function getProviderArray($name)
 {
     $gateway = \Omnipay\Omnipay::getFactory()->create($name);
     $data = ['name' => $name, 'settings' => $gateway->getParameters()];
     return $data;
 }
开发者ID:coreshop,项目名称:omnipay,代码行数:10,代码来源:AdminController.php

示例10: testSetFactory

 public function testSetFactory()
 {
     $factory = m::mock('Omnipay\\Common\\GatewayFactory');
     Omnipay::setFactory($factory);
     $this->assertSame($factory, Omnipay::getFactory());
 }
开发者ID:TheSoftwareFarm,项目名称:omnipay-common,代码行数:6,代码来源:OmnipayTest.php

示例11: __construct

 /**
  * {@inheritDoc}
  *
  * @param string $omnipayGatewayTypeOrClass
  * @param OmnipayOmnipayGatewayFactory|null $omnipayGatewayFactory
  */
 public function __construct($omnipayGatewayTypeOrClass = null, OmnipayOmnipayGatewayFactory $omnipayGatewayFactory = null, array $defaultConfig = array(), GatewayFactoryInterface $coreGatewayFactory = null)
 {
     parent::__construct($defaultConfig, $coreGatewayFactory);
     $this->omnipayGatewayTypeOrClass = $omnipayGatewayTypeOrClass;
     $this->omnipayGatewayFactory = $omnipayGatewayFactory ?: Omnipay::getFactory();
 }
开发者ID:steffenbrem,项目名称:OmnipayBridge,代码行数:12,代码来源:OmnipayGatewayFactory.php


注:本文中的Omnipay\Omnipay::getFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。