Commit e7c178aa by Mykhailo Makohin

add payment to activeadmin and finish liqpay

parent 09630221
...@@ -38,8 +38,8 @@ gem 'acts_as_list' ...@@ -38,8 +38,8 @@ gem 'acts_as_list'
gem 'rails_sortable' gem 'rails_sortable'
gem 'aasm' gem 'aasm'
gem 'ransack' gem 'ransack'
gem 'liqpay', '~>1.0.0' gem 'liqpay', github: 'liqpay/sdk-ruby'
gem 'country_select', '~> 4.0'
group :development, :test do group :development, :test do
gem 'byebug', platform: :mri gem 'byebug', platform: :mri
......
GIT
remote: https://github.com/liqpay/sdk-ruby.git
revision: a7a990f1410bdfc281fcfc66828555b4bc1e6260
specs:
liqpay (0.0.2)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -96,6 +102,13 @@ GEM ...@@ -96,6 +102,13 @@ GEM
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.5) concurrent-ruby (1.1.5)
countries (3.0.0)
i18n_data (~> 0.8.0)
sixarm_ruby_unaccent (~> 1.1)
unicode_utils (~> 1.4)
country_select (4.0.0)
countries (~> 3.0)
sort_alphabetical (~> 1.0)
crass (1.0.4) crass (1.0.4)
devise (4.7.1) devise (4.7.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
...@@ -131,6 +144,7 @@ GEM ...@@ -131,6 +144,7 @@ GEM
hashie (3.6.0) hashie (3.6.0)
i18n (1.6.0) i18n (1.6.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
image_processing (1.9.3) image_processing (1.9.3)
mini_magick (>= 4.9.5, < 5) mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.13, < 3) ruby-vips (>= 2.0.13, < 3)
...@@ -159,7 +173,6 @@ GEM ...@@ -159,7 +173,6 @@ GEM
activerecord activerecord
kaminari-core (= 1.1.1) kaminari-core (= 1.1.1)
kaminari-core (1.1.1) kaminari-core (1.1.1)
liqpay (1.0.1)
listen (3.0.8) listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
...@@ -274,6 +287,9 @@ GEM ...@@ -274,6 +287,9 @@ GEM
simple_form (4.1.0) simple_form (4.1.0)
actionpack (>= 5.0) actionpack (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
sixarm_ruby_unaccent (1.2.0)
sort_alphabetical (1.1.0)
unicode_utils (>= 1.2.2)
spring (2.0.2) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
...@@ -303,6 +319,7 @@ GEM ...@@ -303,6 +319,7 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.20) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode_utils (1.4.0)
video_info (2.7) video_info (2.7)
iso8601 (~> 0.9.1) iso8601 (~> 0.9.1)
net_http_timeout_errors (~> 0.3.0) net_http_timeout_errors (~> 0.3.0)
...@@ -333,6 +350,7 @@ DEPENDENCIES ...@@ -333,6 +350,7 @@ DEPENDENCIES
ckeditor (~> 4.3) ckeditor (~> 4.3)
cocoon cocoon
coffee-rails (~> 4.2) coffee-rails (~> 4.2)
country_select (~> 4.0)
devise devise
friendly_id friendly_id
globalize globalize
...@@ -341,7 +359,7 @@ DEPENDENCIES ...@@ -341,7 +359,7 @@ DEPENDENCIES
haml haml
jbuilder (~> 2.5) jbuilder (~> 2.5)
jquery-rails jquery-rails
liqpay (~> 1.0.0) liqpay!
listen (~> 3.0.5) listen (~> 3.0.5)
mini_magick mini_magick
mysql2 (>= 0.3.18, < 0.6.0) mysql2 (>= 0.3.18, < 0.6.0)
......
ActiveAdmin.register Payment do
menu label: proc{ I18n.t "active_admin.models.payment" }
permit_params :sender_card_country
index title: proc{ I18n.t "active_admin.models.payment" } do
selectable_column
id_column
column "User" do |p|
p.user
end
column "Email" do |p|
p.user.email
end
column "Project" do |p|
p.project
end
column "Amount" do |p|
p.amount
end
column "Description" do |p|
p.description
end
column "Status" do |p|
status_tag "#{p.status}", class: 'important'
end
column "Created" do |p|
p.created_at
end
column "Updated" do |p|
p.updated_at
end
actions
end
show do
attributes_table do
row :id
row "Project" do |p|
p.project
end
row "User" do |p|
p.user.name
end
row "Email" do |p|
p.user.email
end
row "Project" do |p|
p.project
end
row "Action" do |p|
p.action
end
row "Phone" do |p|
p.sender_phone
end
row "Pay type" do |p|
p.paytype
end
row "Amount" do |p|
p.amount
end
row "Description" do |p|
p.description
end
row "Currency" do |p|
p.currency
end
row "Country code" do |p|
p.sender_card_country
end
row "Payment id" do |p|
p.payment_id
end
row "Status" do |p|
status_tag "#{p.status}"
end
row "API version" do |p|
p.version
end
row "Create date" do |p|
p.create_date
end
row "End date" do |p|
p.end_date
end
row "Transaction id" do |p|
p.transaction_id
end
row "Created" do |p|
p.created_at
end
row "Updated" do |p|
p.updated_at
end
end
end
form do |f|
f.inputs do
f.input :project
f.input :user
f.input :sender_phone
f.input :amount
f.input :description
f.input :currency
f.input :sender_card_country, as: :country
end
f.actions
end
end
...@@ -18,7 +18,7 @@ ActiveAdmin.register Project do ...@@ -18,7 +18,7 @@ ActiveAdmin.register Project do
filter :updated_at, label: I18n.t("active_admin.attributes.project.updated_at") filter :updated_at, label: I18n.t("active_admin.attributes.project.updated_at")
controller do controller do
skip_before_action :verify_authenticity_token # skip_before_action :verify_authenticity_token
def create def create
@project = Project.new(project_params) @project = Project.new(project_params)
......
...@@ -36,10 +36,9 @@ jQuery(document).ready(function($){ ...@@ -36,10 +36,9 @@ jQuery(document).ready(function($){
function submitForm(){ function submitForm(){
$( ".simple_form" ).submit(function() { $( ".simple_form" ).submit(function() {
if ($(this).valid() && $( "#contributions_attributes_contribution" ).val() > '0' ) { if ($(this).valid() && $( "#payments_attributes_amount" ).val() > '0' ) {
$('#modal').modal('hide'); $('#modal').modal('hide');
$('#modal_payment').modal('show'); $(".modal-backdrop").remove();
// $(".modal-backdrop").remove();
} }
}); });
} }
...@@ -74,6 +73,7 @@ function scrollToTop() { ...@@ -74,6 +73,7 @@ function scrollToTop() {
$('#scroller').fadeOut(); $('#scroller').fadeOut();
} }
}); });
$('#scroller').click(function () { $('#scroller').click(function () {
$('body,html').animate({ $('body,html').animate({
scrollTop: 0 scrollTop: 0
...@@ -89,12 +89,11 @@ function initTwentytwenty() { ...@@ -89,12 +89,11 @@ function initTwentytwenty() {
} }
function onlyNumbers(){ function onlyNumbers(){
$("#contributions_attributes_contribution").keypress(function (e) { $("#payments_attributes_amount").keypress(function (e) {
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false; return false;
} }
else { else {
console.log($("input#contributions_attributes_contribution").val());
$('div.form-group.amount').addClass('form_ok') $('div.form-group.amount').addClass('form_ok')
} }
}); });
......
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
// Overriding any non-variable SASS must be done after the fact. // Overriding any non-variable SASS must be done after the fact.
// For example, to change the default status-tag color: // For example, to change the default status-tag color:
// //
// .status_tag { background: #6090DB; } .status_tag { background: green; }
class ContributionsController < ApplicationController
def create
@contrbution = Contribution.create(contribition_params)
if @contrbution.save
redirect_to root_path
else
ap @contrbution.errors
head :ok
end
end
private
def contribition_params
params.require(:contribution).permit(:contribution, :project_id, :user_id)
end
end
\ No newline at end of file
class PaymentsController < ApplicationController
protect_from_forgery :except => :liqpay_payment
skip_before_action :verify_authenticity_token
def liqpay_payment
data = request.parameters['data']
signature = request.parameters['signature']
liqpay = Liqpay.new
if liqpay.match?(data, signature)
responce_hash = liqpay.decode_data(data)
responce_hash["type_of_payment"] = responce_hash.delete("type")
responce_hash["project_id"] = responce_hash["order_id"].split("_")[0]
responce_hash["user_id"] = current_user.id
if responce_hash['status'] == "success"
Payment.create(responce_hash)
end
end
redirect_to root_path
end
end
...@@ -2,13 +2,5 @@ class ProjectsController < ApplicationController ...@@ -2,13 +2,5 @@ class ProjectsController < ApplicationController
respond_to :js respond_to :js
def show def show
@project = Project.friendly.find(params[:id]) @project = Project.friendly.find(params[:id])
@liqpay_request = Liqpay::Request.new(
amount: '999.99',
currency: 'UAH',
order_id: '123',
description: 'Some Product',
public_key: 'sandbox_i30820512794',
private_key: 'sandbox_0zBjPvvb13LMKaqRWJScxzqRz1EzZquRKZcXdUex'
)
end end
end end
...@@ -19,12 +19,10 @@ class UsersController < ApplicationController ...@@ -19,12 +19,10 @@ class UsersController < ApplicationController
@errorEmail = [] @errorEmail = []
@errorName = [] @errorName = []
@errorContribution = [] @errorContribution = []
if params[:contributions_attributes][:contribution] < '1' if params[:payments_attributes][:amount] < '1'
@errorContribution.push('Amount must be greater than or equal 1 uah') @errorContribution.push('Amount must be greater than or equal 1 uah')
end end
# @liqpay = Liqpay.new
if @user.save if @user.save
# Contribution.create(contribution: params[:contributions_attributes][:contribution], user_id: @user.id)
else else
respond_to do |format| respond_to do |format|
format.js format.js
...@@ -78,7 +76,7 @@ class UsersController < ApplicationController ...@@ -78,7 +76,7 @@ class UsersController < ApplicationController
end end
def user_params def user_params
params.require(:user).permit(:email, :name, :location, :picture, :avatar, :role, contributions_attributes: [:id, :user_id, :contribution]) params.require(:user).permit(:email, :name, :location, :picture, :avatar, :role, payments_attributes: [:id, :user_id, :contribution])
end end
end end
\ No newline at end of file
...@@ -16,6 +16,7 @@ class Ability ...@@ -16,6 +16,7 @@ class Ability
# User related abilities # User related abilities
can :manage, User can :manage, User
can :manage, Project can :manage, Project
can :manage, Payment
end end
end end
end end
class Payment < ApplicationRecord
belongs_to :user
belongs_to :project
validates :payment_id, uniqueness: true
end
...@@ -30,7 +30,7 @@ class Project < ApplicationRecord ...@@ -30,7 +30,7 @@ class Project < ApplicationRecord
enum types: [:program, :project] enum types: [:program, :project]
enum status: [:in_progress, :implemented] enum status: [:in_progress, :implemented]
has_many :contributions has_many :payments, dependent: :destroy
has_many :project_partials, -> { order(position: :asc) }, dependent: :destroy has_many :project_partials, -> { order(position: :asc) }, dependent: :destroy
has_many :project_galeries, inverse_of: :project, dependent: :destroy has_many :project_galeries, inverse_of: :project, dependent: :destroy
has_many :project_qoutes, inverse_of: :project, dependent: :destroy has_many :project_qoutes, inverse_of: :project, dependent: :destroy
......
...@@ -5,8 +5,7 @@ class User < ApplicationRecord ...@@ -5,8 +5,7 @@ class User < ApplicationRecord
mount_uploader :avatar, AvatarUploader mount_uploader :avatar, AvatarUploader
has_many :contributions has_many :payments, dependent: :destroy
accepts_nested_attributes_for :contributions
enum role: [:user, :admin] enum role: [:user, :admin]
......
#modal_pay
.wrapper .wrapper
.content .content
.main_head .main_head
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
%link{:href => "https://fonts.googleapis.com/css?family=Montserrat:300|Six+Caps", :rel => "stylesheet"} %link{:href => "https://fonts.googleapis.com/css?family=Montserrat:300|Six+Caps", :rel => "stylesheet"}
%body %body
= render 'partials/modal' = render 'partials/modal'
= render 'partials/modal_payment'
= render 'partials/modal_registration' = render 'partials/modal_registration'
- if current_page?('/') || current_page?('/en') || current_page?('/uk') - if current_page?('/') || current_page?('/en') || current_page?('/uk')
= render 'partials/black_header' = render 'partials/black_header'
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
%h3#modalLabel.modal-title The funding %h3#modalLabel.modal-title The funding
.col-sm-7.modal-header_bot_amount .col-sm-7.modal-header_bot_amount
.form-group.amount .form-group.amount
= simple_fields_for :contributions_attributes do |contributions_form| = simple_fields_for :payments_attributes do |payments_form|
= contributions_form.input :contribution, required: false, label: 'Amount in UAH', input_html: { class: 'form-group amount_field' } = payments_form.input :amount, required: false, label: 'Amount in UAH', input_html: { class: 'form-group amount_field' }
- if @project
= payments_form.hidden_field :project_id, value: @project.id
%span.error_text#contributionBlock.help-block %span.error_text#contributionBlock.help-block
%span.error_text %span.error_text
#required_fields.help_text.absolute #required_fields.help_text.absolute
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
.form-group .form-group
= f.label :email, 'E-mail' = f.label :email, 'E-mail'
.field_wrap .field_wrap
= f.input :email, label: false = f.input :email, label: false, required: false
%span.error_text#emailBlock.help-block %span.error_text#emailBlock.help-block
.form-group .form-group
= f.label :name, 'Fist name and Last name' = f.label :name, 'Fist name and Last name'
...@@ -44,9 +46,9 @@ ...@@ -44,9 +46,9 @@
%h4.modal_subtitle %h4.modal_subtitle
Express sign in Express sign in
.soc_btn_wrap.clearfix .soc_btn_wrap.clearfix
%a.soc_btn.soc_btn_fb{:href => "/users/auth/facebook?for_map=false&locale=en"} = link_to user_facebook_omniauth_authorize_path, class: 'soc_btn soc_btn_fb' do
%i.icon.icon_fb %i.icon.icon_fb
%a.soc_btn.soc_btn_google{:href => "/users/auth/google_oauth2?for_map=false&locale=en"} = link_to user_google_oauth2_omniauth_authorize_path, class: 'soc_btn soc_btn_google' do
%i.icon.icon_google %i.icon.icon_google
.text-center .text-center
= f.submit "Next step", class: "btn btn_primary", "data-target" => "#modal2" = f.submit "Next step", class: "btn btn_primary"
#modal_payment.modal.modal_styled{"aria-labelledby" => "modalLabel", :role => "dialog", :tabindex => "-1"} #modal_payment.fade.modal.modal_styled{"aria-labelledby" => "modalLabel", role: "dialog", tabindex: "-1"}
.modal-dialog{:role => "document"} .modal-dialog{role: "document"}
.modal-content .modal-content
.modal-header .modal-header
.modal-header_top.clearfix .modal-header_top.clearfix
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.modal-header_steps_wrap .modal-header_steps_wrap
%span.modal-header_step крок 1 %span.modal-header_step крок 1
%span.modal-header_step.active крок 2 %span.modal-header_step.active крок 2
%button.round_link.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"} %button.round_link.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"}
%i.icon.icon_close %i.icon.icon_close
.modal-header_bot .modal-header_bot
.row .row
...@@ -15,23 +15,22 @@ ...@@ -15,23 +15,22 @@
%h3#modalLabel.modal-title Фондування %h3#modalLabel.modal-title Фондування
.col-sm-7.modal-header_bot_amount .col-sm-7.modal-header_bot_amount
.form-group .form-group
%label{:for => "id_1"} %label{ for: "id_1"}
Сума внеску в Сума внеску в
%span.currency UAH %span.currency UAH
%span.amount_value 1 000 000 000 %span.amount_value #{payment.amount}
.modal-body .modal-body
.help_text Оберіть платіжну систему зручну для вас .help_text Оберіть платіжну систему зручну для вас
.radio .radio
.radio_item .radio_item
%input#liqpay{:checked => "checked", :name => "payment_system", :type => "radio", :value => "liqpay"} %input#liqpay{ checked: "checked", name: "payment_system", type: "radio", value: "liqpay" }
%label{:for => "liqpay"} %label{ for: "liqpay" }
= image_tag('liqpay.png') = image_tag( 'liqpay.png' )
.radio_item .radio_item
%input#webmoney{:name => "payment_system", :type => "radio", :value => "webmoney"}/ %input#webmoney{ name: "payment_system", type: "radio", value: "webmoney" }
%label{:for => "webmoney"} %label{ for: "webmoney" }
= image_tag('w4p_white.png') = image_tag( 'w4p_white.png' )
.text-center.modal_btns .text-center.modal_btns
%a.btn.btn_primary{:href => "#"} оплатити = raw Liqpay.new.cnb_form( { action: "pay", amount: payment.amount, currency: "UAH", description: "Dobrovilna pozhertva", order_id: "#{payment.project_id}_#{SecureRandom.hex}", result_url: "http://localhost:3000/payments/liqpay_payment", server_url: "http://localhost:3000/payments/liqpay_payment", version: "3" } )
.nav_link .nav_link
%a.link{"data-dismiss" => "modal", "data-target" => "#modal", "data-toggle" => "modal", :type => "button"} Назад %a.link{ "data-dismiss" => "modal", "data-target" => "#modal", "data-toggle" => "modal", type: "button" } Назад
= liqpay_button Liqpay::Request.new(amount: '999.99', currency: 'UAH',order_id: '123', description: 'Some Product', public_key: 'sandbox_i30820512794',private_key: 'sandbox_0zBjPvvb13LMKaqRWJScxzqRz1EzZquRKZcXdUex'), title: "Pay now!"
#modal_pay
.wrapper .wrapper
.content .content
.head_block{:style => "background: transparent url(#{@project.photo.url}) no-repeat center center;background-size: cover; margin-bottom: 6px;"} .head_block{style: "background: transparent url(#{@project.photo.url}) no-repeat center center;background-size: cover; margin-bottom: 6px;"}
.container .container
.info_title .info_title
%span.info_title_text= t "#{@project.types}" %span.info_title_text= t "#{@project.types}"
%a.info_link #{@project.site} %a.info_link #{@project.site}
%h2.heading_with_btn %h2.heading_with_btn
%span #{@project.title} %span #{@project.title}
%a.btn.btn_default{"data-target" => "#modal", "data-toggle" => "modal", :href => "#"} %a.btn.btn_default{"data-target" => "#modal", "data" => "#{@project.id}", "data-toggle" => "modal", :href => "#"}
%i.icon.icon_plus> %i.icon.icon_plus>
= t ('donate') = t ('donate')
.large_progress_wrap .large_progress_wrap
.large_progress_title .large_progress_title
= liqpay_button @liqpay_request, title: "Pay now!"
= t "#{@project.status}" = t "#{@project.status}"
.project_content .project_content
.project_partials .project_partials
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
%ul %ul
%li %li
= render "#{project_partial.title}" = render "#{project_partial.title}"
.support_block{:style => "background: transparent url(#{@project.footer_photo.url}) no-repeat center center; padding: 30px 0 20px; background-size: cover;"} .support_block{style: "background: transparent url(#{@project.footer_photo.url}) no-repeat center center; padding: 30px 0 20px; background-size: cover;"}
.container .container
%h2.heading_with_btn %h2.heading_with_btn
%span #{@project.title} %span #{@project.title}
...@@ -74,4 +74,3 @@ ...@@ -74,4 +74,3 @@
:javascript :javascript
new BeerSlider( document.getElementById( "slider" ) ); new BeerSlider( document.getElementById( "slider" ) );
...@@ -10,3 +10,6 @@ $("#nameBlock:contains(Name)").closest(".form-group").addClass("has-error"); ...@@ -10,3 +10,6 @@ $("#nameBlock:contains(Name)").closest(".form-group").addClass("has-error");
$("#contributionBlock").html("#{escape_javascript(@errorContribution[0])}"); $("#contributionBlock").html("#{escape_javascript(@errorContribution[0])}");
$("#contributionBlock:contains()").closest(".form-group").addClass("has-success"); $("#contributionBlock:contains()").closest(".form-group").addClass("has-success");
$("#contributionBlock:contains(1)").closest(".form-group").addClass("has-error"); $("#contributionBlock:contains(1)").closest(".form-group").addClass("has-error");
$("#modal_pay").html("#{ j(render 'partials/modal_payment', payment: Payment.new(amount: params[:payments_attributes][:amount], project_id: params[:payments_attributes][:project_id]))}");
$("#modal_payment").modal('show');
\ No newline at end of file
Liqpay.default_options = { ::Liqpay.configure do |config|
public_key: 'sandbox_i30820512794', config.public_key = 'sandbox_i30820512794'
private_key: 'sandbox_0zBjPvvb13LMKaqRWJScxzqRz1EzZquRKZcXdUex', config.private_key = 'sandbox_0zBjPvvb13LMKaqRWJScxzqRz1EzZquRKZcXdUex'
currency: 'UAH' end
}
\ No newline at end of file
...@@ -23,6 +23,7 @@ en: ...@@ -23,6 +23,7 @@ en:
project: project:
one: "Project" one: "Project"
other: "Projects" other: "Projects"
payment: "Payments"
attributes: attributes:
user: user:
email: "Email" email: "Email"
......
...@@ -17,6 +17,7 @@ uk: ...@@ -17,6 +17,7 @@ uk:
project: project:
one: "Проект" one: "Проект"
other: "Проекти" other: "Проекти"
payment: "Платежі"
user/role: user/role:
admin: "Адмін" admin: "Адмін"
user: "Користувач" user: "Користувач"
......
...@@ -2,12 +2,17 @@ Rails.application.routes.draw do ...@@ -2,12 +2,17 @@ Rails.application.routes.draw do
scope "(:locale)", locale: /en|uk/ do scope "(:locale)", locale: /en|uk/ do
mount Ckeditor::Engine => '/ckeditor' mount Ckeditor::Engine => '/ckeditor'
root 'home#index' root 'home#index'
get "/autocomplete_user", to: "users#autocomplete_user" get "/autocomplete_user", to: "users#autocomplete_user"
put "/admin/projects/:id", to: 'admin/projects#sort' put "/admin/projects/:id", to: 'admin/projects#sort'
ActiveAdmin.routes(self) ActiveAdmin.routes(self)
resources :users resources :users
resources :contributions, only: [:create]
resources :projects, only: [:show] resources :projects, only: [:show]
resources :payments do
collection do
post :liqpay_payment, to: "payments#liqpay_payment", as: :liqpay_payment
end
end
end end
devise_for :users, controllers: {omniauth_callbacks: "users/omniauth_callbacks", devise_for :users, controllers: {omniauth_callbacks: "users/omniauth_callbacks",
registrations: "users"} registrations: "users"}
......
class CreateContributions < ActiveRecord::Migration[5.0]
def change
create_table :contributions do |t|
t.integer :contribution
t.references :user
t.references :project
t.timestamps
end
end
end
class CreatePayments < ActiveRecord::Migration[5.0]
def change
create_table :payments do |t|
t.string :action
t.integer :payment_id
t.string :status
t.integer :version
t.string :type_of_payment
t.string :paytype
t.string :public_key
t.integer :acq_id
t.string :order_id
t.string :liqpay_order_id
t.string :description
t.string :sender_phone
t.string :sender_card_mask2
t.string :sender_card_bank
t.string :sender_card_type
t.integer :sender_card_country
t.string :ip
t.float :amount
t.string :currency
t.float :sender_commission
t.float :receiver_commission
t.float :agent_commission
t.float :amount_debit
t.float :amount_credit
t.float :commission_debit
t.float :commission_credit
t.string :currency_debit
t.string :currency_credit
t.float :sender_bonus
t.float :amount_bonus
t.string :mpi_eci
t.boolean :is_3ds
t.string :language
t.bigint :create_date
t.bigint :end_date
t.integer :transaction_id
t.references :user
t.references :project
t.timestamps
end
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20191031114255) do ActiveRecord::Schema.define(version: 20191119123400) do
create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "namespace" t.string "namespace"
...@@ -38,16 +38,6 @@ ActiveRecord::Schema.define(version: 20191031114255) do ...@@ -38,16 +38,6 @@ ActiveRecord::Schema.define(version: 20191031114255) do
t.index ["type"], name: "index_ckeditor_assets_on_type", using: :btree t.index ["type"], name: "index_ckeditor_assets_on_type", using: :btree
end end
create_table "contributions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "contribution"
t.integer "user_id"
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_contributions_on_project_id", using: :btree
t.index ["user_id"], name: "index_contributions_on_user_id", using: :btree
end
create_table "friendly_id_slugs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "friendly_id_slugs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "slug", null: false t.string "slug", null: false
t.integer "sluggable_id", null: false t.integer "sluggable_id", null: false
...@@ -59,6 +49,51 @@ ActiveRecord::Schema.define(version: 20191031114255) do ...@@ -59,6 +49,51 @@ ActiveRecord::Schema.define(version: 20191031114255) do
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id", using: :btree t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id", using: :btree
end end
create_table "payments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "action"
t.integer "payment_id"
t.string "status"
t.integer "version"
t.string "type_of_payment"
t.string "paytype"
t.string "public_key"
t.integer "acq_id"
t.string "order_id"
t.string "liqpay_order_id"
t.string "description"
t.string "sender_phone"
t.string "sender_card_mask2"
t.string "sender_card_bank"
t.string "sender_card_type"
t.integer "sender_card_country"
t.string "ip"
t.float "amount", limit: 24
t.string "currency"
t.float "sender_commission", limit: 24
t.float "receiver_commission", limit: 24
t.float "agent_commission", limit: 24
t.float "amount_debit", limit: 24
t.float "amount_credit", limit: 24
t.float "commission_debit", limit: 24
t.float "commission_credit", limit: 24
t.string "currency_debit"
t.string "currency_credit"
t.float "sender_bonus", limit: 24
t.float "amount_bonus", limit: 24
t.string "mpi_eci"
t.boolean "is_3ds"
t.string "language"
t.bigint "create_date"
t.bigint "end_date"
t.integer "transaction_id"
t.integer "user_id"
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_payments_on_project_id", using: :btree
t.index ["user_id"], name: "index_payments_on_user_id", using: :btree
end
create_table "project_document_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_document_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_document_id", null: false t.integer "project_document_id", null: false
t.string "locale", null: false t.string "locale", null: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment