suite
This commit is contained in:
parent
242ddd0de0
commit
4b05510feb
3
Gemfile
3
Gemfile
@ -79,3 +79,6 @@ gem "posix-spawn"
|
||||
|
||||
gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version
|
||||
gem 'zip-zip' # will load compatibility for old rubyzip API.
|
||||
|
||||
|
||||
gem 'ogone-rails'
|
@ -130,6 +130,8 @@ GEM
|
||||
net-ssh (>= 2.6.5)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
ogone-rails (0.1.10)
|
||||
activesupport
|
||||
paranoia (2.1.4)
|
||||
activerecord (~> 4.0)
|
||||
posix-spawn (0.3.11)
|
||||
@ -250,6 +252,7 @@ DEPENDENCIES
|
||||
kaminari-bootstrap
|
||||
mysql2
|
||||
net-ssh (~> 2.7.0)
|
||||
ogone-rails
|
||||
paranoia (~> 2.0)
|
||||
posix-spawn
|
||||
rails (= 4.2.0)
|
||||
@ -269,3 +272,6 @@ DEPENDENCIES
|
||||
wkhtmltopdf-binary
|
||||
workflow (~> 1.2.0)
|
||||
zip-zip
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
|
@ -61,6 +61,18 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def current_abo
|
||||
if current_customer
|
||||
abo = current_customer.abonnements.where(:paid => true).where("start_at <= ? and end_at >= ?", Time.now, Time.now).first
|
||||
end
|
||||
end
|
||||
|
||||
def require_negos_abo
|
||||
if !current_abo
|
||||
redirect_to new_public_abonnement_path
|
||||
end
|
||||
end
|
||||
|
||||
def auth_admin
|
||||
if !current_admin
|
||||
redirect_to new_admin_admin_auth_path
|
||||
|
27
app/controllers/public/abonnements_controller.rb
Executable file
27
app/controllers/public/abonnements_controller.rb
Executable file
@ -0,0 +1,27 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Public::AbonnementsController < ApplicationController
|
||||
|
||||
before_filter :auth_customer
|
||||
layout "public"
|
||||
|
||||
def new
|
||||
@abonnement = current_customer.abonnements.new(:price => 300.0, :start_at => Time.now, :end_at => (Time.now+13.months).end_of_day, :slug => "negos-principal")
|
||||
end
|
||||
|
||||
def create
|
||||
@abonnement = current_customer.abonnements.new(:price => 300.0, :start_at => Time.now, :end_at => (Time.now+13.months).end_of_day, :slug => "negos-principal")
|
||||
|
||||
if @abonnement.save
|
||||
session[:abonnement_id] = @abonnement
|
||||
|
||||
@payment = @abonnement.payments.create(:amount => @abonnement.total_price_ttc, :payment_type_id => 1, :customer_id => current_customer.id)
|
||||
session[:payment_id] = @payment.id
|
||||
redirect_to paid_by_ogone_public_payment_path(@payment)
|
||||
else
|
||||
redirect_to :action => :new
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
class Public::NeedsController < ApplicationController
|
||||
|
||||
layout "public"
|
||||
|
||||
before_filter :require_negos_abo
|
||||
before_filter :auth_customer
|
||||
before_filter :check_enabled
|
||||
|
||||
|
453
app/controllers/public/payments_controller.rb
Normal file
453
app/controllers/public/payments_controller.rb
Normal file
@ -0,0 +1,453 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Public::PaymentsController < ApplicationController
|
||||
|
||||
layout "public"
|
||||
|
||||
skip_before_filter :verify_authenticity_token, :only => [:payplug_ipn, :paypal_ipn, :ogone_ipn]
|
||||
|
||||
def paid
|
||||
@payment = current_customer.payments.find(params[:id])
|
||||
|
||||
if params[:orderID]
|
||||
if @payment.ogone_payid? and !@payment.element.paid
|
||||
@abonnement = @payment.element
|
||||
@payment = @abonnement.payments.create(:amount => @abonnement.total_price_ttc, :payment_type_id => 1, :customer_id => current_customer.id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
def paid_by_ogone
|
||||
|
||||
@payment = current_customer.payments.find(params[:id])
|
||||
|
||||
if @payment.paid
|
||||
render :inline => "paiement déjà enregistré"
|
||||
#redirect_to new_public_donator_transaction_path(:paid => true)
|
||||
else
|
||||
|
||||
|
||||
|
||||
@ogone_options = {
|
||||
:amount => @payment.amount,
|
||||
:accept_url => "http://#{HOSTNAME}"+paid_by_ogone_confirm_public_payment_path(@payment.id),
|
||||
:decline_url => "http://#{HOSTNAME}"+paid_public_payment_path(@payment.id),
|
||||
:exception_url => "http://#{HOSTNAME}"+paid_public_payment_path(@payment.id),
|
||||
:cancel_url => "http://#{HOSTNAME}"+paid_public_payment_path(@payment.id),
|
||||
:orderid => @payment.token,
|
||||
:PARAMVAR => "ogoneipn",
|
||||
:PSPID => OgoneRails::pspid,
|
||||
:currency => OgoneRails::currency,
|
||||
:language => OgoneRails::language,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def paid_by_ogone_confirm
|
||||
|
||||
@check = OgoneRails::CheckAuth.new( request )
|
||||
|
||||
if @check.valid?
|
||||
|
||||
@payment = Payment.find_by_token(params[:orderID])
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
if !@payment.paid
|
||||
update_ogone_infos()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
if !@payment.paid
|
||||
|
||||
#render :inline => "pas payé"
|
||||
#redirect_to paid_public_payment_path(@payment)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def ogone_ipn
|
||||
|
||||
update_ogone_infos()
|
||||
|
||||
render :inline => "ok"
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def paid_by_paypal
|
||||
@donator_transaction = DonatorTransaction.find(session[:donator_transaction_id])
|
||||
|
||||
if @donator_transaction.paid
|
||||
redirect_to new_public_donator_transaction_path(:paid => true)
|
||||
else
|
||||
@payment = Payment.create(:tr_payment_type_id => 6)
|
||||
@donator_transaction.tr_payments << @payment
|
||||
|
||||
require 'paypal-sdk-merchant'
|
||||
@api = PayPal::SDK::Merchant::API.new
|
||||
|
||||
|
||||
@set_express_checkout = @api.build_set_express_checkout({
|
||||
:SetExpressCheckoutRequestDetails => {
|
||||
:custom => @payment.token,
|
||||
:ReturnURL => do_paypal_payment_public_donator_transaction_url(@donator_transaction.id),
|
||||
:CancelURL => edit_public_donator_transaction_url(@donator_transaction.id),
|
||||
:NoShipping => 1,
|
||||
:PaymentDetails => [{
|
||||
:OrderTotal => {
|
||||
:currencyID => "EUR",
|
||||
:value =>@donator_transaction.total },
|
||||
|
||||
:NotifyURL => "http://#{HOSTNAME}"+paypal_ipn_public_donator_transaction_path(@donator_transaction),
|
||||
:ShipToAddress => {
|
||||
:Name => @donator_transaction.particular_bill.name.to_s+" "+@donator_transaction.particular_bill.firstname.to_s,
|
||||
:Street1 => @donator_transaction.particular_bill.address_2,
|
||||
:Street2 => @donator_transaction.particular_bill.address_3,
|
||||
:CityName => @donator_transaction.particular_bill.city.upcase,
|
||||
:StateOrProvince => "",
|
||||
:Country => @donator_transaction.particular_bill.country.upcase,
|
||||
:PostalCode => @donator_transaction.particular_bill.cp.upcase },
|
||||
|
||||
:PaymentAction => "Sale" }] } })
|
||||
|
||||
# Make API call & get response
|
||||
@set_express_checkout_response = @api.set_express_checkout(@set_express_checkout)
|
||||
|
||||
# Access Response
|
||||
if @set_express_checkout_response.success?
|
||||
|
||||
@get_express_checkout_details = @api.build_get_express_checkout_details({
|
||||
:Token => @donator_transaction.token })
|
||||
|
||||
@get_express_checkout_details_response = @api.get_express_checkout_details(@get_express_checkout_details)
|
||||
|
||||
|
||||
|
||||
|
||||
@payment_detail = @get_express_checkout_details_response.GetExpressCheckoutDetailsResponseDetails.PaymentDetails[0]
|
||||
|
||||
|
||||
redirect_to @api.express_checkout_url(@set_express_checkout_response.Token)
|
||||
else
|
||||
@set_express_checkout_response.Errors
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def do_paypal_payment
|
||||
load_specific_page if @new_site
|
||||
|
||||
require 'paypal-sdk-merchant'
|
||||
@api = PayPal::SDK::Merchant::API.new
|
||||
|
||||
|
||||
@get_express_checkout_details = @api.build_get_express_checkout_details({:Token => params[:token] })
|
||||
|
||||
@get_express_checkout_details_response = @api.get_express_checkout_details(@get_express_checkout_details)
|
||||
|
||||
|
||||
|
||||
|
||||
# Access Response
|
||||
if @get_express_checkout_details_response.success?
|
||||
|
||||
|
||||
@payment = Payment.find_by_token(@get_express_checkout_details_response.GetExpressCheckoutDetailsResponseDetails.Custom.to_s)
|
||||
|
||||
|
||||
@order = @payment.donator_transaction
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
@get_express_checkout_details_response.Errors
|
||||
end
|
||||
|
||||
# Build request object
|
||||
@do_express_checkout_payment = @api.build_do_express_checkout_payment({
|
||||
:DoExpressCheckoutPaymentRequestDetails => {
|
||||
:PaymentAction => "Sale",
|
||||
:Token => params[:token],
|
||||
:PayerID => params[:PayerID],
|
||||
:PaymentDetails => [{
|
||||
:OrderTotal => {
|
||||
:currencyID => "EUR",
|
||||
:value => @order.total },
|
||||
:NotifyURL => "http://#{HOSTNAME}"+paypal_ipn_public_donator_transaction_path(@order) }] } })
|
||||
|
||||
# Make API call & get response
|
||||
@do_express_checkout_payment_response = @api.do_express_checkout_payment(@do_express_checkout_payment)
|
||||
|
||||
# Access Response
|
||||
if @do_express_checkout_payment_response.success?
|
||||
@payment_info = @do_express_checkout_payment_response.DoExpressCheckoutPaymentResponseDetails.PaymentInfo[0]
|
||||
|
||||
@do_express_checkout_payment_response.DoExpressCheckoutPaymentResponseDetails
|
||||
@do_express_checkout_payment_response.FMFDetails
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if @payment_info.PaymentStatus.to_s == "Completed"
|
||||
|
||||
params[:payment_status] ="Completed"
|
||||
update_paypal_infos()
|
||||
|
||||
|
||||
else
|
||||
redirect_to select_payment_public_donator_transaction_path(@donator_transaction.id)
|
||||
#render :file => 'public/500.html', :status => 500, :layout => false
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
render :file => 'public/500.html', :status => 500, :layout => false
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def paypal_ipn
|
||||
|
||||
|
||||
@api = PayPal::SDK::Merchant.new
|
||||
if @api.ipn_valid?(request.raw_post) # return true or false
|
||||
@payment = Payment.find_by_token(params[:custom].to_s)
|
||||
|
||||
@order = @payment.donator_transaction
|
||||
|
||||
|
||||
|
||||
# @order.payment_type= 6
|
||||
# @order.paid = true
|
||||
# @order.paid_at = Time.now
|
||||
|
||||
@payment.paypal_test_ipn= params[:test_ipn]
|
||||
|
||||
@payment.paypal_txn_type = params[:txn_type]
|
||||
@payment.paypal_txn_id = params[:txn_id]
|
||||
@payment.paypal_payment_date = params[:payment_date]
|
||||
|
||||
@payment.paypal_payment_status = params[:payment_status]
|
||||
@payment.paypal_reason_code = params[:reason_code]
|
||||
@payment.paypal_payment_type = params[:payment_type]
|
||||
|
||||
@payment.paypal_mc_currency = params[:mc_currency]
|
||||
@payment.paypal_mc_fee = params[:mc_fee]
|
||||
@payment.paypal_mc_gross = params[:mc_gross]
|
||||
|
||||
@payment.paypal_residence_country = params[:residence_country]
|
||||
|
||||
|
||||
if params[:charset] == "windows-1252"
|
||||
|
||||
else
|
||||
@payment.paypal_last_name = params[:last_name]
|
||||
@payment.paypal_first_name = params[:first_name]
|
||||
@payment.paypal_payer_email = params[:payer_email]
|
||||
end
|
||||
@payment.paypal_payer_id = params[:payer_id]
|
||||
@payment.paypal_payer_status = params[:payer_status]
|
||||
|
||||
@payment.paypal_receiver_id = params[:receiver_id]
|
||||
@payment.paypal_receiver_email = params[:receiver_email]
|
||||
|
||||
@payment.paypal_protection_eligibility = params[:protection_eligibility]
|
||||
@payment.paypal_ipn_track_id = params[:ipn_track_id]
|
||||
|
||||
|
||||
update_paypal_infos()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
render :inline => "test"
|
||||
end
|
||||
|
||||
|
||||
|
||||
#------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def update_ogone_infos
|
||||
|
||||
@check = OgoneRails::CheckAuth.new( request )
|
||||
|
||||
if @check.valid?
|
||||
|
||||
@payment = Payment.find_by_token(params[:orderID])
|
||||
|
||||
|
||||
|
||||
|
||||
####
|
||||
@payment.payment_type_id = 1
|
||||
@payment.amount = params[:amount].to_f
|
||||
|
||||
@payment.ogone_payid = params[:PAYID]
|
||||
@payment.ogone_pm = params[:PM]
|
||||
@payment.ogone_status = params[:STATUS]
|
||||
@payment.ogone_acceptance = params[:ACCEPTANCE]
|
||||
@payment.ogone_cardno = params[:CARDNO]
|
||||
@payment.ogone_ed = params[:ED]
|
||||
@payment.ogone_cn = params[:CN]
|
||||
@payment.ogone_trxdate = params[:TRXDATE]
|
||||
@payment.ogone_ncerror = params[:NCERROR]
|
||||
@payment.ogone_brand = params[:BRAND]
|
||||
@payment.ogone_subbrand = params[:SUBBRAND]
|
||||
@payment.ogone_eci = params[:ECI]
|
||||
@payment.ogone_ip = params[:IP]
|
||||
@payment.ogone_alias = params[:ALIAS]
|
||||
@payment.ogone_cb_expiration = Date.parse(params[:ED][2..3].to_s+"/"+params[:ED][0..1].to_s+"/01") if params[:ED]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if params["STATUS"].to_i == 9
|
||||
if !@payment.paid
|
||||
@payment.paid_at = Time.now
|
||||
|
||||
|
||||
|
||||
@payment.paid = true
|
||||
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
@payment.paid = false
|
||||
|
||||
end
|
||||
|
||||
@payment.save
|
||||
|
||||
if @payment.paid and @payment.element
|
||||
|
||||
@payment.element.after_paid
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update_paypal_infos
|
||||
|
||||
if params[:payment_status] == "Completed"
|
||||
if !@order.paid
|
||||
@payment.paid_at = Time.now
|
||||
|
||||
@order.paid_at = @payment.paid_at
|
||||
|
||||
@order.paid = true
|
||||
|
||||
if @order.recurrent
|
||||
|
||||
@order = true
|
||||
|
||||
DonateTransactionsMails.general("fr", "confirmation_paypal_rec", @order).deliver
|
||||
else
|
||||
@gen_recu = true
|
||||
DonateTransactionsMails.general("fr", "confirmation_paypal", @order).deliver
|
||||
end
|
||||
@order.check_newsletter
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
@order.paid = false
|
||||
|
||||
end
|
||||
@order.completed_finish = true
|
||||
|
||||
@payment.save
|
||||
@order.tr_payment_ok = @payment if @order.paid
|
||||
@order.save
|
||||
|
||||
|
||||
|
||||
if @generate_recurrent
|
||||
|
||||
@order.create_recurrent_payment
|
||||
@order.generated_recurrent_payment.generate_infos
|
||||
|
||||
|
||||
end
|
||||
|
||||
if @gen_recu
|
||||
@order.generate_recu
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
22
app/models/abonnement.rb
Normal file
22
app/models/abonnement.rb
Normal file
@ -0,0 +1,22 @@
|
||||
class Abonnement < ActiveRecord::Base
|
||||
|
||||
has_many :payments, :as => :element
|
||||
|
||||
def after_paid
|
||||
self.paid = true
|
||||
self.save
|
||||
end
|
||||
|
||||
def total_price_ht
|
||||
self.price
|
||||
end
|
||||
|
||||
def total_price_ttc
|
||||
total_price_ht + total_price_ht * tva
|
||||
end
|
||||
|
||||
def tva
|
||||
0.2
|
||||
end
|
||||
|
||||
end
|
@ -1,5 +1,8 @@
|
||||
class Customer < ActiveRecord::Base
|
||||
|
||||
has_many :abonnements
|
||||
has_many :payments
|
||||
|
||||
belongs_to :particular_bill, :class_name => "Particular"
|
||||
|
||||
accepts_nested_attributes_for :particular_bill
|
||||
|
23
app/models/payment.rb
Normal file
23
app/models/payment.rb
Normal file
@ -0,0 +1,23 @@
|
||||
class Payment < ActiveRecord::Base
|
||||
|
||||
belongs_to :element, :polymorphic => true
|
||||
|
||||
before_create do
|
||||
generate_token
|
||||
end
|
||||
|
||||
before_validation do
|
||||
self.iban = self.iban.to_s.gsub(/\s+/, "")
|
||||
end
|
||||
|
||||
def generate_token
|
||||
|
||||
if !self.token
|
||||
begin
|
||||
self.token = SecureRandom.hex(8)
|
||||
end while Payment.exists?(:token => self.token)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
12
app/views/public/abonnements/new.html.haml
Normal file
12
app/views/public/abonnements/new.html.haml
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
=semantic_form_for [:public, @abonnement] do |f|
|
||||
=f.hidden_field :start_at
|
||||
=f.hidden_field :end_at
|
||||
=f.hidden_field :price
|
||||
=f.hidden_field :slug
|
||||
|
||||
.center
|
||||
|
||||
%p Pour profiter des fonctions de Négos, vous pouvez dès à présent souscrire à un abonnement pour 300€ HT (360€ TTC)
|
||||
|
||||
=submit_tag "Souscrire maintenant >", :class => "btn btn-primary"
|
12
app/views/public/payments/paid.html.haml
Normal file
12
app/views/public/payments/paid.html.haml
Normal file
@ -0,0 +1,12 @@
|
||||
.center
|
||||
%h1
|
||||
Payer mon abonnement
|
||||
|
||||
-if params[:orderID]
|
||||
%p
|
||||
Votre paiement CB a échoué, pour tenter de nouveau merci de suivre ce lien :
|
||||
%br
|
||||
=link_to "Payer par CB", paid_by_ogone_public_payment_path(@payment), :class => "btn btn-primary"
|
||||
-else
|
||||
%p
|
||||
=link_to "Payer par CB", paid_by_ogone_public_payment_path(@payment), :class => "btn btn-primary"
|
10
app/views/public/payments/paid_by_ogone.html.haml
Normal file
10
app/views/public/payments/paid_by_ogone.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
.center
|
||||
%p Vous allez être redirigé automatiquement sur le serveur de paiement sécurisé par Ogone. Si ce n'est pas le cas, merci de cliquer sur "payer maintenant"
|
||||
%form{:action => CONFIG_OGONE["ecom_url"], :id => "ogone_form"}
|
||||
-form_content = ogone_fields(@ogone_options)
|
||||
-form_content << '<input type="submit" value="payer maintenant" />'
|
||||
=raw form_content
|
||||
|
||||
:javascript
|
||||
$("#ogone_form").submit()
|
||||
|
@ -0,0 +1,4 @@
|
||||
.center
|
||||
%h1 Merci pour votre paiement !
|
||||
%p
|
||||
Vous pouvez désormais profiter de votre abonnement.
|
@ -44,5 +44,5 @@ Rails.application.configure do
|
||||
config.action_mailer.default_url_options = { host: 'localhost', port: 3000}
|
||||
|
||||
|
||||
HOSTNAME="localhost:3000"
|
||||
HOSTNAME="78.245.74.12"#"localhost:3000"
|
||||
end
|
||||
|
1
config/initializers/ogone.rb
Normal file
1
config/initializers/ogone.rb
Normal file
@ -0,0 +1 @@
|
||||
CONFIG_OGONE = YAML.load_file("#{Rails.root.to_s}/config/ogone.yml")[Rails.env]
|
24
config/ogone.yml
Normal file
24
config/ogone.yml
Normal file
@ -0,0 +1,24 @@
|
||||
development:
|
||||
pspid: "NEGOS"
|
||||
sha_in: "Mysecretsig1875!?"
|
||||
sha_in_dl: " "
|
||||
sha_out: "MyDSecretsig1875!?"
|
||||
currency: "EUR"
|
||||
language: "fr_FR"
|
||||
direct_url: "https://secure.ogone.com/ncol/test/orderdirect.asp"
|
||||
ecom_url: "https://secure.ogone.com/ncol/test/orderstandard_utf8.asp"
|
||||
api_user: " "
|
||||
api_pswd: " "
|
||||
mode: 'test'
|
||||
production:
|
||||
pspid: "NEGOS"
|
||||
sha_in: "MysecrVts!?ig1875"
|
||||
sha_in_dl: " "
|
||||
sha_out: "MyDSec!?radsig1865"
|
||||
currency: "EUR"
|
||||
language: "fr_FR"
|
||||
direct_url: "https://secure.ogone.com/ncol/prod/orderdirect.asp"
|
||||
ecom_url: "https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp"
|
||||
api_user: " "
|
||||
api_pswd: " "
|
||||
mode: 'live'
|
@ -4,6 +4,8 @@ Rails.application.routes.draw do
|
||||
get "vouisstar" => "public/home#vouisstar"
|
||||
|
||||
|
||||
get "/ogoneipn" => "public/payments#ogone_ipn", :as => :ogone_ipn_public_payments
|
||||
|
||||
constraints subdomain: 'commander' do
|
||||
|
||||
get "/" => "public/home#vouisstar"
|
||||
@ -22,6 +24,18 @@ Rails.application.routes.draw do
|
||||
get 'p/:mlm_token' => "public/customers#parrainage", :as => :mlm_token
|
||||
|
||||
namespace :public do
|
||||
resources :payments do
|
||||
member do
|
||||
get :paid_by_ogone
|
||||
get :paid_by_ogone_confirm
|
||||
get :paid
|
||||
end
|
||||
collection do
|
||||
get :ogone_ipn
|
||||
end
|
||||
end
|
||||
resources :abonnements
|
||||
|
||||
resources :conversations
|
||||
get 'documents/:download_token', to: 'documents#download', as: :download_document
|
||||
|
||||
|
16
db/migrate/20180209004732_create_abonnements.rb
Normal file
16
db/migrate/20180209004732_create_abonnements.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class CreateAbonnements < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :abonnements do |t|
|
||||
t.integer :abonnement_type_id
|
||||
t.string :slug
|
||||
t.datetime :start_at
|
||||
t.datetime :end_at
|
||||
t.boolean :paid
|
||||
t.boolean :enabled
|
||||
t.decimal :price, precision: 10, scale: 2
|
||||
t.references :customer
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
46
db/migrate/20180209010600_create_payments.rb
Normal file
46
db/migrate/20180209010600_create_payments.rb
Normal file
@ -0,0 +1,46 @@
|
||||
class CreatePayments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :payments do |t|
|
||||
t.references :customer
|
||||
|
||||
t.string :element_type
|
||||
t.integer :element_id
|
||||
|
||||
t.datetime :paid_at
|
||||
t.boolean :paid
|
||||
|
||||
t.string :ogone_payid
|
||||
t.string :ogone_pm
|
||||
t.string :ogone_status
|
||||
t.string :ogone_acceptance
|
||||
t.string :ogone_cardno
|
||||
t.string :ogone_ed
|
||||
t.string :ogone_cn
|
||||
t.string :ogone_trxdate
|
||||
t.string :ogone_ncerror
|
||||
t.string :ogone_brand
|
||||
t.string :ogone_subbrand
|
||||
t.string :ogone_eci
|
||||
t.string :ogone_ip
|
||||
t.string :ogone_alias
|
||||
t.date :ogone_cb_expiration
|
||||
|
||||
t.string :iban
|
||||
t.string :bic
|
||||
t.string :token
|
||||
|
||||
t.string :check_number
|
||||
t.string :check_bank
|
||||
|
||||
t.decimal :amount, precision: 10, scale: 2
|
||||
t.integer :payment_type_id
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
47
db/schema.rb
47
db/schema.rb
@ -11,7 +11,20 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171220122439) do
|
||||
ActiveRecord::Schema.define(version: 20180209010600) do
|
||||
|
||||
create_table "abonnements", force: :cascade do |t|
|
||||
t.integer "abonnement_type_id", limit: 4
|
||||
t.string "slug", limit: 255
|
||||
t.datetime "start_at"
|
||||
t.datetime "end_at"
|
||||
t.boolean "paid", limit: 1
|
||||
t.boolean "enabled", limit: 1
|
||||
t.decimal "price", precision: 10, scale: 2
|
||||
t.integer "customer_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "accepted_offers", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
@ -629,6 +642,38 @@ ActiveRecord::Schema.define(version: 20171220122439) do
|
||||
t.string "civilite", limit: 255
|
||||
end
|
||||
|
||||
create_table "payments", force: :cascade do |t|
|
||||
t.integer "customer_id", limit: 4
|
||||
t.string "element_type", limit: 255
|
||||
t.integer "element_id", limit: 4
|
||||
t.datetime "paid_at"
|
||||
t.boolean "paid", limit: 1
|
||||
t.string "ogone_payid", limit: 255
|
||||
t.string "ogone_pm", limit: 255
|
||||
t.string "ogone_status", limit: 255
|
||||
t.string "ogone_acceptance", limit: 255
|
||||
t.string "ogone_cardno", limit: 255
|
||||
t.string "ogone_ed", limit: 255
|
||||
t.string "ogone_cn", limit: 255
|
||||
t.string "ogone_trxdate", limit: 255
|
||||
t.string "ogone_ncerror", limit: 255
|
||||
t.string "ogone_brand", limit: 255
|
||||
t.string "ogone_subbrand", limit: 255
|
||||
t.string "ogone_eci", limit: 255
|
||||
t.string "ogone_ip", limit: 255
|
||||
t.string "ogone_alias", limit: 255
|
||||
t.date "ogone_cb_expiration"
|
||||
t.string "iban", limit: 255
|
||||
t.string "bic", limit: 255
|
||||
t.string "token", limit: 255
|
||||
t.string "check_number", limit: 255
|
||||
t.string "check_bank", limit: 255
|
||||
t.decimal "amount", precision: 10, scale: 2
|
||||
t.integer "payment_type_id", limit: 4
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "portlets", force: :cascade do |t|
|
||||
t.integer "block_id", limit: 4
|
||||
t.integer "content_id", limit: 4
|
||||
|
17
test/fixtures/abonnements.yml
vendored
Normal file
17
test/fixtures/abonnements.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
abonnement_type_id: 1
|
||||
slug: MyString
|
||||
start_at: 2018-02-09 01:47:32
|
||||
end_at: 2018-02-09 01:47:32
|
||||
paid: false
|
||||
enabled: false
|
||||
|
||||
two:
|
||||
abonnement_type_id: 1
|
||||
slug: MyString
|
||||
start_at: 2018-02-09 01:47:32
|
||||
end_at: 2018-02-09 01:47:32
|
||||
paid: false
|
||||
enabled: false
|
9
test/fixtures/payments.yml
vendored
Normal file
9
test/fixtures/payments.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
paid_at: 2018-02-09 02:06:00
|
||||
paid: false
|
||||
|
||||
two:
|
||||
paid_at: 2018-02-09 02:06:00
|
||||
paid: false
|
7
test/models/abonnement_test.rb
Normal file
7
test/models/abonnement_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AbonnementTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/payment_test.rb
Normal file
7
test/models/payment_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PaymentTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user