GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Payment Gateway for Sermepa. Don't use in Production it's not stable.
Clone URL: git://github.com/fesplugas/simplified_sermepa.git
name age message
file MIT-LICENSE Tue Jul 08 14:04:41 -0700 2008 Updated MIT-LICENSE [fesplugas]
file README Tue Jul 08 17:40:27 -0700 2008 Small fix [fesplugas]
file Rakefile Tue Jul 08 14:04:55 -0700 2008 Updated Rakefile with new plugin name [fesplugas]
directory app/ Mon Sep 29 02:16:58 -0700 2008 * Make use of response_code in methods instead... [spejman]
directory config/ Tue Jul 08 17:23:41 -0700 2008 Configuration file template [fesplugas]
directory doc/ Tue Jul 08 17:28:05 -0700 2008 Moved sermepa doc [fesplugas]
directory generators/ Tue Jul 08 17:25:16 -0700 2008 Small markup fix [fesplugas]
file init.rb Tue Jul 08 17:23:20 -0700 2008 Load controllers ... [fesplugas]
file install.rb Tue Jul 08 14:04:05 -0700 2008 Copy configuration file to config/ after install [fesplugas]
directory lib/ Mon Sep 29 02:19:00 -0700 2008 * Use order_transaction name defined in config. [spejman]
directory test/ Tue Jul 08 17:27:52 -0700 2008 Test ... that are working. [fesplugas]
README
= Simplified Sermepa

Plugin for doing Sermepa (La Caixa, BBVA, MasterCard) payments.

== Usage

In order to use Simplified Sermepa you need:

- A <tt>config/sermepa.yml</tt> file explained above.
- A model used to store orders by default Order but configurable at `sermepa.yml`.
- A model used to store transaction details by default OrderTransaction 
but configurable at `sermepa.yml`.

The Order model attributes:

    Order
      token
      ...

The OrderTransaction model attributes:

    OrderTransaction
      raw_response
      order_id
      created_at
      updated_at

== ToDo

- Tests.
- Generators.
- Models shouldn't be hardcoded.
- Method to generate token.

== Configuration

After installing the plugin a configuration file named `sermepa.yml` will 
be created under `RAILS_ROOT/config`

Example:

    development:
      fuc: 201920191
      secret_key: h2u282kMks01923kmqpo
      payment_url: https://sis-t.sermepa.es:25443/sis/realizarPago
      ipn_url: http://sample.no-ip.org:3000/sermepa_backend/create
      success_url: http://0.0.0.0:3000/store/thanks
      failure_url: http://0.0.0.0:3000/store/checkout?message=error
    test:
      ...
    production:
      ...

=== Testing

You can use the following credit card to test your application.

    Fuc: 201920191
    Secret Key: h2u282kMks01923kmqpo
    Tarjeta: 4548812049400004
    Fecha de caducidad: 12/07
    CIP: 123456

== Example

On your models ...

    ##
    # app/models/order.rb
    #
    class Order < ActiveRecord::Base
      use_sermepa
    end

After adding <tt>use_sermepa</tt> to your model, it will be enable to 
accept transactions.

    >> Order.find_by_token('QWERTY').ipn_success?
    => true
    >> Order.find_by_token('QWERTY).ipn_code
    => '0000'

So after creating an order you can deliver the confirmation email to your 
client or run the desired task.

    class Order < ActiveRecord::Base

      use_sermepa

      after_create :notify_dispatch_and_user

      def notify_dispatch_and_user
        if self.ipn_success?
          # Deliver email with ActiveMailer ...
        end
      end

    end

On your views ...

    ##
    # app/views/payments/confirm.html.erb
    #
    <%= form_submit_to_sermepa(amount, token) %>

Copyright (c) 2008 Sergio Espeja and Francesc Esplugas, released under the MIT license