Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koc/jh9robokassabundle
https://github.com/koc/jh9robokassabundle
Last synced: about 6 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/koc/jh9robokassabundle
- Owner: Koc
- Created: 2014-06-23T07:35:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-23T07:56:26.000Z (over 10 years ago)
- Last Synced: 2023-03-11T05:19:04.679Z (over 1 year ago)
- Language: PHP
- Size: 133 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
RobokassaBundle
===============[Описание на русском](https://github.com/jh9aea/jh9RobokassaBundle/blob/master/README.ru.md)
current version supports only POST methods
Installation
------------```bash
php composer.phar require jh9/robokassa-bundle
``````php
get('jh9.robokassa.manager');
$result = $manager->handleResult($request);if ($result->isValid()) {
// ...// your success logic, such as set your order as paid
/*
$em = $this->get('doctrine.orm.default_entity_manager');
$order = $em->find('jh9ShopProductBundle:Order', $result->getInvId());
if (! $order) {
return $this->createNotFoundException();
}
$order->setStatus(OrderTypes::STATUS_PAYED);
*/
return new Response();
} else {
return new Response('Not valid', 500);
}
}
```in your success action you can do:
```php
/**
* @Route("/SuccessUrl")
* @Methods({"POST"})
*/
public function robokassaSuccessAction(Request $request)
{
$manager = $this->get('jh9.robokassa.manager');
$payResult = $manager->handleSuccess($request);
if (! $payResult->isValid()) {
return new Response('not valid', 400);
}
return new Response(
"Your order with id = " . $payResult->getInvId() . " is paid" .
" , amount = " $payResult->getOutSum() .
" your language is" . $payResult->getCulture()
);
}
```in your fail action:
```php
/**
* @Route("/payment/fail")
* @Methods({"POST"})
*/
public function robokassaFailAction(Request $request)
{
$payResult = $this->get('jh9.robokassa.manager')->handleFail($request);return new Response(
" Your order with id " . $payResult->getInvId() . " is not paid" .
" amount: " . $payResult->getOutSum()
);
}
```Template
--------to rewrite default template put your own to app/Resources/jh9RobokassaBundle/views/Twig/payForm.html.twig
```twig
# app/Resources/jh9RobokassaBundle/views/Twig/payForm.html.twig
{{ form_start(form) }}
{{ form_widget(form) }}
ROBOKASSA
{{ form_end(form) }}
```or set 'template' option in robokassa form call:
```twig
{{ jh9_robokassa_form(
order.id,
order.price,
{
'template': "AcmeBundle:RobokassaTemplate:myTemplate.html.twig
}
}}
```