Sha256: cc09c455a4163fb8a2f0328f4ccd429eff6326a32b3bc3b549d014cfa6909eda

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 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
  @sandbox_mode = false

  class<< self
    attr_accessor :appid, :mch_id, :key, :appsecret, :extra_rest_client_options, :debug_mode
    attr_accessor :sandbox_mode, :sandbox_key, :sandbox_mch_id
    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

    def sandbox_mode?
      @sandbox_mode
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wx_pay-0.16.0 lib/wx_pay.rb