forked from openware/peatio
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic models, controllers, routes, and code itself for currencies (c…
…loses openware#646)
- Loading branch information
Showing
149 changed files
with
642 additions
and
1,918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/assets/javascripts/funds/controllers/deposits_controller.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
require_dependency 'admin/base_controller' | ||
|
||
module Admin | ||
module Deposits | ||
class BaseController < ::Admin::BaseController | ||
def channel | ||
@channel ||= DepositChannel.find_by_key(self.controller_name.singularize) | ||
end | ||
class BaseController < BaseController | ||
|
||
protected | ||
|
||
def kls | ||
channel.kls | ||
def currency | ||
Currency.where(type: self.class.name.demodulize.underscore.gsub(/_controller\z/, '').singularize) | ||
.find_by_code!(params[:currency]) | ||
end | ||
helper_method :currency | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require_dependency 'admin/deposits/base_controller' | ||
|
||
module Admin | ||
module Deposits | ||
class FiatsController < BaseController | ||
def index | ||
q = ::Deposits::Fiat.where(currency: currency) | ||
@latest_deposits = q.includes(:member).where('created_at <= ?', 1.day.ago).order('id DESC') | ||
@all_deposits = q.includes(:member).where('created_at > ?', 1.day.ago).order('id DESC') | ||
end | ||
|
||
def new | ||
@deposit = ::Deposits::Fiat.new | ||
end | ||
|
||
def show | ||
@deposit = ::Deposits::Fiat.where(currency: currency).find(params[:id]) | ||
flash.now[:notice] = t('.notice') if @deposit.aasm_state.accepted? | ||
end | ||
|
||
def create | ||
@deposit = ::Deposits::Fiat.new(deposit_params) | ||
if @deposit.save | ||
redirect_to admin_deposit_index_url(params[:currency]) | ||
else | ||
flash[:alert] = @deposit.errors.full_messages.first | ||
render :new | ||
end | ||
end | ||
|
||
def update | ||
@deposit = ::Deposits::Fiat.where(currency: currency).find(params[:id]) | ||
params = self.params.require(:deposits_fiat).permit(:txid) | ||
|
||
if params[:txid].blank? | ||
flash[:alert] = 'Transaction ID is blank!' | ||
return redirect_to :back | ||
end | ||
|
||
@deposit.charge!(params[:txid]) | ||
redirect_to :back | ||
end | ||
|
||
private | ||
|
||
def deposit_params | ||
params.require(:deposits_fiat).slice(:sn, :amount, :fund_uid, :fund_extra, :currency) | ||
.merge(currency: currency) | ||
.permit! | ||
end | ||
end | ||
end | ||
end | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.