Sha256: c02ff1af69f229442b293f9d82ad95a373463808457e6885eec59b4853951303
Contents?: true
Size: 596 Bytes
Versions: 2
Compression:
Stored size: 596 Bytes
Contents
module Alipay module Utils def self.stringify_keys(hash) new_hash = {} hash.each do |key, value| new_hash[(key.to_s rescue key) || key] = value end new_hash end # 退款批次号,支付宝通过此批次号来防止重复退款操作,所以此号生成后最好直接保存至数据库,不要在显示页面的时候生成 # 共 24 位(8 位当前日期 + 9 位纳秒 + 1 位随机数) def self.generate_batch_no time = Time.now time.strftime('%Y%m%d%H%M%S') + time.nsec.to_s + Random.new.rand(1..9).to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alipay-0.0.4 | lib/alipay/utils.rb |
alipay-0.0.3 | lib/alipay/utils.rb |