Class: AlipayMini::Api::AlipayBase

Inherits:
Object
  • Object
show all
Defined in:
lib/alipay_mini/api/alipay_base.rb

Direct Known Subclasses

SystemOauthToken, TradeCreate, UserInfoShare

Instance Method Summary collapse

Instance Method Details

#base_paramsObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/alipay_mini/api/alipay_base.rb', line 13

def base_params
  {
      app_id: AlipayMini.config[:app_id],
      format: AlipayMini.config[:format],
      charset: AlipayMini.config[:charset],
      sign_type: AlipayMini.config[:sign_type],
      version: AlipayMini.config[:version],
      method: method,
      timestamp: timestamp
  }
end

#methodObject

Raises:

  • (ArgumentError)


5
6
7
# File 'lib/alipay_mini/api/alipay_base.rb', line 5

def method
  raise ArgumentError, "please set the correct api method name"
end

#sign_params(params) ⇒ Object



25
26
27
# File 'lib/alipay_mini/api/alipay_base.rb', line 25

def sign_params(params)
  params.merge(sign: AlipayMini::Sign.generate(params))
end

#timestampObject



9
10
11
# File 'lib/alipay_mini/api/alipay_base.rb', line 9

def timestamp
  Time.now.strftime("%Y-%m-%d %H:%M:%S")
end