Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
SystemPay is a gem to ease credit card payment with Natixis Paiements / CyberplusPaiement (Credit du Nord) bank system. It's a Ruby on Rails port of the connexion kits published by the bank.
branch: master

This branch is 8 commits ahead, 12 commits behind iMenlo:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
Gemspec
Readme.markdown
init.rb
system_pay.gemspec

Readme.markdown

SystemPay

SystemPay is a gem to ease credit card payment with Natixis Paiements / CyberplusPaiement (Banque Populaire) bank system. It's a Ruby on Rails port of the connexion kits published by the bank.

  • Gem Homepage : site
  • Cyberplus SystemPay documentation : site

INSTALL

gem install system_pay

or, in your Gemfile

gem 'system_pay'

USAGE

in environment.rb :

# Your vads_site_id
SystemPay.vads_site_id = '654927625'   

in development.rb :

# Your test certificate
SystemPay.certificate = '9123456299120752'  

in production.rb :

# Your production certificate
SystemPay.certificate = '7193156219823756'  
# Set the production mode
SystemPay.vads_ctx_mode = 'PRODUCTION'      

in order controller :

helper :'system_pay/form'
@system_pay = SystemPay.new(:amount => @order.amount_in_cents, :trans_id => @order.id)   

in order view :

= form_tag @system_pay.target_url do
  = system_pay_hidden_fields(@system_pay)
  = submit_tag "Access to the bank website"

in a controller for call back from the bank :

class OrderTransactionsController < ApplicationController

  protect_from_forgery :except => [:bank_callback]

  def bank_callback
    if SystemPay.valid_signature?(params)

      order_transaction = OrderTransaction.find_by_reference params[:reference], :last
      order = order_transaction.order

      return_code = params['vads_result']

      if return_code == "Annulation"
        order.cancel!
        order.update_attribute :description, "Paiement refusé par la banque."

      elsif return_code == "payetest"
        order.pay!
        order.update_attribute :description, "TEST accepté par la banque."
        order_transaction.update_attribute :test, true

      elsif return_code == "00"
        order.pay!
        order.update_attribute :description, "Paiement accepté par la banque."
        order_transaction.update_attribute :test, false
      end

      order_transaction.update_attribute :success, true

      receipt = "0"
    else
      order.transaction_declined!
      order.update_attribute :description, "Document Falsifie."
      order_transaction.update_attribute :success, false

      receipt = "1\n#{PaiementCic.mac_string}"
    end
    render :text => "Pragma: no-cache\nContent-type: text/plain\n\nversion=2\ncdr=#{receipt}"
  end

Thanks

This gem is inspired by Novelys paiement_cic, many thanks to the team.

License

Copyright (c) 2012 iMenlo Team, released under the MIT license

Something went wrong with that request. Please try again.