GithubHelp home page GithubHelp logo

smtm / ogone-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hoetmaaiers/ogone-rails

0.0 2.0 0.0 135 KB

A Ruby gem to simplify the use of Ogone online payments service.

License: MIT License

Ruby 100.00%

ogone-rails's Introduction

#Viveum-Ogone for Rails

##What is it

A Ruby gem to simplify the use of Ogone online payments service as offered by Viveum.

Installation

gem install ogone-rails
# or include in a gemfile
gem 'ogone-rails'

Configuration

Use the generator

	rails generate ogone:config

This creates 2 files. Change the example configruation in ogone.yml to your own configuration.

or configure manually

Define ogone parameters in a yaml config file:

	# config/ogone.yml
	development:
		pspid: "hoetmaaiers"
		sha_in: "0123456789abcdefghijklmnopqrstuv"
		sha_out: "vutsrqponmlkjihgfedcba9876543210"
		currency: "EUR"
		language: "nl_NL"
		mode: 'test'
	production:
		pspid: "hoetmaaiers"
		sha_in: "0123456789abcdefghijklmnopqrstuv"
		sha_out: "vutsrqponmlkjihgfedcba9876543210"
		currency: "EUR"
		language: "nl_NL"
		mode: 'live'

Configure ogone-rails in an initializer:

	# initializers/ogone.rb
	ogone_config = YAML.load_file('config/ogone.yml')[Rails.env].symbolize_keys
	OgoneRails::config (ogone_config)

Parameters

required

  • PSPID
  • sha_in
  • sha_out

optional

  • currency, default: "EUR"
  • language, default: "nl_NL"
  • mode, default = "live"

Helpers

Generate an ogone_form:

ogone_form({
	#transaction information
	:order_id => 12345, 
	:amount => 299.99, 
	:customer_name => "Jan Janssen",
	:customer_email => "[email protected]",
	:customer_address => "highstreet 101",
	:customer_zip => "1000",
	:customer_city => "Brussel",
	:customer_country => "Belgium",
	:customer_phone => "0412345678",
	
	# feedback url's
	:accept_url => "www.example.com/ogone/accept",
	:decline_url => "www.example.com/ogone/decline",
	:exception_url => "www.example.com/ogone/exception",
	:cancel_url => "www.example.com/ogone/cancel",
	
	# look and feel
	:title => "lorem ipsum",
	:bg_color => "FFFFFF",
	:text_color => "000000",
	:table_bg_color => "000000",
	:table_text_color => "000000",    	
	:button_bg_color => "CCCCCC",
	:button_text_color => "000000",
	:font_family => "Helvetica",
	:logo => "www.example.com/images/logo.png",
	
	# default ogone parameter
	'PARAM' => "example"
})

Check Ogone feedback

Create a new object to check the feedback Ogone gives you:

# app/controllers/feedback_controller.rb
@check = OgoneRails::CheckAuth.new( request )

Check valid authorization:

@check.valid?
#return true or false

Get parameters:

@check.get_parameters

… returns the Ogone feedback in a hash format. The keys are made more readable then Ogone provides them: …

{
	"order_id" => 46185, 
	"amount" => 299.38, 
	"currency" => "EUR", 
	"payment_method" => "CreditCard",
	"acceptance" => "test123", 
	"status" => "Authorized", 
	"card_number" => "XXXXXXXXXXXX1111",
	"pay_id" => "14838904", 
	"error" => nil, 
	"brand" => "VISA",
	"sha_sign" => "51AF71351E79DD0186816289AD53C57213978E32"
}

Helper use for Subscrioptions billing after every end of Month

<%= ogone_form ({
     :order_id => 123456,
     :amount => 2.99,
     :customer_name => 'Jan Jansdfsdfssen',
     :customer_email => '[email protected]',
     :customer_address => 'highstreet 101',
     :customer_zip => '1000',
     :customer_city => 'Brussel',
     :customer_country => 'Belgium',
     :customer_phone => '0412345678',


    :subscription_id => '452343',
    :sub_amount => '49',
    :sub_com => '23423423',
    :sub_orderid => '2343243',
    :sub_period_unit => 'm',
    :sub_period_number => '1',
    :sub_period_moment => '31',
    :sub_startdate => '2012-09-28',
    :sub_enddate => '2013-09-28',
    :sub_status => '1',
    :sub_comment => 'test',

     :accept_url => 'example.com/ogon/accept',
     :decline_url => 'example.com/ogon/decline',
     :exception_url => 'example.com/ogon/exception',
     :cancel_url => 'example.com/ogon/cancel',

    })%>

Copyright

Copyright © 2012 Robin Houdmeyers. See LICENSE.txt for further details.

ogone-rails's People

Contributors

mortik avatar naled avatar smtm avatar

Watchers

 avatar  avatar

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.