GithubHelp home page GithubHelp logo

robokassa's Introduction

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

robokassa's People

Contributors

paxa avatar radanisk avatar shaggyone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

robokassa's Issues

Вылетает со словами Robokassa::Interface.get_options_by_notification_key should be defined by app developer

Привет.

При запуске рельсов если смотреть на брейкпоинты порядок вызовов у меня получается такой,
сначала объявляется .../lib/robokassa/interface.rb
потом .../config/initializers/robokassa.rb

Открываю в бразуере http://..../robokassa все ок
Далее обновляю страницу
Повторно объявляется /lib/robokassa/interface.rb перетирает get_options_by_notification_key
и вылетает со словами
Robokassa::Interface.get_options_by_notification_key should be defined by app developer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.