Module: Wechatpay::Api::V3::Trade

Included in:
Client
Defined in:
lib/wechatpay/api/v3/trade.rb

Instance Method Summary collapse

Instance Method Details

#notice(headers, payload) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/wechatpay/api/v3/trade.rb', line 8

def notice(headers, payload)
  raise :verify_fail unless verify(headers, payload)

  data = MultiJson.load(payload, symbolize_keys: true)
  r = data[:resource]
  text = decrypt r[:ciphertext], r[:nonce], r[:associated_data]
  MultiJson.load(text, symbolize_keys: true)
end