Skip to content

Commit

Permalink
revise withdraw and deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
hpyhacking committed Mar 10, 2014
1 parent 97c84af commit 6df9fa7
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 140 deletions.
3 changes: 1 addition & 2 deletions app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ module Admin
class BaseController < ::ApplicationController
layout 'admin'

before_filter :auth_member!
before_filter :auth_active!
before_filter :auth_admin!
before_filter :auth_member!

load_and_authorize_resource

Expand Down
13 changes: 7 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,25 @@ def auth_member!
redirect_to root_path unless current_user
end

def auth_active!
def auth_activated!
redirect_to settings_path, alert: t('private.settings.index.auth-activated') unless current_user.activated?
end

def auth_no_initial!
end

def auth_anybody!
redirect_to main_app.root_path if current_user
end

def is_admin?
current_user.admin?
redirect_to root_path if current_user
end

def auth_admin!
redirect_to main_app.root_path unless is_admin?
end

def is_admin?
current_user.admin?
end

private
def set_language
cookies[:lang] = params[:lang] unless params[:lang].blank?
Expand Down
1 change: 0 additions & 1 deletion app/controllers/private/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Private
class BaseController < ::ApplicationController
before_filter :auth_member!
before_filter :auth_active!

def channel
"private-#{current_user.sn}"
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/private/deposits_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Private
class DepositsController < BaseController
before_action :auth_activated!, only: [:coin, :bank]

def coin
currency = params[:currency]
redirect_to root_path unless Currency.coins.keys.include?(currency)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/private/withdraw_addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def create
if @withdraw_address.save
redirect_to new_withdraw_path
else
flash[:alert] = @withdraw_address.errors.full_messages
render :index
end
end
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/private/withdraws_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module Private
class WithdrawsController < BaseController
def new
@withdraw_addresses = current_user.withdraw_addresses
redirect_to withdraw_addresses_path and return if @withdraw_addresses.empty?

@withdraw = Withdraw.new
@withdraw_addresses = current_user.withdraw_addresses
load_history
end

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class WelcomeController < ApplicationController
layout 'landing'

before_filter :auth_active!

def index
if current_user
redirect_to market_path(latest_market) and return
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def simple_vertical_form_for(record, options={}, &block)
end

def panel(name: 'default-panel', key: nil, &block)
key ||= "guides.#{controller_name}.#{action_name}.#{name}"
key ||= "guides.#{i18n_controller_path}.#{action_name}.#{name}"

content_tag(:div, :class => 'panel panel-default') do
content_tag(:div, :class => 'panel-heading') do
Expand Down
7 changes: 5 additions & 2 deletions app/models/withdraw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Withdraw < ActiveRecord::Base
belongs_to :member
belongs_to :account
has_many :account_versions, :as => :modifiable
attr_accessor :withdraw_address_id, :password, :sum
attr_accessor :withdraw_address_id, :sum

after_create :generate_sn
before_validation :populate_fields_from_address, :fix_fee
Expand All @@ -31,7 +31,6 @@ class Withdraw < ActiveRecord::Base

validates :sum, presence: true, on: :create
validates :sum, numericality: {greater_than: 0}, on: :create
validates :password, presence: true, on: :create
validates :tx_id, presence: true, uniqueness: true, on: :update

validate :ensure_account_balance, on: :create
Expand Down Expand Up @@ -77,6 +76,10 @@ def last_completed_withdraw_cache_key
end

def ensure_account_balance
unless account
errors.add(:withdraw_address_id, :blank) and return
end

if self.sum > account.balance
errors.add(:sum, :poor)
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/withdraw_address.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class WithdrawAddress < ActiveRecord::Base
extend Enumerize

attr_accessor :name

paranoid
enumerize :category, in: WithdrawChannel.enumerize

Expand Down
30 changes: 13 additions & 17 deletions app/views/private/deposits/bank.html.slim
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
p
h3 = t('.step-1')
p = t('.select-bank')
h4 = t('.step-1')
p = t('.select-bank')

h5 = t('.name')
h5 = @deposit.account_holder
h5 = t('.card')
h5 = @deposit.account_number
h5 = t('.bank')
h5 #{@deposit.account_bank}
p
h3 = t('.step-2')
p = t('.send-money')
p
h5 = current_user.sn
p
h3 = t('.step-3')
p = t('.check-confirm')
h4 = t('.name')
h4 = @deposit.account_holder
h4 = t('.card')
h4 = @deposit.account_number
h4 = t('.bank')
h4 #{@deposit.account_bank}
h4 = t('.step-2')
p = t('.send-money')
h5 = current_user.sn
h4 = t('.step-3')
p = t('.check-confirm')
11 changes: 6 additions & 5 deletions app/views/private/deposits/coin.html.slim
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
p
h3 = t('.step-1')
h4 = t('.step-1')
p = t('.open-wallet')

p
h3 = t('.step-2')
h4 = t('.step-2')
p = t('.send-coin')
p
h5 = @address.address
== link_to_block(@address)
h4.text-info = @address.address
== link_to_block(@address)
.divider
= t('.or')
p = t('.scan-qr')
Expand All @@ -16,3 +15,5 @@ p
p
h3 = t('.step-3')
p = t('.check-confirm')
p
span == t('.check-link', link: link_to(t('header.assets')))
19 changes: 11 additions & 8 deletions app/views/private/deposits/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ ul.list-group
.col-md-6
h4 = d.name_text
.col-md-6
span.label.label-success
i.fa.fa-cogs
span = d.transfer_text
span.label.label-success
i.fa.fa-clock-o
span = d.latency_text
p.text-ignore = d.intro_text
.row
.col-md-12
p.text-ignore = d.intro_text
.row
.col-md-3
i.fa.fa-cogs.text-info
span = d.transfer_text
.col-md-5
i.fa.fa-clock-o.text-info
span = d.latency_text
.col-md-2
a.btn.btn-success.btn-block href='#{d.link}' = t('actions.go')
a.btn.btn-default.btn-block href='#{d.link}' = t('.go')
6 changes: 2 additions & 4 deletions app/views/private/withdraw_addresses/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
= simple_form_for @withdraw_address do |f|
= f.input :category, prompt: t('actions.select')
= f.input :label
= f.input :address
= f.input :category, prompt: t('actions.select')
= f.input :name, readonly: true, input_html: {value: current_user.name}
hr.split
= f.button :wrapped, cancel: new_withdraw_path

= content_for :after do
= balance_panel
3 changes: 1 addition & 2 deletions app/views/private/withdraws/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
= simple_form_for @withdraw do |f|
= f.input :withdraw_address_id, collection: @withdraw_addresses, prompt: t('actions.select')
= f.input :withdraw_address_id, collection: @withdraw_addresses, label_method: 'to_s', prompt: t('actions.select')
= f.input :sum, as: :decimal, input_html: {min: 0}
= f.input :password
hr.split
= f.button :wrapped, t('helpers.submit.withdraw.new'), cancel: market_path(latest_market)

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ en:

actions:
go: Go
deposit: Deposit
select: Please Select
unlock: Unlock
confirm: Confirm
Expand Down
8 changes: 4 additions & 4 deletions config/locales/enumerize/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ zh-CN:
done: 完成
withdraw:
address_type:
satoshi: 比特币
bank: 银行转账
satoshi: 比特币 - 网络转账
bank: 人民币 - 银行转账
state:
apply: 待确认
wait: 待校验
Expand All @@ -50,8 +50,8 @@ zh-CN:
cancel: 撤销
withdraw_address:
category:
satoshi: 比特币
bank: 银行转账
satoshi: 比特币 - 网络转账
bank: 人民币 - 银行转账
id_document:
category:
id_card: 身份证
Expand Down
16 changes: 9 additions & 7 deletions config/locales/guides/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ zh-CN:

deposits:
panel: 资金充值

coin:
title: 为您的账户充值
intro: 从本地钱包客户端或任意在线钱包客户端转出比特币到貔貅交易所账户
title: 比特币充值
intro: 从本地钱包客户端或任意在线钱包客户端转出比特币到我们为您提供的充值地址
bank:
title: 为您的账户充值
title: 人民币充值
intro: 使用银行卡转账进行充值,推荐用户大额充值使用。

index:
title: 为您的交易所账户充值
intro: 您可以充值人民币以购买比特币,或者充值比特币以兑换人民币
title: 账户充值
intro: 为您在貔貅交易所中的账户充值

withdraws: *withdraws

withdraw_addresses:
panel: 资金提现
index:
title: 创建资金提现地址
intro: 通过创建提现地址,以便每次提现时方便选择要提现的收款方
title: 新增提现地址
intro: 通过填写提现地址,以便每次提现时快速选择要提现的收款方

id_documents:
panel: 实名认证
Expand Down
10 changes: 5 additions & 5 deletions config/locales/peatio/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ zh-CN:
peatio:
deposit_channel:
bank:
name: 人民币充值 银行转账
name: 人民币充值
intro: 使用银行卡转账进行充值,推荐用户大额充值使用。
latency: 10 分钟
latency: 10 分钟到账
transfer: 人工处理
satoshi:
name: 比特币充值 客户端转账
intro: 从本地钱包客户端或任意在线钱包客户端转出比特币到貔貅交易所账户
latency: 全网 1 确认
name: 比特币充值
intro: 从本地钱包客户端或任意在线钱包客户端转出比特币到我们为您提供的充值地址
latency: 10 分钟到账
transfer: 自动

11 changes: 6 additions & 5 deletions config/locales/simple_form/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ zh-CN:
otp_secret: 密文
otp: 验证器上的密码
withdraw_address:
label: 标签
address: 地址
category: 种类
label: 开户行 / 标签
address: 银行卡号 / 地址
category: 选择提现种类
name: 账户名
withdraw:
password: 登录密码
session:
Expand Down Expand Up @@ -93,8 +94,6 @@ zh-CN:
amount: 您想要提现的金额
password: 请验证登录密码
withdraw_address:
label: 银行户名与开户行 / 其他标签
address: 银行卡号 / 收款地址
order_bid:
origin_volume: 买入数量
sum: 总成交金额
Expand All @@ -114,3 +113,5 @@ zh-CN:
password: 请输入至少8位,并必须包含大写、小写字母与数字。
id_document:
name: 请填写与您证件上一致的姓名。
withdraw_address:
name: 提现银行账户姓名必须与您的实名认证姓名一致。
9 changes: 5 additions & 4 deletions config/locales/views/private/deposits/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ zh-CN:
deposits:
bank:
step-1: 第一步
select-bank: 大额充值可以选择直接转账到我们的银行账户,为了您的充值可以迅速到账,请您尽量选择与我们相同的银行进行转账充值。您可以选择使用 在线银行转账 或 柜台转账
select-bank: 您可以选择直接转账到我们的银行账户,为了您的充值可以迅速到账,请您尽量选择与我们相同的银行进行转账充值。您可以选择使用 在线银行转账或柜台转账
step-2: 第二步
send-money: 无论您选择何种转账方式,请在转账备注中填写如下您的个人识别码,以便您的充值可以迅速到账。
step-3: 第三步
check-confirm: 请确定您的资金已到账而非转出后(跨行转账通常需要一个小时甚至更久的时间到账),如10分钟内还未充值,请及时与我们的客服人员联系。
check-confirm: 请确定您的资金已到账而非转出后(跨行转账通常需要一个小时甚至更久的时间到账),如10分钟内还未收到充值,请及时与我们的客服人员联系。
bank: 开户行
card: 卡号
name: 户名
coin:
step-1: 第一步
open-wallet: 请使用您常用的钱包服务,本地钱包、在线钱包或移动端的钱包,选择付款或发送。
step-2: 第二步
send-coin: 在收款地址中填入如下专门为您充值准备的地址,在金额中填入您希望充值到账的金额,同时别忘记支付一定的矿工费以保证交易尽快被全网确认。
send-coin: 在您的钱包收款地址中复制以下专门为您充值准备的地址,在金额中填入您希望充值到账的金额,同时别忘记支付一定的矿工费以保证交易尽快被全网确认。
or: 您也可以
scan-qr: 在移动端钱包中扫描二维码来进行支付。
step-3: 第三步
check-confirm: 在钱包中点击发送付款,此交易将被广播到全网,您即可在这里查看到此笔交易,当交易达到全网1个确认时,系统将自动充值到账(您不必刷新此界面,交易与充值结果会实时更新显示)。
check-confirm: 在钱包中点击发送付款,此交易将被广播到全网,您即可在这里查看到此笔交易,当交易达到全网1个确认 (大约10至60分钟) 时,系统将自动充值到账。
check-link: 您可以到 %{link} 中查询。
index:
go: 立即充值
1 change: 1 addition & 0 deletions config/locales/views/private/settings/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ zh-CN:
reset_password: 重置登录密码
reauthenticate: 身份验证
activated: 邮件已经发送至您的邮箱,请您尽快进入您的邮箱进行验证,如未收到请点击再次发送。
auth-activated: 请您立即绑定邮箱地址,否则将无法进行任何操作。

email:
title: 邮箱绑定
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ zh-CN:

actions:
go: 立刻前往
deposit: 立刻充值
select: 请选择
unlock: 解锁
confirm: 确认
Expand Down
Loading

0 comments on commit 6df9fa7

Please sign in to comment.