Sha256: 7c7a807cb18c8df2470ec73ce45b4aeb1aae7cf02fd756479271ed6f4e9ee508

Contents?: true

Size: 432 Bytes

Versions: 13

Compression:

Stored size: 432 Bytes

Contents

module WxPay
  class Result < ::Hash
    SUCCESS_FLAG = 'SUCCESS'.freeze

    def initialize(result)
      super nil # Or it will call `super result`

      self[:raw] = result
      
      if result['xml'].class == Hash
        result['xml'].each_pair do |k, v|
          self[k] = v
        end
      end
    end

    def success?
      self['return_code'] == SUCCESS_FLAG && self['result_code'] == SUCCESS_FLAG
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wx_pay-0.21.0 lib/wx_pay/result.rb
wx_pay-0.20.1 lib/wx_pay/result.rb
wx_pay-0.20.0 lib/wx_pay/result.rb
wx_pay-0.19.0 lib/wx_pay/result.rb
wx_pay-0.18.0 lib/wx_pay/result.rb
wx_pay-0.17.0 lib/wx_pay/result.rb
wx_pay-0.16.1 lib/wx_pay/result.rb
wx_pay-0.16.0 lib/wx_pay/result.rb
wx_pay-0.15.0 lib/wx_pay/result.rb
wx_pay-0.14.2 lib/wx_pay/result.rb
wx_pay-0.14.1 lib/wx_pay/result.rb
wx_pay-0.14.0 lib/wx_pay/result.rb
wx_pay-0.13.0 lib/wx_pay/result.rb