24 lines
782 B
Ruby
24 lines
782 B
Ruby
|
module Admin::PaymentSetupHelper
|
||
|
def self.get_bank_list
|
||
|
Dir["#{File.expand_path(__dir__)}/payment_setup/*.rb"].map{|v| v.split('/')[-1].split('_helper')[0]}
|
||
|
end
|
||
|
def self.new_ordernum(bank_name)
|
||
|
if bank_name=='hua_nan'
|
||
|
order_num = (('a'..'z').to_a + (0..9).to_a + ('A'..'Z').to_a ).shuffle[0,19].join
|
||
|
end
|
||
|
if !PaymentLog.all.select {|v| v.orderNumber == order_num }.blank?
|
||
|
order_num = new_ordernum(bank_name)
|
||
|
end
|
||
|
order_num
|
||
|
end
|
||
|
def self.render_pay_html(payment_pay=nil)
|
||
|
url_helpers = Rails.application.routes.url_helpers
|
||
|
ac = ActionController::Base.new()
|
||
|
html_render =
|
||
|
ac.render_to_string :template => 'payment/_pay_html',
|
||
|
:locals=> {url_helpers: url_helpers,payment_pay: payment_pay}
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|