qpay 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.arcconfig +3 -0
 - data/.gitignore +13 -0
 - data/.rspec +3 -0
 - data/.travis.yml +3 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +56 -0
 - data/Rakefile +1 -0
 - data/bin/console +20 -0
 - data/bin/setup +7 -0
 - data/lib/qpay.rb +8 -0
 - data/lib/qpay/client.rb +158 -0
 - data/lib/qpay/config.rb +18 -0
 - data/lib/qpay/sign.rb +46 -0
 - data/lib/qpay/version.rb +3 -0
 - data/qpay.gemspec +36 -0
 - metadata +229 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e1a564a42753a6ca46fe6e499fafd10f5d0bd0ef
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dd275ad5c85f9dc51df7b44c559a83eba601ce10
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f6ec627c45759385fb569d66835f07247700f775e8e4737b61bee63e1ed6852ddc3b3a2b52ebea5ac795fe17bd47ff3532ba06918821d6cc83bd9c3251a60af3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c6c5f15e777d8f696ea980f2ccd6217b0b27c7e787e62230bee0e05724370c754e7e0fe01d4cf86164c1c832ea0582373a9f78dca7391b897a387381abb1e4de
         
     | 
    
        data/.arcconfig
    ADDED
    
    
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 scorix
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Qpay
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            QQ 钱包支付
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'qpay', github: "scorix/qpay"
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ### New a client
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ```
         
     | 
| 
      
 22 
     | 
    
         
            +
            client = Qpay::Client.new(appid: 'wxd930ea5d5a258f4f', mch_id: '10000100', api_key: '192006250b4c09247ec02edce69f6a2d')
         
     | 
| 
      
 23 
     | 
    
         
            +
            ```
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ### [统一下单](https://qpay.qq.com/qpaywiki/showdocument.php?pid=38&docid=58)
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ```
         
     | 
| 
      
 28 
     | 
    
         
            +
            client.unifiedorder(body, out_trade_no, total_fee, spbill_create_ip, notify_url)
         
     | 
| 
      
 29 
     | 
    
         
            +
            ```
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ### [订单查询](https://qpay.qq.com/qpaywiki/showdocument.php?pid=38&docid=60)
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ```
         
     | 
| 
      
 34 
     | 
    
         
            +
            client.orderquery(out_trade_no)
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            or
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ```
         
     | 
| 
      
 40 
     | 
    
         
            +
            # use transaction_id first
         
     | 
| 
      
 41 
     | 
    
         
            +
            client.orderquery(out_trade_no, transaction_id: transaction_id)
         
     | 
| 
      
 42 
     | 
    
         
            +
            ```
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            1. Fork it ( https://github.com/scorix/qpay/fork )
         
     | 
| 
      
 53 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 54 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 55 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 56 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bundler/gem_tasks"
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "qpay"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            begin
         
     | 
| 
      
 12 
     | 
    
         
            +
              require "pry"
         
     | 
| 
      
 13 
     | 
    
         
            +
              Pry.start
         
     | 
| 
      
 14 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 15 
     | 
    
         
            +
              require "irb"
         
     | 
| 
      
 16 
     | 
    
         
            +
              IRB.start
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/lib/qpay.rb
    ADDED
    
    
    
        data/lib/qpay/client.rb
    ADDED
    
    | 
         @@ -0,0 +1,158 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Qpay
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Client
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                def initialize(options = {})
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @config = Config.new
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @config.appid = options[:appid]
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @config.mch_id = options[:mch_id]
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @config.app_key = options[:app_key]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @config.api_key = options[:api_key]
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @config.cert_type = options[:cert_type]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @config.cert_file = options[:cert_file]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @config.cert_password = options[:cert_password]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @config.adapter = options[:adapter] || :patron
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def config
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @config.dup
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def api
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @api ||= case config.adapter
         
     | 
| 
      
 24 
     | 
    
         
            +
                             when :httparty
         
     | 
| 
      
 25 
     | 
    
         
            +
                               require 'httparty'
         
     | 
| 
      
 26 
     | 
    
         
            +
                               c = Class.new do
         
     | 
| 
      
 27 
     | 
    
         
            +
                                 include ::HTTParty
         
     | 
| 
      
 28 
     | 
    
         
            +
                                 base_uri 'https://qpay.qq.com/cgi-bin'
         
     | 
| 
      
 29 
     | 
    
         
            +
                                 disable_rails_query_string_format
         
     | 
| 
      
 30 
     | 
    
         
            +
                                 default_timeout 10
         
     | 
| 
      
 31 
     | 
    
         
            +
                                 headers 'Content-Type' => 'application/xml'
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                                 def self.post(url, body, format:)
         
     | 
| 
      
 34 
     | 
    
         
            +
                                   super(url, body: body, format: format).parsed_response
         
     | 
| 
      
 35 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 36 
     | 
    
         
            +
                               end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                               c.default_options.delete(:p12)
         
     | 
| 
      
 39 
     | 
    
         
            +
                               c.default_options.delete(:p12_password)
         
     | 
| 
      
 40 
     | 
    
         
            +
                               c.default_options.delete(:pem)
         
     | 
| 
      
 41 
     | 
    
         
            +
                               c.default_options.delete(:pem_password)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                               # set cert option
         
     | 
| 
      
 44 
     | 
    
         
            +
                               if @config.cert_type && @config.cert_file && File.exist?(@config.cert_file)
         
     | 
| 
      
 45 
     | 
    
         
            +
                                 c..public_send(@config.cert_type.to_sym, File.read(@config.cert_file), @config.cert_password)
         
     | 
| 
      
 46 
     | 
    
         
            +
                               end
         
     | 
| 
      
 47 
     | 
    
         
            +
                               c
         
     | 
| 
      
 48 
     | 
    
         
            +
                             when :patron
         
     | 
| 
      
 49 
     | 
    
         
            +
                               require 'patron'
         
     | 
| 
      
 50 
     | 
    
         
            +
                               Class.new do
         
     | 
| 
      
 51 
     | 
    
         
            +
                                 def self.post(url, body, format:)
         
     | 
| 
      
 52 
     | 
    
         
            +
                                   s = Patron::Session.new(base_url: 'https://qpay.qq.com/cgi-bin',
         
     | 
| 
      
 53 
     | 
    
         
            +
                                                           timeout: 10,
         
     | 
| 
      
 54 
     | 
    
         
            +
                                                           headers: {'Content-Type' => 'application/xml'},
         
     | 
| 
      
 55 
     | 
    
         
            +
                                                           force_ipv4: true)
         
     | 
| 
      
 56 
     | 
    
         
            +
                                   body = s.post(url, body).body
         
     | 
| 
      
 57 
     | 
    
         
            +
                                   case format
         
     | 
| 
      
 58 
     | 
    
         
            +
                                     when :xml
         
     | 
| 
      
 59 
     | 
    
         
            +
                                       MultiXml.parse(body)
         
     | 
| 
      
 60 
     | 
    
         
            +
                                     when :csv
         
     | 
| 
      
 61 
     | 
    
         
            +
                                       require 'csv'
         
     | 
| 
      
 62 
     | 
    
         
            +
                                       CSV.parse(body)
         
     | 
| 
      
 63 
     | 
    
         
            +
                                   end
         
     | 
| 
      
 64 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 65 
     | 
    
         
            +
                               end
         
     | 
| 
      
 66 
     | 
    
         
            +
                           end
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                # 除被扫支付场景以外,商户系统先调用该接口在QQ钱包服务后台生成预支付交易单,返回正确的预支付交易回话标识后再按具体的场景生成交易串调起支付。
         
     | 
| 
      
 70 
     | 
    
         
            +
                def unifiedorder(body, out_trade_no, total_fee, spbill_create_ip, notify_url, more_params = {})
         
     | 
| 
      
 71 
     | 
    
         
            +
                  params = more_params.merge(body: body,
         
     | 
| 
      
 72 
     | 
    
         
            +
                                             out_trade_no: out_trade_no,
         
     | 
| 
      
 73 
     | 
    
         
            +
                                             total_fee: total_fee,
         
     | 
| 
      
 74 
     | 
    
         
            +
                                             spbill_create_ip: spbill_create_ip,
         
     | 
| 
      
 75 
     | 
    
         
            +
                                             notify_url: notify_url)
         
     | 
| 
      
 76 
     | 
    
         
            +
                  params[:fee_type] ||= 'CNY'
         
     | 
| 
      
 77 
     | 
    
         
            +
                  params[:time_start] ||= Time.now.strftime('%Y%m%d%H%M%S')
         
     | 
| 
      
 78 
     | 
    
         
            +
                  params[:trade_type] ||= 'APP'
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  api.post('/pay/qpay_unified_order.cgi', request_params(params), format: :xml)
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                # 该接口提供所有手Q钱包订单的查询,商户可以通过该接口主动查询订单状态,完成下一步的业务逻辑。
         
     | 
| 
      
 84 
     | 
    
         
            +
                #
         
     | 
| 
      
 85 
     | 
    
         
            +
                # 需要调用查询接口的情况:
         
     | 
| 
      
 86 
     | 
    
         
            +
                #   * 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;
         
     | 
| 
      
 87 
     | 
    
         
            +
                #   * 调用支付接口后,返回系统错误或未知交易状态情况;
         
     | 
| 
      
 88 
     | 
    
         
            +
                #   * 调用 qpay_close_order.cgi 关闭订单接口之前之前,需确认支付状态
         
     | 
| 
      
 89 
     | 
    
         
            +
                def orderquery(out_trade_no, more_params = {})
         
     | 
| 
      
 90 
     | 
    
         
            +
                  params = more_params.merge(out_trade_no: out_trade_no)
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                  api.post('/pay/qpay_order_query.cgi', request_params(params), format: :xml)
         
     | 
| 
      
 93 
     | 
    
         
            +
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                # 以下情况需要调用关单接口:
         
     | 
| 
      
 96 
     | 
    
         
            +
                #   * 商户订单支付失败需要生成新单号重新发起支付,要对原订单号调用关单,避免重复支付
         
     | 
| 
      
 97 
     | 
    
         
            +
                #   * 系统下单后,用户支付超时,系统退出不再受理,避免用户继续,请调用关单接口
         
     | 
| 
      
 98 
     | 
    
         
            +
                #
         
     | 
| 
      
 99 
     | 
    
         
            +
                # 注意:订单生成后不能马上调用关单接口,最短调用时间间隔为5分钟。
         
     | 
| 
      
 100 
     | 
    
         
            +
                def closeorder(out_trade_no, more_params = {})
         
     | 
| 
      
 101 
     | 
    
         
            +
                  params = more_params.merge(out_trade_no: out_trade_no)
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                  api.post('/pay/qpay_close_order.cgi', request_params(params), format: :xml)
         
     | 
| 
      
 104 
     | 
    
         
            +
                end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                # 当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付款退还给买家,QQ钱包将在收到退款请求并且验证成功之后,按照退款规则将支付款按原路退到买家帐号上。
         
     | 
| 
      
 108 
     | 
    
         
            +
                #
         
     | 
| 
      
 109 
     | 
    
         
            +
                # 注意:
         
     | 
| 
      
 110 
     | 
    
         
            +
                #   1.交易时间超过一年的订单无法提交退款;
         
     | 
| 
      
 111 
     | 
    
         
            +
                #   2.QQ钱包退款支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。一笔退款失败后重新提交,要采用原来的退款单号。总退款金额不能超过用户实际支付金额。
         
     | 
| 
      
 112 
     | 
    
         
            +
                def refund(out_trade_no, out_refund_no, total_fee, refund_fee, more_params = {})
         
     | 
| 
      
 113 
     | 
    
         
            +
                  params = more_params.merge(out_trade_no: out_trade_no,
         
     | 
| 
      
 114 
     | 
    
         
            +
                                             out_refund_no: out_refund_no,
         
     | 
| 
      
 115 
     | 
    
         
            +
                                             total_fee: total_fee,
         
     | 
| 
      
 116 
     | 
    
         
            +
                                             refund_fee: refund_fee)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  params[:refund_fee_type] ||= 'CNY'
         
     | 
| 
      
 118 
     | 
    
         
            +
                  params[:op_user_id] ||= Qpay.config.mch_id
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  api.post('/pay/qpay_refund.cgi', request_params(params), format: :xml)
         
     | 
| 
      
 121 
     | 
    
         
            +
                end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                # 提交退款申请后,通过调用该接口查询退款状态。退款有一定延时,用余额支付的退款20分钟内到账,银行卡支付的退款3个工作日后重新查询退款状态。
         
     | 
| 
      
 124 
     | 
    
         
            +
                def refundquery(out_trade_no, more_params = {})
         
     | 
| 
      
 125 
     | 
    
         
            +
                  params = more_params.merge(out_trade_no: out_trade_no)
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                  api.post('/pay/qpay_refund_query.cgi', request_params(params), format: :xml)
         
     | 
| 
      
 128 
     | 
    
         
            +
                end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                # 商户可以通过该接口下载历史交易清单。
         
     | 
| 
      
 131 
     | 
    
         
            +
                #
         
     | 
| 
      
 132 
     | 
    
         
            +
                # 注意:
         
     | 
| 
      
 133 
     | 
    
         
            +
                #   1、在QQ钱包侧未成功下单的交易不会出现在对账单中;
         
     | 
| 
      
 134 
     | 
    
         
            +
                #   2、QQ钱包在次日9点启动生成前一天的对账单,建议商户10点后再获取;
         
     | 
| 
      
 135 
     | 
    
         
            +
                #   3、对账单中涉及金额的字段单位为“元”;
         
     | 
| 
      
 136 
     | 
    
         
            +
                #   4、对账单接口只能下载三个月以内的对账单。
         
     | 
| 
      
 137 
     | 
    
         
            +
                def downloadbill(bill_date, more_params = {})
         
     | 
| 
      
 138 
     | 
    
         
            +
                  params = more_params.merge(bill_date: Time.parse(bill_date.to_s).strftime('%Y%m%d'))
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                  # csv data
         
     | 
| 
      
 141 
     | 
    
         
            +
                  api.post("/sp_download/qpay_mch_statement_down.cgi", request_params(params), format: :csv)
         
     | 
| 
      
 142 
     | 
    
         
            +
                end
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
                private
         
     | 
| 
      
 145 
     | 
    
         
            +
                def request_params(params)
         
     | 
| 
      
 146 
     | 
    
         
            +
                  params.merge!(appid: @config.appid, mch_id: @config.mch_id, nonce_str: SecureRandom.urlsafe_base64)
         
     | 
| 
      
 147 
     | 
    
         
            +
                  to_xml(Qpay.params_with_sign(params, @config))
         
     | 
| 
      
 148 
     | 
    
         
            +
                end
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                def to_xml(params)
         
     | 
| 
      
 151 
     | 
    
         
            +
                  xml = '<xml>'
         
     | 
| 
      
 152 
     | 
    
         
            +
                  ((params.keys - ['sign', :sign]).sort | ['sign', :sign]).each do |k|
         
     | 
| 
      
 153 
     | 
    
         
            +
                    xml << "<#{k}>#{params[k]}</#{k}>" if params[k]
         
     | 
| 
      
 154 
     | 
    
         
            +
                  end
         
     | 
| 
      
 155 
     | 
    
         
            +
                  xml << '</xml>'
         
     | 
| 
      
 156 
     | 
    
         
            +
                end
         
     | 
| 
      
 157 
     | 
    
         
            +
              end
         
     | 
| 
      
 158 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/qpay/config.rb
    ADDED
    
    | 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Qpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Config
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :appid, :mch_id, :app_key, :api_key
         
     | 
| 
      
 4 
     | 
    
         
            +
                attr_accessor :cert_type, :cert_file, :cert_password
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :adapter
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @appid = options[:appid]
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @mch_id = options[:mch_id]
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @app_key = options[:app_key]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @api_key = options[:api_key]
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @cert_type = options[:cert_type]
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @cert_file = options[:cert_file]
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @cert_password = options[:cert_password]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @adapter = options[:adapter]
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/qpay/sign.rb
    ADDED
    
    | 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Qpay
         
     | 
| 
      
 2 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 3 
     | 
    
         
            +
                def sign(params, config)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  Digest::MD5.hexdigest(string_params_without_sign(params, config)).upcase
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                # https://qpay.qq.com/qpaywiki/showdocument.php?pid=38&docid=165
         
     | 
| 
      
 8 
     | 
    
         
            +
                def sign_app(params, config)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  key = "#{config.app_key}&"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  data = preprocess_params(params, keep_blank: true).sort_by { |k, _| k }.map { |x| x.join('=') }.join('&')
         
     | 
| 
      
 11 
     | 
    
         
            +
                  digest = OpenSSL::Digest.new('sha1')
         
     | 
| 
      
 12 
     | 
    
         
            +
                  hmac = OpenSSL::HMAC.digest(digest, key, data)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  Base64.encode64(hmac).strip
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def string_params_without_sign(params, config)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  sorted_params = preprocess_params(params).sort_by { |k, _| k }
         
     | 
| 
      
 18 
     | 
    
         
            +
                  (sorted_params << ['key', config.api_key]).map { |x| x.join('=') }.join('&')
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def params_with_sign(params, config)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  params_dup = preprocess_params(params)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  params_dup.merge('sign' => Qpay.sign(params, config))
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                private
         
     | 
| 
      
 27 
     | 
    
         
            +
                def random_string
         
     | 
| 
      
 28 
     | 
    
         
            +
                  SecureRandom.urlsafe_base64.tr('-_', '')
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                def preprocess_params(params, keep_blank: false)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  params_dup = params.dup
         
     | 
| 
      
 33 
     | 
    
         
            +
                  stringified_keys_params = {}
         
     | 
| 
      
 34 
     | 
    
         
            +
                  params_dup.each do |k, v|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    next if !keep_blank && blank?(v)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    stringified_keys_params[k.to_s] = v
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  stringified_keys_params.delete('key')
         
     | 
| 
      
 39 
     | 
    
         
            +
                  stringified_keys_params
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def blank?(v)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  !v || v.nil? || (v.respond_to?(:empty?) && v.empty?)
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/qpay/version.rb
    ADDED
    
    
    
        data/qpay.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'qpay/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'qpay'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Qpay::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['scorix']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['scorix@liulishuo.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{A gem for payment in qpay.}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = %q{api doc: https://qpay.qq.com/qpaywiki/showdocument.php?pid=38&docid=58}
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/lingochamp/qpay'
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.bindir        = 'exe'
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '> 1.9'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'pry'
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency 'webmock'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency 'rspec'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency 'rspec-its'
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency 'simplecov'
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_development_dependency 'net-dns'
         
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_development_dependency 'sinatra'
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency 'httparty'
         
     | 
| 
      
 33 
     | 
    
         
            +
              spec.add_development_dependency 'patron'
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              spec.add_dependency 'multi_xml'
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,229 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: qpay
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.5.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - scorix
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-13 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.9'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.9'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: webmock
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: rspec-its
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 111 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 112 
     | 
    
         
            +
              name: net-dns
         
     | 
| 
      
 113 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 117 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 118 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 119 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 121 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 122 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 124 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: sinatra
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 130 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 132 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 133 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 135 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 136 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 137 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 138 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 139 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 140 
     | 
    
         
            +
              name: httparty
         
     | 
| 
      
 141 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 142 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 143 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 145 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 146 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 147 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 148 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 149 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 150 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 151 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 152 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 153 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 154 
     | 
    
         
            +
              name: patron
         
     | 
| 
      
 155 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 156 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 157 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 158 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 159 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 160 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 161 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 162 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 163 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 164 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 165 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 166 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 167 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 168 
     | 
    
         
            +
              name: multi_xml
         
     | 
| 
      
 169 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 170 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 171 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 172 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 173 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 174 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 175 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 176 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 177 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 178 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 179 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 180 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 181 
     | 
    
         
            +
            description: 'api doc: https://qpay.qq.com/qpaywiki/showdocument.php?pid=38&docid=58'
         
     | 
| 
      
 182 
     | 
    
         
            +
            email:
         
     | 
| 
      
 183 
     | 
    
         
            +
            - scorix@liulishuo.com
         
     | 
| 
      
 184 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 185 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 186 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 187 
     | 
    
         
            +
            files:
         
     | 
| 
      
 188 
     | 
    
         
            +
            - ".arcconfig"
         
     | 
| 
      
 189 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 190 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 191 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 192 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 193 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 194 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 195 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 196 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 197 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 198 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 199 
     | 
    
         
            +
            - lib/qpay.rb
         
     | 
| 
      
 200 
     | 
    
         
            +
            - lib/qpay/client.rb
         
     | 
| 
      
 201 
     | 
    
         
            +
            - lib/qpay/config.rb
         
     | 
| 
      
 202 
     | 
    
         
            +
            - lib/qpay/sign.rb
         
     | 
| 
      
 203 
     | 
    
         
            +
            - lib/qpay/version.rb
         
     | 
| 
      
 204 
     | 
    
         
            +
            - qpay.gemspec
         
     | 
| 
      
 205 
     | 
    
         
            +
            homepage: https://github.com/lingochamp/qpay
         
     | 
| 
      
 206 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 207 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 208 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 209 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 210 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 211 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 212 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 213 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 214 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 215 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 216 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 217 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 218 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 219 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 220 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 221 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 222 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 223 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 224 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 225 
     | 
    
         
            +
            rubygems_version: 2.5.2
         
     | 
| 
      
 226 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 227 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 228 
     | 
    
         
            +
            summary: A gem for payment in qpay.
         
     | 
| 
      
 229 
     | 
    
         
            +
            test_files: []
         
     |