Project

robokassa

0.03
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Robokassa is payment system, that provides a single simple interface for payment systems popular in Russia. If you have customers in Russia you can use the gem. The first thing about this gem, is that it was oribinally designed for spree commerce. So keep it in mind.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
~> 0.3.1
>= 0
>= 0

Runtime

>= 3.2.0
 Project Readme

NOTE

This gem is obsolete and not supported for 10 years or so.

Consider using gems from: https://github.com/PaymentInstruments/robokassa

SUMMARY

This gem adds robokassa support to your app.

Robokassa is payment system, that provides a single simple interface for payment systems popular in Russia. If you have customers in Russia you can use the gem.

The first thing about this gem, is that it was oribinally designed for spree commerce. So keep it in mind.

Using the Gem

Add the following line to your app Gemfile

gem 'robokassa'

Update your bundle

bundle install

Create config/initializers/robokassa.rb with such code

Robokassa::Interface

module Robokassa

  def self.client
    Interface.new Interface.get_options_by_notification_key(nil)
  end

  class Interface
    class << self
      def get_options_by_notification_key(key)
        {
          test_mode: true,
          login: 'robox_login',
          password1: 'asdf1234',
          password2: 'qwer5678'
        }
      end

      def success_implementation(invoice_id, *args)
        Payment.find(invoice_id).confirm!
      end

      def fail_implementation(invoice_id, *args)
        Payment.find(invoice_id).mark_failed!
      end

      def notify_implementation(invoice_id, *args)
        Payment.find(invoice_id).verifity!
      end
    end
  end
end

In View file:

<% pay_url = Robokassa.client.init_payment_url(order.id, order.amount, "Order #{order}", '', 'ru', order.user.email, {}) %>
<%= link_to "Оплатить через сервис ROBOX", pay_url %>

In Robokassa account settings set:

Result URL: http://example.com/robokassa/default/notify
Success URL: http://example.com/robokassa/success
Fail URL: http://example.com/robokassa/fail

To overwrite controller you can do like this:

# coding: utf-8
class RobokassaController < Robokassa::Controller
  def success
    super
    @payment = Payment.find(params[:InvId])
    redirect_to dashboard_path, notice: "Ваш платеж на сумму #{@payment.amount} руб. успешно принят. Спасибо!"
  end

  def fail
    super
    redirect_to dashboard_path, varning: "Во время принятия платежа возникла ошибка. Мы скоро разберемся!"
  end
end

Testing

In console:

Clone gem

git clone git://github.com/shaggyone/robokassa.git

Install gems and generate a dummy application (It'll be ignored by git):

cd robokassa
bundle install
bundle exec combust

Run specs:

rake spec

Generate a dummy test application

Plans

I plan to add generators for views