Sha256: 0fb644ad4a16e0b923f7698bf67025978a723d74f197def063e5f2ed66baf93e

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

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

    def self.[] result
      hash = self.new

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

      hash
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wx_pay-0.4.0 lib/wx_pay/result.rb