Sha256: 7e6739d60b0a0a1e58e1809e31833967c3b51cd841ed82c36d2bb519e519913d

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

require 'wx_pay/result'
require 'wx_pay/sign'
require 'wx_pay/service'
require 'openssl'

module WxPay
  @extra_rest_client_options = {}
  @debug_mode = true

  class<< self
    attr_accessor :appid, :mch_id, :key, :appsecret, :extra_rest_client_options, :debug_mode
    attr_reader :apiclient_cert, :apiclient_key

    def set_apiclient_by_pkcs12(str, pass)
      pkcs12 = OpenSSL::PKCS12.new(str, pass)
      @apiclient_cert = pkcs12.certificate
      @apiclient_key = pkcs12.key

      pkcs12
    end

    def apiclient_cert=(cert)
      @apiclient_cert = OpenSSL::X509::Certificate.new(cert)
    end

    def apiclient_key=(key)
      @apiclient_key = OpenSSL::PKey::RSA.new(key)
    end

    def debug_mode?
      @debug_mode
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wx_pay-0.15.0 lib/wx_pay.rb
wx_pay-0.14.2 lib/wx_pay.rb
wx_pay-0.14.1 lib/wx_pay.rb
wx_pay-0.14.0 lib/wx_pay.rb
wx_pay-0.13.0 lib/wx_pay.rb
wx_pay-0.12.0 lib/wx_pay.rb