Sha256: 3b22192dca117c94c1d4fa8d3b1782b93944a0bd0004131b3b774261d32939f8
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 Bytes
Contents
require 'cgi' require 'open-uri' module WxPay module Service GATEWAY_URL = 'https://api.mch.weixin.qq.com/pay' INVOKE_UNIFIEDORDER_REQUIRED_FIELDS = %i(body out_trade_no total_fee spbill_create_ip notify_url trade_type) def self.invoke_unifiedorder(params) params = { app_id: WxPay.appid, mch_id: WxPay.mch_id, nonce_str: SecureRandom.uuid.tr('-', ''), }.merge(params) check_required_options(params, INVOKE_UNIFIEDORDER_REQUIRED_FIELDS) WxPay::Utils.invoke_remote("#{GATEWAY_URL}/unifiedorder", WxPay::Utils.make_payload(params)) end private def self.check_required_options(options, names) names.each do |name| warn("WxPay Warn: missing required option: #{name}") unless options.has_key?(name) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wx_pay-0.0.1 | lib/wx_pay/service.rb |