2017 © Pedro Peláez
 

symfony-bundle interkassa-bundle

Bundle to integrate interkassa payment system to your Symfony2 project

image

chub/interkassa-bundle

Bundle to integrate interkassa payment system to your Symfony2 project

  • Saturday, May 11, 2013
  • by Chub
  • Repository
  • 1 Watchers
  • 3 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

InterkassaBundle

Symfony2 InterkassaBundle allows us to get user payments using Interkassa system. Interkassa is the one of the biggest payment system integrator in Russia and Ukraine., (*1)

Build Status knp, (*2)

Installation

Use composer

Add "chub/interkassa-bundle": "*" to your required section of composer.json and run php composer.phar update., (*3)

Register your bundle

Add it to your kernel, (*4)

``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new ChubProduction\InterkassaBundle\InterkassaBundle(), ); // ... }, (*5)


Configuration ============= Add interkassa section to your _app\config.yml_ ``` yaml interkassa: connections: # contain shop descriptions intercassa: shop_id: ololo # Shop id (you can get it in your profile) secret_key: ololo # Secret key (you can get it in your profile) fail_url: /profile/balance # Url to redirect user on transaction fail success_url: /profile/balance # Url to redirect user on transaction success #another_shop: # ....

Add some routes:, (*6)

``` yaml payment_status: pattern: /payment/status/{connection} defaults: { _controller: InterkassaBundle:Payment:status }, (*7)

payment_success: pattern: /payment/success/{connection} defaults: { _controller: InterkassaBundle:Payment:success }, (*8)

payment_fail: pattern: /payment/fail/{connection} defaults: { _controller: InterkassaBundle:Payment:fail }, (*9)


Usage ===== * Create your payment item class ``` php <?php //.. use ChubProduction\InterkassaBundle\Entity\Payment; use ChubProduction\InterkassaBundle\Service\PaymentItemInterface; class PaymentItem implements PaymentItemInterface { public function getAmount() { // return '1.00'; } public function getDescription() { // return 'ololo'; } public function setPayment(Payment $p) { // TODO: Implement setPayment() method. } }
  • Create a payment object

``` php $po = new PaymentItem();, (*10)


* Redirect user to pay ``` php // Somewhere in your Action $response = $this->get('payment')->createInvoice($po, 'intercassa'); return $response
  • Check status of the payment

php $po->getPayment()->isPaid();, (*11)

Event system

You can also register your own event subscriber/dispatcher to handle invoice creation, successful or failed transaction. There are InterkassaPaymentEvent object and InterkassaPaymentEvent::ON_INVOICE, InterkassaPaymentEvent::ON_STATUS_SUCCESS, InterkassaPaymentEvent::ON_STATUS_FAIL events for this, (*12)

The Versions