Sha256: d8fff81cefc6564368acccf59e761cdcf8ed4c5d365bc1564d41715f8b737005

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'test_helper'

class Alipay::Service::WapTest < Test::Unit::TestCase
  def test_trade_create_direct_token
    token = 'REQUEST_TOKEN'
    body = <<-EOS
      res_data=
        <?xmlversion="1.0" encoding="utf-8"?>
        <direct_trade_create_res>
          <request_token>#{token}</request_token>
        </direct_trade_create_res>
      &partner=PID
      &req_id=REQ_ID
      &sec_id=MD5
      &service=alipay.wap.trade.create.direct
      &v=2.0
      &sign=SIGN
    EOS

    FakeWeb.register_uri(
      :get,
      %r|https://wappaygw\.alipay\.com/service/rest\.htm.*|,
      :body => body
    )

    assert_equal token, Alipay::Service::Wap.trade_create_direct_token(
      :req_data => {
        :out_trade_no  => '1',
        :subject       => 'subject',
        :total_fee     => '0.01',
        :call_back_url => 'http://www.yoursite.com/call_back'
      }
    )
  end

  def test_auth_and_execute
    options = { :request_token => 'token_test' }
    assert_not_nil Alipay::Service::Wap.auth_and_execute(options)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alipay-0.3.0 test/alipay/service/wap_test.rb
alipay-0.2.0 test/alipay/service/wap_test.rb
alipay-0.1.0 test/alipay/service/wap_test.rb
alipay-0.0.5 test/alipay/service/wap_test.rb