Giter Club home page Giter Club logo

ogone-rails's Introduction

Ogone for Rails

What is it

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

Usage

Installation

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

Configuration

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'
		encoding: 'ISO-8859-1'
	production:
		pspid: "hoetmaaiers"
		sha_in: "0123456789abcdefghijklmnopqrstuv"
		sha_out: "vutsrqponmlkjihgfedcba9876543210"
		currency: "EUR"
		language: "nl_NL"
		mode: 'live'
		encoding: 'ISO-8859-1'

Deprecated in version >= 0.1.3, 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

New syntax

Generate an ogone_form whith the new syntax.

Full example

ogone_form_tag({:id => "form"}) do 
	form_content = ogone_fields({  
        :parameter => value
        ...
      })

	# add custom submit
	form_content << '<input type="submit" value="pay now" />'
end

ogone_form_tag example

ogone_form_tag({ :html_attribute => "value" }) do 
	...
	# everything in here must be in one variable
	form_content = "…"
	form_content << "…"		
	...
end

ogone_fields example

Generate hidden input fields with ogone parameters.

ogone_fields({
	:parameter => "value",
	...
}

Parameters

  ogone_fields_options = {
    # General parameters
    :order_id           => 'orderID',
    :amount             => 'amount',
    :customer_name      => 'CN',
    :customer_email     => 'EMAIL',
    :customer_address   => 'owneraddress',
    :customer_zip       => 'ownerZIP',
    :customer_city      => 'ownertown',
    :customer_country   => 'ownercty',
    :customer_phone     => 'ownertelno',
    # Feedback url's    
    :accept_url         => 'accepturl',
    :decline_url        => 'declineurl',
    :exception_url      => 'exceptionurl',
    :cancel_url         => 'cancelurl',
    # Look and feel     
    :title              => 'TITLE',
    :bg_color           => 'BGCOLOR',
    :text_color         => 'TXTCOLOR',
    :table_bg_color     => 'TBLBGCOLOR',
    :table_text_color   => 'TBLTXTCOLOR',
    :button_bg_color    => 'BUTTONBGCOLOR',
    :button_text_color  => 'BUTTONTXTCOLOR',
    :font_family        => 'FONTTYPE',
    :logo               => 'LOGO'       
  }

No worries, old syntax is still availlable...

ogone_form({
	:paramater => "value"
}, { :html_attribute => "" })

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_params

… 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"
}

Copyright

Copyright © 2012 Robin Houdmeyers

ogone-rails's People

Contributors

hoetmaaiers avatar jefvlamings avatar radnan avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

ogone-rails's Issues

Viveum

Viveum (payment provider in AT) uses Ogone tech, but server endpoints have different URLs. Does it make sense (also from a security point of view) to have the Server URLs as parameters in the config/ogone.yml? Or should it be hardcoded?

Remove default currency and language

Hey! I prefer setting the currency and language when building the form, not in the yml file. I'm crafting a multicurrent, multilingual platform and your gem rocks. Except one thing, when setting language/currency in the form, you'll generate duplicates, which makes the payment gateway fail:

screen shot 2013-08-30 at 12 34 46

I'd take those defaults out, or override them with the field options.
Passing dynamic parameters in the yml file is quite a mess.

Missing support for strings in order_d

Hi,

I just integrated ogone-rails in a an app that uses mongodb with mongoid.
The id's used in such a database are not integer, but strings.

The get_params method calls to_i to get the value for the order_id, I'm not sure if there is a good rationale for it, but in my case I had to use the request params to get the order ID

Tests missing

It would be great to have tests, to see if the gem works as expected.

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.