alipay 0.8.0 → 0.9.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 +4 -4
 - data/CHANGELOG.md +6 -0
 - data/README.md +44 -10
 - data/lib/alipay/service.rb +17 -0
 - data/lib/alipay/version.rb +1 -1
 - data/test/alipay/service_test.rb +9 -0
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 90db58ac96b9dc46b469b17123cad251d9d12834
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d0b01bd14ba415fcd64c56dfb6d3e4863bd12659
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fe6faf8e28ca0e2913b8926247774f760f697985a788d3930a55519798d9489d67f3ca20ba48979b441905bdee7c8777dd686259c62974e278cfdea772cb4672
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dc2b6411f65c4fd289e42d19a5af28f2a00b1528e6f07c3cf6bb8ce26dfc62ed2c9b3e8ab6d735c42dfd9aeacec572032a0c7998ff2f31cee24824b9d35a15c5
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ Alipay official document: https://b.alipay.com/order/techService.htm . 
     | 
|
| 
       9 
9 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            ```ruby
         
     | 
| 
       12 
     | 
    
         
            -
            gem 'alipay', '~> 0. 
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'alipay', '~> 0.9.0'
         
     | 
| 
       13 
13 
     | 
    
         
             
            ```
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            And then execute:
         
     | 
| 
         @@ -146,8 +146,7 @@ Alipay::Service.create_direct_pay_by_user_url({ARGUMENTS}, {OPTIONS}) 
     | 
|
| 
       146 
146 
     | 
    
         
             
            Alipay::Service.create_direct_pay_by_user_url(
         
     | 
| 
       147 
147 
     | 
    
         
             
              out_trade_no: '20150401000-0001',
         
     | 
| 
       148 
148 
     | 
    
         
             
              subject: 'Order Name',
         
     | 
| 
       149 
     | 
    
         
            -
               
     | 
| 
       150 
     | 
    
         
            -
              quantity: 12,
         
     | 
| 
      
 149 
     | 
    
         
            +
              total_fee: '10.00',
         
     | 
| 
       151 
150 
     | 
    
         
             
              return_url: 'https://example.com/orders/20150401000-0001',
         
     | 
| 
       152 
151 
     | 
    
         
             
              notify_url: 'https://example.com/orders/20150401000-0001/notify'
         
     | 
| 
       153 
152 
     | 
    
         
             
            )
         
     | 
| 
         @@ -159,15 +158,50 @@ Alipay::Service.create_direct_pay_by_user_url( 
     | 
|
| 
       159 
158 
     | 
    
         
             
            | --- | ----------- | ----------- |
         
     | 
| 
       160 
159 
     | 
    
         
             
            | out_order_no | required | Order id in your application. |
         
     | 
| 
       161 
160 
     | 
    
         
             
            | subject | required | Order subject. |
         
     | 
| 
       162 
     | 
    
         
            -
            |  
     | 
| 
       163 
     | 
    
         
            -
            | quantity | required * | Order item's quantity, total price is price * quantity. |
         
     | 
| 
      
 161 
     | 
    
         
            +
            | total_fee | required | Order's total fee. |
         
     | 
| 
       164 
162 
     | 
    
         
             
            | return_url | optional | Redirect customer to this url after payment. |
         
     | 
| 
       165 
163 
     | 
    
         
             
            | notify_url | optional | Alipay asyn notify url. |
         
     | 
| 
       166 
164 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
            \* Can be replaced by total_fee. When total_fee is set, price and quantity could not be set.
         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
165 
     | 
    
         
             
            This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaydirect.zip .
         
     | 
| 
       170 
166 
     | 
    
         | 
| 
      
 167 
     | 
    
         
            +
            ### 手机网站支付接口
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
            #### Name
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 172 
     | 
    
         
            +
            alipay.wap.create.direct.pay.by.user
         
     | 
| 
      
 173 
     | 
    
         
            +
            ```
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
            #### Definition
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 178 
     | 
    
         
            +
            Alipay::Service.create_direct_pay_by_user_wap_url({ARGUMENTS}, {OPTIONS})
         
     | 
| 
      
 179 
     | 
    
         
            +
            ```
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
            #### Example
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 184 
     | 
    
         
            +
            Alipay::Service.create_direct_pay_by_user_wap_url(
         
     | 
| 
      
 185 
     | 
    
         
            +
              out_trade_no: '20150401000-0001',
         
     | 
| 
      
 186 
     | 
    
         
            +
              subject: 'Order Name',
         
     | 
| 
      
 187 
     | 
    
         
            +
              total_fee: '10.00',
         
     | 
| 
      
 188 
     | 
    
         
            +
              return_url: 'https://example.com/orders/20150401000-0001',
         
     | 
| 
      
 189 
     | 
    
         
            +
              notify_url: 'https://example.com/orders/20150401000-0001/notify'
         
     | 
| 
      
 190 
     | 
    
         
            +
            )
         
     | 
| 
      
 191 
     | 
    
         
            +
            ```
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
            #### Arguments
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
            | Key | Requirement | Description |
         
     | 
| 
      
 196 
     | 
    
         
            +
            | --- | ----------- | ----------- |
         
     | 
| 
      
 197 
     | 
    
         
            +
            | out_order_no | required | Order id in your application. |
         
     | 
| 
      
 198 
     | 
    
         
            +
            | subject | required | Order subject. |
         
     | 
| 
      
 199 
     | 
    
         
            +
            | total_fee | required | Order's total fee. |
         
     | 
| 
      
 200 
     | 
    
         
            +
            | return_url | optional | Redirect customer to this url after payment. |
         
     | 
| 
      
 201 
     | 
    
         
            +
            | notify_url | optional | Alipay asyn notify url. |
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
            This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaywapdirect.zip .
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
       171 
205 
     | 
    
         
             
            ### 即时到账批量退款有密接口
         
     | 
| 
       172 
206 
     | 
    
         | 
| 
       173 
207 
     | 
    
         
             
            #### Name
         
     | 
| 
         @@ -399,13 +433,13 @@ mobile.securitypay.pay 
     | 
|
| 
       399 
433 
     | 
    
         
             
            #### Definition
         
     | 
| 
       400 
434 
     | 
    
         | 
| 
       401 
435 
     | 
    
         
             
            ```ruby
         
     | 
| 
       402 
     | 
    
         
            -
            Alipay::Mobile::Service. 
     | 
| 
      
 436 
     | 
    
         
            +
            Alipay::Mobile::Service.mobile_securitypay_pay_string({ARGUMENTS}, {OPTIONS})
         
     | 
| 
       403 
437 
     | 
    
         
             
            ```
         
     | 
| 
       404 
438 
     | 
    
         | 
| 
       405 
439 
     | 
    
         
             
            #### Example
         
     | 
| 
       406 
440 
     | 
    
         | 
| 
       407 
441 
     | 
    
         
             
            ```ruby
         
     | 
| 
       408 
     | 
    
         
            -
            Alipay::Mobile::Service. 
     | 
| 
      
 442 
     | 
    
         
            +
            Alipay::Mobile::Service.mobile_securitypay_pay_string(
         
     | 
| 
       409 
443 
     | 
    
         
             
              out_trade_no: '20150401000-0001',
         
     | 
| 
       410 
444 
     | 
    
         
             
              notify_url: 'https://example.com/orders/20150401000-0001/notify'
         
     | 
| 
       411 
445 
     | 
    
         
             
              subject: 'subject',
         
     | 
| 
         @@ -429,7 +463,7 @@ Alipay::Mobile::Service.mobile_security_pay_string( 
     | 
|
| 
       429 
463 
     | 
    
         | 
| 
       430 
464 
     | 
    
         
             
            This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/WS_MOBILE_PAY_SDK_BASE.zip .
         
     | 
| 
       431 
465 
     | 
    
         | 
| 
       432 
     | 
    
         
            -
            ## Wap::Service
         
     | 
| 
      
 466 
     | 
    
         
            +
            ## Wap::Service (Deprecated)
         
     | 
| 
       433 
467 
     | 
    
         | 
| 
       434 
468 
     | 
    
         
             
            ### 授权接口
         
     | 
| 
       435 
469 
     | 
    
         | 
    
        data/lib/alipay/service.rb
    CHANGED
    
    | 
         @@ -57,6 +57,23 @@ module Alipay 
     | 
|
| 
       57 
57 
     | 
    
         
             
                  request_uri(params, options).to_s
         
     | 
| 
       58 
58 
     | 
    
         
             
                end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
      
 60 
     | 
    
         
            +
                CREATE_DIRECT_PAY_BY_USER_WAP_REQUIRED_PARAMS = %w( out_trade_no subject total_fee )
         
     | 
| 
      
 61 
     | 
    
         
            +
                # direct wap
         
     | 
| 
      
 62 
     | 
    
         
            +
                def self.create_direct_pay_by_user_wap_url(params, options = {})
         
     | 
| 
      
 63 
     | 
    
         
            +
                  params = Utils.stringify_keys(params)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  check_required_params(params, CREATE_DIRECT_PAY_BY_USER_WAP_REQUIRED_PARAMS)
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  params = {
         
     | 
| 
      
 67 
     | 
    
         
            +
                    'service'        => 'alipay.wap.create.direct.pay.by.user',
         
     | 
| 
      
 68 
     | 
    
         
            +
                    '_input_charset' => 'utf-8',
         
     | 
| 
      
 69 
     | 
    
         
            +
                    'partner'        => options[:pid] || Alipay.pid,
         
     | 
| 
      
 70 
     | 
    
         
            +
                    'seller_id'      => options[:pid] || Alipay.pid,
         
     | 
| 
      
 71 
     | 
    
         
            +
                    'payment_type'   => '1'
         
     | 
| 
      
 72 
     | 
    
         
            +
                  }.merge(params)
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  request_uri(params, options).to_s
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       60 
77 
     | 
    
         
             
                CREATE_REFUND_URL_REQUIRED_PARAMS = %w( batch_no data notify_url )
         
     | 
| 
       61 
78 
     | 
    
         
             
                # 支付宝即时到帐批量退款有密接口(此为异步接口,有密指通过此接口打开 url 后需要用户输入支付宝的支付密码进行退款)
         
     | 
| 
       62 
79 
     | 
    
         
             
                def self.refund_fastpay_by_platform_pwd_url(params, options = {})
         
     | 
    
        data/lib/alipay/version.rb
    CHANGED
    
    
    
        data/test/alipay/service_test.rb
    CHANGED
    
    | 
         @@ -38,6 +38,15 @@ class Alipay::ServiceTest < Minitest::Test 
     | 
|
| 
       38 
38 
     | 
    
         
             
                assert_equal 'https://mapi.alipay.com/gateway.do?service=create_direct_pay_by_user&_input_charset=utf-8&partner=1000000000000000&seller_id=1000000000000000&payment_type=1&out_trade_no=1&subject=test&price=0.01&quantity=1&sign_type=MD5&sign=682ad02280fca7d4c0fd22678fdddeef', Alipay::Service.create_direct_pay_by_user_url(options)
         
     | 
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
              def test_generate_create_direct_pay_by_user_wap_url
         
     | 
| 
      
 42 
     | 
    
         
            +
                options = {
         
     | 
| 
      
 43 
     | 
    
         
            +
                  out_trade_no: '1',
         
     | 
| 
      
 44 
     | 
    
         
            +
                  subject: 'test',
         
     | 
| 
      
 45 
     | 
    
         
            +
                  total_fee: '0.01'
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
      
 47 
     | 
    
         
            +
                assert_equal 'https://mapi.alipay.com/gateway.do?service=alipay.wap.create.direct.pay.by.user&_input_charset=utf-8&partner=1000000000000000&seller_id=1000000000000000&payment_type=1&out_trade_no=1&subject=test&total_fee=0.01&sign_type=MD5&sign=6530de6e3cba153cd4ca7edc48b91f96', Alipay::Service.create_direct_pay_by_user_wap_url(options)
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       41 
50 
     | 
    
         
             
              def test_refund_fastpay_by_platform_pwd_url
         
     | 
| 
       42 
51 
     | 
    
         
             
                data = [{
         
     | 
| 
       43 
52 
     | 
    
         
             
                  trade_no: '1',
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: alipay
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Rei
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-15 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |