https://github.com/fullpipe/payum-flexidengi
Flexidengi payment gateway for payum
https://github.com/fullpipe/payum-flexidengi
Last synced: 5 months ago
JSON representation
Flexidengi payment gateway for payum
- Host: GitHub
- URL: https://github.com/fullpipe/payum-flexidengi
- Owner: fullpipe
- License: mit
- Created: 2015-05-06T12:01:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-10T14:57:15.000Z (about 10 years ago)
- Last Synced: 2025-05-18T06:48:24.605Z (6 months ago)
- Language: PHP
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flexidengi payment gateway for [payum](http://payum.org/)
## Instalation (with symfony2 payum bundle)
add to your composer json
```json
{
"require": {
"payum/payum-bundle": "0.14.*",
"fullpipe/payum-flexidengi": "dev-master"
}
}
```
Add FlexidengiPaymentFactory to payum:
```php
getExtension('payum');
$extension->addPaymentFactory(new FlexidengiPaymentFactory());
}
}
```
Since Flexidengi does not supports callback urls.
You will require to implement `notifyAction`
```php
getPayum()->getPayment('flexidengi_gateway');
$payment = $this->getPayum()
->getStorage('Acme\PaymentBundle\Entity\Payment')
->findBy(array(
'number' => $request->query->get(Api::ORDER_ID_PARAM_NAME),
));
if ($reply = $gateway->execute(new Notify($payment), true)) {
if ($reply instanceof HttpResponse) {
$gateway->execute($status = new GetHumanStatus($payment));
if ($status->isCaptured()) {
// Payment is done
// Notify your app here
}
throw $reply;
}
throw new \LogicException('Unsupported reply', null, $reply);
}
return new Response('', 204);
}
}
```
and you in routing.yml
```yaml
acme_payment_notify:
path: /payment_notify
defaults: { _controller: AcmePaymentBundle:Payment:notify }
```
## Configuration (using symfony2 payum bundle)
```yaml
payum:
security:
token_storage:
Acme\PaymentBundle\Entity\PaymentToken: { doctrine: orm }
storages:
Acme\PaymentBundle\Entity\Payment: { doctrine: orm }
payments:
...
flexidengi_gateway:
flexidengi:
service_id: 123
payment_method_id: 45
secret: SECRET_KEY
sandbox: true
...
```
## Usage
```php
get('payum')
->getStorage('Acme\PaymentBundle\Entity\Payment');
$payment = $storage->create();
$payment->setNumber($order->getId());
$payment->setCurrencyCode('RUB');
$payment->setTotalAmount(14025); // 140 руб, 25 коп.
$storage->update($payment);
$captureToken = $this->get('payum.security.token_factory')
->createCaptureToken(
$paymentName,
$payment,
'acme_payment_done'
);
return $this->redirect($captureToken->getTargetUrl());
}
}
```