fesplugas / simplified_sermepa
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
a773a16
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
app/ | ||
| |
config/ | ||
| |
doc/ | ||
| |
generators/ | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
test/ |
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
