fakesite-alipay 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9417cd9d34c4161a894206894c2fc0ea5aff54d8
4
- data.tar.gz: 1421734a31ddea9347d8cbb4b54a2b4f18138979
3
+ metadata.gz: f1a53dc2a4a294db60c0a05a05d3057d4ed1c4e5
4
+ data.tar.gz: 8c527ebd746f2d260190a0b2880fb3c4b30e7c50
5
5
  SHA512:
6
- metadata.gz: dd96e5f12a2b7a576ff7def73af308bbec251475c87f9ebc6d76a65dd13404c17cbc9241bde832c41870e0366821defac585459b86920b7eaa7c40eabbda4548
7
- data.tar.gz: 0f806873ac178dc44cff139ce94e021b17777c89b35301a6f17b6a85fb72e694d4bf2624237cd33363baa8c9a5be5a3e4e2ba594f799534230adce4fab2bda4e
6
+ metadata.gz: 38ba2589368f8aac7c0c50aaca236e21dcb838e2c416547ca9bf58b35d3e636ab460fd8dbd6c72743b6549f9c76a9e974487b36fdf16c5c5d2c176e7a1a83406
7
+ data.tar.gz: 9796f632ef880e92ff343bcb0433ad4aa5f44d83275d59623e6155cafba1c0f1a0a7b55611abb65043143ec585d9c6edcb0c86bf46a20ed93aefca046f2456c0
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
- # v0.1.1 / 2015-10-12
2
-
3
- Fixed timezone in +8.
4
-
5
- # v0.1.0 / 2015-10-08
6
-
7
- Create project
1
+ # v0.2.0 / 2015-10-13
2
+
3
+ Upgrade to support fakesite v0.2.0.
4
+
5
+ # v0.1.1 / 2015-10-12
6
+
7
+ Fixed timezone in +8.
8
+
9
+ # v0.1.0 / 2015-10-08
10
+
11
+ Create project
data/README.md CHANGED
@@ -1,45 +1,45 @@
1
- # fakesite-alipay
2
-
3
- [![Build Status](https://api.travis-ci.org/emn178/fakesite-alipay.png)](https://travis-ci.org/emn178/fakesite-alipay)
4
- [![Coverage Status](https://coveralls.io/repos/emn178/fakesite-alipay/badge.svg?branch=master)](https://coveralls.io/r/emn178/fakesite-alipay?branch=master)
5
-
6
- A [fakesite](https://github.com/emn178/fakesite) plugin that provides a stub method for alipay. It's useful to bypass payment flow in develpment environment.
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'fakesite-alipay', group: :development
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- ### Route
21
-
22
- Make sure that you have added fakesite route in your `config/route.rb`
23
- ```Ruby
24
- mount Fakesite::Engine => "/fakesite" if Rails.env.development?
25
- ```
26
-
27
- ## Usage
28
-
29
- Add registration to `config/initializers/fakesite.rb`
30
- ```Ruby
31
- if Rails.env.development?
32
- WebMock.allow_net_connect!
33
- Fakesite.register Fakesite::Alipay::Base.new({:pid => 'PID', :key => 'KEY'})
34
- end
35
- ```
36
- `PID` and `KEY` could be fake, but they have to be equal to the settings of library (eg. Gem `alipay`) that you use to request Alipay.
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
42
- ## Contact
43
-
44
- The project's website is located at https://github.com/emn178/fakesite-alipay
45
- Author: emn178@gmail.com
1
+ # fakesite-alipay
2
+
3
+ [![Build Status](https://api.travis-ci.org/emn178/fakesite-alipay.png)](https://travis-ci.org/emn178/fakesite-alipay)
4
+ [![Coverage Status](https://coveralls.io/repos/emn178/fakesite-alipay/badge.svg?branch=master)](https://coveralls.io/r/emn178/fakesite-alipay?branch=master)
5
+
6
+ A [fakesite](https://github.com/emn178/fakesite) plugin that provides a stub method for alipay. It's useful to bypass payment flow in develpment environment.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'fakesite-alipay', group: :development
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ ### Route
21
+
22
+ Make sure that you have added fakesite route in your `config/route.rb`
23
+ ```Ruby
24
+ mount Fakesite::Engine => "/fakesite" if Rails.env.development?
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Add registration to `config/initializers/fakesite.rb`
30
+ ```Ruby
31
+ if Rails.env.development?
32
+ WebMock.allow_net_connect!
33
+ Fakesite.register :alipay, Fakesite::Alipay::Base, {:pid => 'PID', :key => 'KEY'}
34
+ end
35
+ ```
36
+ `PID` and `KEY` could be fake, but they have to be equal to the settings of library (eg. Gem `alipay`) that you use to request Alipay.
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
42
+ ## Contact
43
+
44
+ The project's website is located at https://github.com/emn178/fakesite-alipay
45
+ Author: emn178@gmail.com
@@ -1,28 +1,28 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'fakesite/alipay/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "fakesite-alipay"
8
- spec.version = Fakesite::Alipay::VERSION
9
- spec.authors = ["Chen Yi-Cyuan"]
10
- spec.email = ["emn178@gmail.com"]
11
-
12
- spec.summary = %q{A fakesite plugin that provides a stub method for alipay.}
13
- spec.description = %q{A fakesite plugin that provides a stub method for alipay.}
14
- spec.homepage = "https://github.com/emn178/fakesite-alipay"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_dependency "fakesite"
21
- spec.add_dependency "webmock"
22
-
23
- spec.add_development_dependency "bundler", "~> 1.10"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "rspec-its"
27
- spec.add_development_dependency "alipay"
28
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fakesite/alipay/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fakesite-alipay"
8
+ spec.version = Fakesite::Alipay::VERSION
9
+ spec.authors = ["Chen Yi-Cyuan"]
10
+ spec.email = ["emn178@gmail.com"]
11
+
12
+ spec.summary = %q{A fakesite plugin that provides a stub method for alipay.}
13
+ spec.description = %q{A fakesite plugin that provides a stub method for alipay.}
14
+ spec.homepage = "https://github.com/emn178/fakesite-alipay"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "fakesite", ">= 0.2.0"
21
+ spec.add_dependency "webmock"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rspec-its"
27
+ spec.add_development_dependency "alipay"
28
+ end
@@ -1,46 +1,36 @@
1
- module Fakesite
2
- module Alipay
3
- class Base < Fakesite::Base
4
- include WebMock::API
5
-
6
- @@stubbed = false
7
-
8
- def initialize(options = {})
9
- unless @@stubbed
10
- @@stubbed = true
11
- stub_request(:get, 'https://' + Host + '/gateway.do')
12
- .with(:query => hash_including({:service => 'notify_verify'}))
13
- .to_return(:status => 200, :body => "true")
14
- end
15
- super(options)
16
- end
17
-
18
- def id
19
- :alipay
20
- end
21
-
22
- def match(external_uri)
23
- external_uri.host == Host
24
- end
25
-
26
- def parameters(external_uri)
27
- {
28
- "trade_status" => 'TRADE_SUCCESS',
29
- "trade_no" => Time.now.to_i.to_s,
30
- "notify_id" => Time.now.to_i.to_s,
31
- "buyer_email" => "",
32
- "buyer_id" => "",
33
- "exterface" => "create_direct_pay_by_user",
34
- "notify_time" => (Time.now.utc + 28800).strftime("%Y-%m-%d %H:%M:%S")
35
- }
36
- end
37
-
38
- def return_parameters(params)
39
- string = params.sort.map { |item| item.join('=') }.join('&')
40
- params["sign"] = Digest::MD5.hexdigest("#{string}#{@options[:key]}")
41
- params["sign_type"] = "MD5"
42
- return params
43
- end
44
- end
45
- end
46
- end
1
+ module Fakesite
2
+ module Alipay
3
+ class Base < Fakesite::Base
4
+ extend WebMock::API
5
+
6
+ def parameters
7
+ {
8
+ "trade_status" => 'TRADE_SUCCESS',
9
+ "trade_no" => Time.now.to_i.to_s,
10
+ "notify_id" => Time.now.to_i.to_s,
11
+ "buyer_email" => "",
12
+ "buyer_id" => "",
13
+ "exterface" => "create_direct_pay_by_user",
14
+ "notify_time" => (Time.now.utc + 28800).strftime("%Y-%m-%d %H:%M:%S")
15
+ }
16
+ end
17
+
18
+ def return_parameters
19
+ string = params.sort.map { |item| item.join('=') }.join('&')
20
+ params["sign"] = Digest::MD5.hexdigest("#{string}#{@options[:key]}")
21
+ params["sign_type"] = "MD5"
22
+ return params
23
+ end
24
+
25
+ def self.match(external_uri)
26
+ external_uri.host == Host
27
+ end
28
+
29
+ def self.after_register
30
+ stub_request(:get, 'https://' + Host + '/gateway.do')
31
+ .with(:query => hash_including({:service => 'notify_verify'}))
32
+ .to_return(:status => 200, :body => "true")
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
- module Fakesite
2
- module Alipay
3
- VERSION = "0.1.1"
4
- end
5
- end
1
+ module Fakesite
2
+ module Alipay
3
+ VERSION = "0.2.0"
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakesite-alipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen Yi-Cyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakesite
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: webmock
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.4.5
150
+ rubygems_version: 2.4.8
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: A fakesite plugin that provides a stub method for alipay.