alipay 0.1.0 → 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: 21c26d432175befb4f2fdd63b566d6559b9c780d
4
- data.tar.gz: c94665762bb6f791bf00325d588009cf91b98b3e
3
+ metadata.gz: a82251b3f0f9bf268033359506be8a6f6057498f
4
+ data.tar.gz: 9942b8e00d07cba64b1e911395a5a74b1936184b
5
5
  SHA512:
6
- metadata.gz: 536b28065495cce9925e46ffac984667c54016e8cafe81ae271e4db7a8f3a099edeb1e11362da60234f39c4f4b9a24f4cf1d1695f088f0c5b6ac68fe8b1a0e9f
7
- data.tar.gz: 9c38d2c2b4f840662a2b99640766ccd705890dced17140b2a716d647895342dcabf62ce8fa0f8d5d98d2882c89a7801d1ea00e209d45959e68d310914bcf4b5a
6
+ metadata.gz: 4983fcb2e960b7e6ccc9ad3bc16d1c4c625b963eaffafa45938be676f3b1119790019ead77a0278eaddcedf8b4c4b66a030dc6c30c727871e1ca46744742524c
7
+ data.tar.gz: b44a46ab7f5fd8b465375965ab99546e5bda8f2c32c9ab8ea455e8d2a6a39124f537695cfd4b7cb04914f187e741413abac32dbaad779307ed8c89604386e32d
@@ -1,9 +1,9 @@
1
- ## v0.1.0 (2014-06-15)
1
+ ## v0.2.0 (2014-12-03)
2
2
 
3
- - Add Wap API
3
+ - Add `create_forex_trade` service. by @christophe-dufour
4
4
 
5
- via @HungYuHei
5
+ ## v0.1.0 (2014-06-15)
6
6
 
7
- - Add App API
7
+ - Add Wap API by @HungYuHei
8
8
 
9
- via @HungYuHei
9
+ - Add App API by @HungYuHei
data/README.md CHANGED
@@ -132,7 +132,16 @@ def alipay_web_notify
132
132
  notify_params = params.except(*request.path_parameters.keys)
133
133
 
134
134
  if Alipay::Notify.verify?(notify_params)
135
- # valid notify, code your business logic.
135
+ # Valid notify, code your business logic.
136
+ # trade_status is base on your payment type
137
+ # Example:
138
+ #
139
+ # case params[:trade_status]
140
+ # when 'WAIT_BUYER_PAY'
141
+ # when 'WAIT_SELLER_SEND_GOODS'
142
+ # when 'TRADE_FINISHED'
143
+ # when 'TRADE_CLOSED'
144
+ # end
136
145
  render :text => 'success'
137
146
  else
138
147
  render :text => 'error'
@@ -99,6 +99,21 @@ module Alipay
99
99
  open("#{GATEWAY_URL}?#{query_string(options)}").read
100
100
  end
101
101
 
102
+
103
+ CREATE_FOREX_TRADE_REQUIRED_OPTIONS = %w(service partner _input_charset notify_url subject out_trade_no currency total_fee)
104
+ def self.create_forex_trade(options)
105
+ options = {
106
+ 'service' => 'create_forex_trade',
107
+ '_input_charset' => 'utf-8',
108
+ 'partner' => Alipay.pid,
109
+ 'seller_email' => Alipay.seller_email
110
+ }.merge(Utils.stringify_keys(options))
111
+
112
+ check_required_options(options, CREATE_FOREX_TRADE_REQUIRED_OPTIONS)
113
+
114
+ "#{GATEWAY_URL}?#{query_string(options)}"
115
+ end
116
+
102
117
  def self.query_string(options)
103
118
  options.merge('sign_type' => 'MD5', 'sign' => Alipay::Sign.generate(options)).map do |key, value|
104
119
  "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
@@ -1,3 +1,3 @@
1
1
  module Alipay
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -51,6 +51,18 @@ class Alipay::ServiceTest < Test::Unit::TestCase
51
51
  assert_not_nil Alipay::Service.create_refund_url(options)
52
52
  end
53
53
 
54
+ def test_generate_create_forex_trade
55
+ options = {
56
+ :notify_url => 'https://writings.io/orders/20130801000001/alipay_notify',
57
+ :return_url => 'https://writings.io/orders/20130801000001',
58
+ :subject => 'test',
59
+ :out_trade_no => '1',
60
+ :currency => 'EUR',
61
+ :total_fee => '0.0.1',
62
+ }
63
+ assert_not_nil Alipay::Service.create_forex_trade(options)
64
+ end
65
+
54
66
 
55
67
  def test_should_send_goods_confirm_by_platform
56
68
  body = <<-EOF
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
11
+ date: 2014-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler