Sha256: 891ccc57de6fb2436c181d63af74d2cac82c59395f75dd4c9cb1b5a07b8cbd89

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

require 'rest_client'
require 'active_support/core_ext/hash/conversions'
module JdPay
  module QrService
    USABLE_METHODS = %i(qrcode_pay refund query revoke notify_verify)
    def self.method_missing(method, *args)

      super unless USABLE_METHODS.include?(method)
      qr_service_default_config = {
        mch_id: JdPay.qr_mch_id, des_key: JdPay.qr_des_key, pri_key: JdPay.qr_pri_key
      }
      args[1] = {} if args[1].nil?
      args[1] = qr_service_default_config.merge(args[1])
      JdPay::Service.public_send(method, *args)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jdpay-0.1.3 lib/jd_pay/qr_service.rb
jdpay-0.1.2 lib/jd_pay/qr_service.rb
jdpay-0.1.1 lib/jd_pay/qr_service.rb