module OffsitePayments::Integrations::Newebpay::HasTradeInfo
The shared module for return and notification object
@since 0.1.0
Public Instance Methods
checksum()
click to toggle source
The TradeSha calculated in client-side
@return [String]
@since 0.1.0
# File lib/offsite_payments/integrations/newebpay/concern/has_trade_info.rb, line 27 def checksum @checksum ||= Digest::SHA256 .hexdigest("HashKey=#{::Newebpay::Config.hash_key}&" \ "#{params['TradeInfo']}&HashIV=#{::Newebpay::Config.hash_iv}") .upcase end
trade_info()
click to toggle source
Trade Information from NewebPay
@return [Hash]
@since 0.1.0
# File lib/offsite_payments/integrations/newebpay/concern/has_trade_info.rb, line 15 def trade_info @trade_info ||= JSON.parse(::Newebpay::Cipher.decrypt(params['TradeInfo'])) rescue JSON::ParserError, TypeError {} end
valid?()
click to toggle source
Does TradeInfo is valid
@return [TrueClass|FalseClass]
@since 0.1.0
# File lib/offsite_payments/integrations/newebpay/concern/has_trade_info.rb, line 40 def valid? checksum == params['TradeSha'] end