mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Add payum/be2bill dependency
This commit is contained in:
parent
d2b197e23a
commit
8c774d95df
3 changed files with 140 additions and 5 deletions
|
|
@ -50,6 +50,7 @@
|
||||||
"payum/payum": "~0.6.3",
|
"payum/payum": "~0.6.3",
|
||||||
"payum/payum-bundle": "~0.6.2",
|
"payum/payum-bundle": "~0.6.2",
|
||||||
"payum/paypal-express-checkout-nvp": "0.6.*",
|
"payum/paypal-express-checkout-nvp": "0.6.*",
|
||||||
|
"payum/be2bill": "0.6.*",
|
||||||
"payum/omnipay-bridge": "0.6.*"
|
"payum/omnipay-bridge": "0.6.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
||||||
64
composer.lock
generated
64
composer.lock
generated
|
|
@ -3,7 +3,7 @@
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||||
],
|
],
|
||||||
"hash": "3e8acdedfafc4f76cad3cc8f0cc6201f",
|
"hash": "5b4fa19a33efc14777079220e9c2ce3f",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "athari/yalinqo",
|
"name": "athari/yalinqo",
|
||||||
|
|
@ -2185,7 +2185,7 @@
|
||||||
"symfony/options-resolver": ">=2.0.16,~2.0"
|
"symfony/options-resolver": ">=2.0.16,~2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/yaml": ">=2.0.16.0,>=2.0,<3.0",
|
"symfony/yaml": ">=2.0.16,~2.0",
|
||||||
"twig/twig": ">=1.0,<2.0-dev"
|
"twig/twig": ">=1.0,<2.0-dev"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
|
@ -2376,12 +2376,12 @@
|
||||||
"version": "v1.0.4",
|
"version": "v1.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/omnipay/omnipay.git",
|
"url": "https://github.com/adrianmacneil/omnipay.git",
|
||||||
"reference": "4f5e82232161939c0b14f5921c092ed77980d450"
|
"reference": "4f5e82232161939c0b14f5921c092ed77980d450"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/omnipay/omnipay/zipball/4f5e82232161939c0b14f5921c092ed77980d450",
|
"url": "https://api.github.com/repos/adrianmacneil/omnipay/zipball/4f5e82232161939c0b14f5921c092ed77980d450",
|
||||||
"reference": "4f5e82232161939c0b14f5921c092ed77980d450",
|
"reference": "4f5e82232161939c0b14f5921c092ed77980d450",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
|
|
@ -2415,7 +2415,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "A framework agnostic, multi-gateway payment processing library",
|
"description": "A framework agnostic, multi-gateway payment processing library",
|
||||||
"homepage": "https://github.com/omnipay/omnipay",
|
"homepage": "https://github.com/adrianmacneil/omnipay",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"2checkout",
|
"2checkout",
|
||||||
"2co",
|
"2co",
|
||||||
|
|
@ -2518,6 +2518,60 @@
|
||||||
],
|
],
|
||||||
"time": "2013-09-23 08:06:55"
|
"time": "2013-09-23 08:06:55"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "payum/be2bill",
|
||||||
|
"version": "0.6.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Payum/Be2Bill.git",
|
||||||
|
"reference": "605e43f0e14177744a7129471a3652489ab22284"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Payum/Be2Bill/zipball/605e43f0e14177744a7129471a3652489ab22284",
|
||||||
|
"reference": "605e43f0e14177744a7129471a3652489ab22284",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"payum/payum": "0.6.*",
|
||||||
|
"php": ">=5.3.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.6-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Payum\\Be2Bill": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maksim Kotlyar",
|
||||||
|
"email": "kotlyar.maksim@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Payum project",
|
||||||
|
"homepage": "http://payum.forma-dev.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Community contributions",
|
||||||
|
"homepage": "https://github.com/Payum/Be2Bill/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Be2Bill payment lib",
|
||||||
|
"keywords": [
|
||||||
|
"be2bill",
|
||||||
|
"payment"
|
||||||
|
],
|
||||||
|
"time": "2013-11-20 13:01:46"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "payum/omnipay-bridge",
|
"name": "payum/omnipay-bridge",
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Paweł Jędrzejewski
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\PayumBundle\Payum\Stripe\Action;
|
||||||
|
|
||||||
|
use Payum\Action\PaymentAwareAction;
|
||||||
|
use Payum\Bridge\Spl\ArrayObject;
|
||||||
|
use Payum\Exception\RequestNotSupportedException;
|
||||||
|
use Payum\Request\CaptureRequest;
|
||||||
|
use Payum\Request\SecuredCaptureRequest;
|
||||||
|
use Sylius\Bundle\CoreBundle\Model\OrderInterface;
|
||||||
|
use Sylius\Bundle\PayumBundle\Payum\Request\ObtainCreditCardRequest;
|
||||||
|
|
||||||
|
class CaptureOrderUsingCreditCardAction extends PaymentAwareAction
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function execute($request)
|
||||||
|
{
|
||||||
|
/** @var $request SecuredCaptureRequest */
|
||||||
|
if (!$this->supports($request)) {
|
||||||
|
throw RequestNotSupportedException::createActionNotSupported($this, $request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var OrderInterface $order */
|
||||||
|
$order = $request->getModel();
|
||||||
|
|
||||||
|
$paymentDetails = $order->getPayment()->getDetails();
|
||||||
|
if (empty($paymentDetails)) {
|
||||||
|
$this->payment->execute($obtainCreditCardRequest = new ObtainCreditCardRequest($order));
|
||||||
|
|
||||||
|
$paymentDetails = array(
|
||||||
|
'card' => array(
|
||||||
|
'number' => $obtainCreditCardRequest->getCreditCard()->getNumber(),
|
||||||
|
'expiryMonth' => $obtainCreditCardRequest->getCreditCard()->getExpiryMonth(),
|
||||||
|
'expiryYear' => $obtainCreditCardRequest->getCreditCard()->getExpiryYear(),
|
||||||
|
'cvv' => $obtainCreditCardRequest->getCreditCard()->getSecurityCode()
|
||||||
|
),
|
||||||
|
'amount' => number_format($order->getTotal() / 100, 2),
|
||||||
|
'currency' => $order->getCurrency(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: find a way to simply the next logic
|
||||||
|
|
||||||
|
$paymentDetails = ArrayObject::ensureArrayObject($paymentDetails);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payment->execute(new CaptureRequest($paymentDetails));
|
||||||
|
|
||||||
|
unset($paymentDetails['card']);
|
||||||
|
$order->getPayment()->setDetails((array) $paymentDetails);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
unset($paymentDetails['card']);
|
||||||
|
$order->getPayment()->setDetails((array) $paymentDetails);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function supports($request)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
$request instanceof SecuredCaptureRequest &&
|
||||||
|
$request->getModel() instanceof OrderInterface
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue