alipay 0.6.0.beta1 → 0.6.0.beta2
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/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +11 -1
- data/README.md +418 -142
- data/lib/alipay.rb +7 -3
- data/lib/alipay/notify.rb +11 -4
- data/lib/alipay/service.rb +104 -100
- data/lib/alipay/sign.rb +26 -44
- data/lib/alipay/sign/dsa.rb +13 -0
- data/lib/alipay/sign/md5.rb +15 -0
- data/lib/alipay/sign/rsa.rb +18 -0
- data/lib/alipay/version.rb +1 -1
- data/lib/alipay/wap/notify.rb +13 -0
- data/lib/alipay/wap/service.rb +73 -0
- data/lib/alipay/wap/sign.rb +37 -0
- data/test/alipay/notify_test.rb +9 -6
- data/test/alipay/service_test.rb +6 -6
- data/test/alipay/sign/md5_test.rb +20 -0
- data/test/alipay/sign_test.rb +7 -5
- data/test/alipay/{notify/wap_test.rb → wap/notify_test.rb} +4 -4
- data/test/alipay/{service/wap_test.rb → wap/service_test.rb} +4 -4
- data/test/alipay/{sign/wap_test.rb → wap/sign_test.rb} +2 -2
- metadata +17 -11
- data/lib/alipay/notify/wap.rb +0 -12
- data/lib/alipay/service/wap.rb +0 -69
- data/lib/alipay/sign/wap.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71cda0616aea582148d328443b0125336f53ccd7
|
4
|
+
data.tar.gz: 20c42fb725858fe8b9beb6f82d0c3d7868eb2048
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5f1bb00e7372766e6af487093e775efe68f9ac08bc55a1127babbb8998244bea7c41ab30e6346b4060f0e5c7de8c1ad25ff5df2abbffa8540a439350d43cbfa
|
7
|
+
data.tar.gz: c6d52bf5024cf63e171e044bf34d0b1782e4ad4a48a2fa7773156990b3b97f06edcad400c363e2e12708fc29bd98dcfa93638408cab3038e85589de29f1a4db2
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
## v0.6.0-
|
1
|
+
## v0.6.0.beta2 (2015-04-01)
|
2
|
+
|
3
|
+
- Move `Alipay::Service::Wap` to `Alipay::Wap::Service`
|
4
|
+
- Move `Alipay::Sign::Wap` to `Alipay::Wap::Sign`
|
5
|
+
- Move `Alipay::Notify::Wap` to `Alipay::Wap::Notify`
|
6
|
+
- Rename `Alipay::Service.create_forex_single_refund_url` to `Alipay::Service.forex_refund_url`
|
7
|
+
- Rename `Alipay::Service.create_forex_trade` to `Alipay::Service.create_forex_trade_url`
|
8
|
+
- Rename `Alipay::Service.create_refund_url` to `Alipay::Service.refund_fastpay_by_platform_pwd_url`
|
9
|
+
- All service methods accept `options` args to config pid, seller_email and key.
|
10
|
+
|
11
|
+
## v0.6.0.beta1 (2015-03-26)
|
2
12
|
|
3
13
|
Usage:
|
4
14
|
|
data/README.md
CHANGED
@@ -1,214 +1,490 @@
|
|
1
1
|
# Alipay
|
2
2
|
|
3
|
-
A
|
3
|
+
A unofficial alipay ruby gem.
|
4
4
|
|
5
|
-
|
5
|
+
Alipay official document: https://b.alipay.com/order/techService.htm .
|
6
6
|
|
7
|
-
|
8
|
-
* Send goods
|
9
|
-
* Close trade
|
10
|
-
* Verify notify (web, wap, app)
|
11
|
-
|
12
|
-
Please read alipay official document first: https://b.alipay.com/order/techService.htm .
|
7
|
+
Master branch(v0.6.0) is in develop, checkout [v0.5.0](https://github.com/chloerei/alipay/tree/v0.5.0) if you want to use in production.
|
13
8
|
|
14
9
|
## Installation
|
15
10
|
|
16
11
|
Add this line to your application's Gemfile:
|
17
12
|
|
18
13
|
```ruby
|
19
|
-
gem 'alipay', '~> 0.
|
14
|
+
gem 'alipay', '~> 0.6.0.beta2'
|
20
15
|
```
|
21
16
|
|
22
|
-
or
|
17
|
+
or master branch:
|
23
18
|
|
24
19
|
```ruby
|
25
|
-
gem 'alipay', :
|
20
|
+
gem 'alipay', github: 'chloerei/alipay'
|
26
21
|
```
|
27
22
|
|
28
23
|
And then execute:
|
29
24
|
|
30
|
-
```
|
25
|
+
```console
|
31
26
|
$ bundle
|
32
27
|
```
|
33
28
|
|
34
|
-
##
|
35
|
-
|
36
|
-
### Config
|
29
|
+
## Configuration
|
37
30
|
|
38
31
|
```ruby
|
39
32
|
Alipay.pid = 'YOUR_PID'
|
40
33
|
Alipay.key = 'YOUR_KEY'
|
41
34
|
Alipay.seller_email = 'YOUR_SELLER_EMAIL'
|
42
|
-
|
35
|
+
|
36
|
+
#Alipay.sign_type = 'MD5' # Available values: MD5, RSA. Default is MD5
|
37
|
+
#Alipay.debug_mode = true # Enable parameter check. Default is true.
|
43
38
|
```
|
44
39
|
|
45
|
-
|
40
|
+
You can set default key, or pass a key directly to service method:
|
46
41
|
|
47
42
|
```ruby
|
48
|
-
|
49
|
-
:
|
50
|
-
|
51
|
-
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
|
56
|
-
:discount => '20.00',
|
57
|
-
:return_url => 'YOUR_ORDER_RETURN_URL', # https://writings.io/orders/20130801000001
|
58
|
-
:notify_url => 'YOUR_ORDER_NOTIFY_URL' # https://writings.io/orders/20130801000001/alipay_notify
|
59
|
-
}
|
60
|
-
|
61
|
-
Alipay::Service.create_partner_trade_by_buyer_url(options)
|
62
|
-
# => 'https://mapi.alipay.com/gateway.do?out_trade_no=...'
|
43
|
+
Service.create_partner_trade_by_buyer_url({
|
44
|
+
out_trade_no: 'OUT_TRADE_NO',
|
45
|
+
# Order params...
|
46
|
+
}, {
|
47
|
+
pid: 'ANOTHER_PID',
|
48
|
+
key: 'ANOTHER_KEY',
|
49
|
+
seller_email: 'ANOTHER_SELLER_EMAIL'
|
50
|
+
})
|
63
51
|
```
|
64
52
|
|
65
|
-
|
53
|
+
## Service
|
66
54
|
|
67
|
-
|
55
|
+
### 担保交易收款接口
|
68
56
|
|
69
|
-
|
70
|
-
Alipay::Service#trade_create_by_buyer_url # 标准双接口
|
71
|
-
Alipay::Service#create_direct_pay_by_user_url # 即时到帐
|
57
|
+
#### Name
|
72
58
|
|
73
|
-
|
59
|
+
```ruby
|
60
|
+
create_partner_trade_by_buyer
|
61
|
+
```
|
62
|
+
|
63
|
+
#### Definition
|
74
64
|
|
75
65
|
```ruby
|
76
|
-
|
77
|
-
|
78
|
-
:out_trade_no => 'YOUR_ORDER_ID', # 20130801000001
|
79
|
-
:subject => 'YOUR_ORDER_SUBJECCT', # Writings.io Base Account x 12
|
80
|
-
:total_fee => 'TOTAL_FEE',
|
81
|
-
:notify_url => 'YOUR_ORDER_NOTIFY_URL', # https://writings.io/orders/20130801000001/alipay_notify
|
82
|
-
:call_back_url => 'YOUR_ORDER_RETURN_URL' # https://writings.io/orders/20130801000001
|
83
|
-
}
|
84
|
-
}
|
66
|
+
Alipay::Service.create_partner_trade_by_buyer_url({ARGUMENTS}, {OPTIONS})
|
67
|
+
```
|
85
68
|
|
86
|
-
|
87
|
-
|
88
|
-
|
69
|
+
#### Example
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
Alipay::Service.create_partner_trade_by_buyer_url(
|
73
|
+
out_trade_no: '20150401000-0001',
|
74
|
+
subject: 'Order Name',
|
75
|
+
price: '10.00',
|
76
|
+
quantity: 12,
|
77
|
+
logistics_type: 'DIRECT',
|
78
|
+
logistics_fee: '0',
|
79
|
+
logistics_payment: 'SELLER_PAY',
|
80
|
+
return_url: 'https://example.com/orders/20150401000-0001',
|
81
|
+
notify_url: 'https://example.com/orders/20150401000-0001/notify'
|
82
|
+
)
|
83
|
+
# => 'https://mapi.alipay.com/gateway.do?service=create_partner_trade_by_buyer&...'
|
89
84
|
```
|
90
85
|
|
91
|
-
|
86
|
+
Guide consumer to this address to complete payment
|
87
|
+
|
88
|
+
#### Arguments
|
89
|
+
|
90
|
+
| Key | Requirement | Description |
|
91
|
+
| --- | ----------- | ----------- |
|
92
|
+
| out_order_no | required | Order id in your application. |
|
93
|
+
| subject | required | Order subject. |
|
94
|
+
| price | required | Order item's price. |
|
95
|
+
| quantity | required | Order item's quantity, total price is price * quantity. |
|
96
|
+
| logistics_type | required | Logistics type. Available values: POST, EXPRESS, EMS, DIRECT. |
|
97
|
+
| logistics_fee | required | Logistics fee. |
|
98
|
+
| logistics_payment | required | Who pay the logistics fee. Available values: BUYER_PAY, SELLER_PAY, BUYER_PAY_AFTER_RECEIVE. |
|
99
|
+
| return_url | optional | Redirect customer to this url after payment. |
|
100
|
+
| notify_url | optional | Alipay asyn notify url. |
|
92
101
|
|
93
|
-
|
102
|
+
This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipayescow.zip .
|
94
103
|
|
95
|
-
|
104
|
+
### 确认发货接口
|
96
105
|
|
97
|
-
|
106
|
+
#### Name
|
98
107
|
|
99
108
|
```ruby
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
}
|
109
|
+
send_goods_confirm_by_platform
|
110
|
+
```
|
111
|
+
|
112
|
+
#### Definition
|
105
113
|
|
106
|
-
|
114
|
+
```ruby
|
115
|
+
Alipay::Service.send_goods_confirm_by_platform({ARGUMENTS}, {OPTIONS})
|
116
|
+
```
|
117
|
+
|
118
|
+
#### Example
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
Alipay::Service.send_goods_confirm_by_platform(
|
122
|
+
trade_no: '201504010000001',
|
123
|
+
logistics_name: 'example.com'
|
124
|
+
)
|
107
125
|
# => '<!xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success></alipay>'
|
108
126
|
```
|
109
127
|
|
110
|
-
|
128
|
+
#### Arguments
|
129
|
+
|
130
|
+
| Key | Requirement | Description |
|
131
|
+
| --- | ----------- | ----------- |
|
132
|
+
| trade_no | required | Trade number in Alipay system, should get from notify message. |
|
133
|
+
| logistics_name | required | Logistics Name. |
|
134
|
+
|
135
|
+
This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipayescow.zip .
|
136
|
+
|
137
|
+
### 即时到账收款接口
|
138
|
+
|
139
|
+
#### Name
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
create_direct_pay_by_user
|
143
|
+
```
|
144
|
+
|
145
|
+
#### Definition
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
Alipay::Service.create_direct_pay_by_user_url({ARGUMENTS}, {OPTIONS})
|
149
|
+
```
|
150
|
+
|
151
|
+
#### Example
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
Alipay::Service.create_direct_pay_by_user_url(
|
155
|
+
out_trade_no: '20150401000-0001',
|
156
|
+
subject: 'Order Name',
|
157
|
+
price: '10.00',
|
158
|
+
quantity: 12,
|
159
|
+
return_url: 'https://example.com/orders/20150401000-0001',
|
160
|
+
notify_url: 'https://example.com/orders/20150401000-0001/notify'
|
161
|
+
)
|
162
|
+
```
|
163
|
+
|
164
|
+
#### Arguments
|
165
|
+
|
166
|
+
| Key | Requirement | Description |
|
167
|
+
| --- | ----------- | ----------- |
|
168
|
+
| out_order_no | required | Order id in your application. |
|
169
|
+
| subject | required | Order subject. |
|
170
|
+
| price | required * | Order item's price. |
|
171
|
+
| quantity | required * | Order item's quantity, total price is price * quantity. |
|
172
|
+
| return_url | optional | Redirect customer to this url after payment. |
|
173
|
+
| notify_url | optional | Alipay asyn notify url. |
|
174
|
+
|
175
|
+
\* Can be replaced by total_fee. When total_fee is set, price and quantity could not be set.
|
176
|
+
|
177
|
+
This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaydirect.zip .
|
178
|
+
|
179
|
+
### 即时到账批量退款有密接口
|
180
|
+
|
181
|
+
#### Name
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
refund_fastpay_by_platform_pwd
|
185
|
+
```
|
186
|
+
|
187
|
+
#### Definition
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
Alipay::Service.refund_fastpay_by_platform_pwd_url
|
191
|
+
```
|
192
|
+
|
193
|
+
#### Example
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
batch_no = Alipay::Utils.generate_batch_no # refund batch no, you SHOULD store it to db to avoid alipay duplicate refund
|
197
|
+
Alipay::Service.refund_fastpay_by_platform_pwd_url(
|
198
|
+
batch_no: batch_no,
|
199
|
+
data: [{
|
200
|
+
trade_no: '201504010000001',
|
201
|
+
amount: '10.0',
|
202
|
+
reason: 'REFUND_REASON'
|
203
|
+
}],
|
204
|
+
notify_url: 'https://example.com/orders/20150401000-0001/refund_notify'
|
205
|
+
)
|
206
|
+
# => https://mapi.alipay.com/gateway.do?service=refund_fastpay_by_platform_pwd&...
|
207
|
+
```
|
208
|
+
|
209
|
+
#### Arguments
|
210
|
+
|
211
|
+
| Key | Requirement | Description |
|
212
|
+
| --- | ----------- | ----------- |
|
213
|
+
| batch_no | required | Refund batch no, you should store it to db to avoid alipay duplicate refund. |
|
214
|
+
| data | required | Refund data, a hash array. |
|
215
|
+
| notify_url | required | Alipay notify url. |
|
216
|
+
|
217
|
+
##### Data Item
|
218
|
+
|
219
|
+
| Key | Requirement | Description |
|
220
|
+
| --- | ----------- | ----------- |
|
221
|
+
| trade_no | required | Trade number in alipay system. |
|
222
|
+
| amount | required | Refund amount. |
|
223
|
+
| reason | required | Refund reason. Less than 256 bytes, could not contain special characters: ^ $ | #. |
|
224
|
+
|
225
|
+
This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaydirect.zip .
|
226
|
+
|
227
|
+
### 关闭交易接口
|
228
|
+
|
229
|
+
#### Name
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
close_trade
|
233
|
+
```
|
234
|
+
|
235
|
+
#### Definition
|
236
|
+
|
237
|
+
```ruby
|
238
|
+
Alipay::Service.close_trade({ARGUMENTS}, {OPTIONS})
|
239
|
+
```
|
240
|
+
|
241
|
+
#### Example
|
111
242
|
|
112
243
|
```ruby
|
113
244
|
Alipay::Service.close_trade(
|
114
|
-
:
|
115
|
-
:out_order_no => 'the-out-order-no'
|
245
|
+
trade_no: '201504010000001'
|
116
246
|
)
|
117
247
|
# => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success></alipay>'
|
248
|
+
|
249
|
+
# When fail
|
250
|
+
# => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>F</is_success> <error>TRADE_STATUS_NOT_AVAILD</error></alipay>'
|
118
251
|
```
|
119
252
|
|
120
|
-
|
253
|
+
#### ARGUMENTS
|
254
|
+
|
255
|
+
| Key | Requirement | Description |
|
256
|
+
| --- | ----------- | ----------- |
|
257
|
+
| out_order_no | optional * | Order number in your application. |
|
258
|
+
| trade_no | optional * | Trade number in alipay system. |
|
259
|
+
|
260
|
+
\* out_order_no and trade_no must have one.
|
121
261
|
|
122
|
-
|
262
|
+
### 单笔交易查询接口
|
123
263
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
<error>TRADE_STATUS_NOT_AVAILD</error>
|
129
|
-
</alipay>
|
264
|
+
#### Name
|
265
|
+
|
266
|
+
```ruby
|
267
|
+
single_trade_query
|
130
268
|
```
|
131
269
|
|
132
|
-
|
270
|
+
#### Definition
|
133
271
|
|
134
|
-
|
272
|
+
```ruby
|
273
|
+
Alipay::Service.single_trade_query({ARGUMENTS}, {OPTIONS})
|
274
|
+
```
|
275
|
+
|
276
|
+
#### Example
|
135
277
|
|
136
278
|
```ruby
|
137
279
|
Alipay::Service.single_trade_query(
|
138
|
-
:
|
139
|
-
:out_order_no => 'the-out-order-no'
|
280
|
+
trade_no: '201504010000001'
|
140
281
|
)
|
141
|
-
# => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success
|
282
|
+
# => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success>...
|
142
283
|
```
|
143
284
|
|
144
|
-
|
285
|
+
#### ARGUMENTS
|
286
|
+
|
287
|
+
| Key | Requirement | Description |
|
288
|
+
| --- | ----------- | ----------- |
|
289
|
+
| out_trade_no | optional * | Order number in your application. |
|
290
|
+
| trade_no | optional * | Trade number in alipay system. |
|
291
|
+
|
292
|
+
\* out_trade_no and trade_no must have one.
|
293
|
+
|
294
|
+
### 境外收单接口
|
295
|
+
|
296
|
+
#### Name
|
145
297
|
|
146
298
|
```ruby
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
299
|
+
create_forex_trade
|
300
|
+
```
|
301
|
+
|
302
|
+
#### Definition
|
303
|
+
|
304
|
+
```ruby
|
305
|
+
Alipay::Service.create_forex_trade_url({ARGUMENTS}, {OPTIONS})
|
306
|
+
```
|
307
|
+
|
308
|
+
#### Example
|
309
|
+
|
310
|
+
```ruby
|
311
|
+
Alipay::Service.create_forex_trade_url(
|
312
|
+
out_trade_no: '20150401000-0001',
|
313
|
+
subject: 'Subject',
|
314
|
+
currency: 'USD',
|
315
|
+
total_fee: '10.00',
|
316
|
+
notify_url: 'https://example.com/orders/20150401000-0001/notify'
|
317
|
+
)
|
318
|
+
# => 'https://mapi.alipay.com/gateway.do?service=create_forex_trade...'
|
319
|
+
```
|
320
|
+
|
321
|
+
#### ARGUMENTS
|
322
|
+
|
323
|
+
| Key | Requirement | Description |
|
324
|
+
| --- | ----------- | ----------- |
|
325
|
+
| out_trade_no | required | Order number in your application. |
|
326
|
+
| subject | required | Order subject. |
|
327
|
+
| currency | required | Abbreviated currency name. |
|
328
|
+
| total_fee | required | Order total price. |
|
329
|
+
| notify_url | optional | Alipay asyn notify url. |
|
330
|
+
|
331
|
+
### 境外收单单笔退款接口
|
332
|
+
|
333
|
+
#### Name
|
334
|
+
|
335
|
+
```ruby
|
336
|
+
forex_refund
|
337
|
+
```
|
338
|
+
|
339
|
+
#### Definition
|
340
|
+
|
341
|
+
```ruby
|
342
|
+
Alipay::Service.forex_refund_url({ARGUMENTS}, {OPTIONS})
|
343
|
+
```
|
344
|
+
|
345
|
+
#### Example
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
Alipay::Service.forex_refund_url(
|
349
|
+
out_return_no: '20150401000-0001',
|
350
|
+
out_trade_no: '201504010000001',
|
351
|
+
return_amount: '10.00',
|
352
|
+
currency: 'USD',
|
353
|
+
reason: 'Reason',
|
354
|
+
gmt_return: '2015-04-01 00:00:00'
|
355
|
+
)
|
356
|
+
```
|
357
|
+
|
358
|
+
#### ARGUMENTS
|
359
|
+
|
360
|
+
| Key | Requirement | Description |
|
361
|
+
| --- | ----------- | ----------- |
|
362
|
+
| out_return_no | required | Refund no, you should store it to db to avoid alipay duplicate refund. |
|
363
|
+
| out_trade_no | required | Order number in your application. |
|
364
|
+
| return_amount | required | Refund amount. |
|
365
|
+
| currency | required | Abbreviated currency name. |
|
366
|
+
| reason | required | Refun reason. |
|
367
|
+
| notify_url | optional | Alipay asyn notify url. |
|
368
|
+
|
369
|
+
### 验证通知
|
370
|
+
|
371
|
+
#### Name
|
372
|
+
|
373
|
+
```ruby
|
374
|
+
notify_verify
|
375
|
+
```
|
376
|
+
|
377
|
+
#### Definition
|
378
|
+
|
379
|
+
```ruby
|
380
|
+
Alipay::Notify.verify?({PARAMS}, {OPTIONS})
|
381
|
+
```
|
382
|
+
|
383
|
+
#### Example
|
384
|
+
|
385
|
+
```ruby
|
386
|
+
# Rails
|
387
|
+
# params except :controller_name, :action_name, :host, etc.
|
388
|
+
notify_params = params.except(*request.path_parameters.keys)
|
389
|
+
|
390
|
+
Alipay::Notify.verify?(notify_params)
|
391
|
+
```
|
392
|
+
|
393
|
+
## Wap::Service
|
394
|
+
|
395
|
+
### 授权接口
|
396
|
+
|
397
|
+
#### Name
|
398
|
+
|
399
|
+
```ruby
|
400
|
+
alipay.wap.trade.create.direct
|
401
|
+
```
|
402
|
+
|
403
|
+
#### Definition
|
404
|
+
|
405
|
+
```ruby
|
406
|
+
Alipay::Wap::Service.trade_create_direct_token({ARGUMENTS}, {OPTIONS}}
|
407
|
+
```
|
408
|
+
|
409
|
+
#### Example
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
token = Alipay::Wap::Service.trade_create_direct_token(
|
413
|
+
req_data: {
|
414
|
+
out_trade_no: '20150401000-0001',
|
415
|
+
subject: 'Subject',
|
416
|
+
total_fee: '10.0',
|
417
|
+
call_back_url: 'https://example.com/orders/20150401000-0001',
|
418
|
+
notify_url: 'https://example.com/orders/20150401000-0001/notify'
|
419
|
+
}
|
420
|
+
)
|
421
|
+
```
|
422
|
+
|
423
|
+
#### ARGUMENTS
|
424
|
+
|
425
|
+
| Key | Requirement | Description |
|
426
|
+
| --- | ----------- | ----------- |
|
427
|
+
| req_data | required | See req_data ARGUMENTS |
|
428
|
+
|
429
|
+
##### req_data ARGUMENTS
|
430
|
+
|
431
|
+
| Key | Requirement | Description |
|
432
|
+
| --- | ----------- | ----------- |
|
433
|
+
| out_order_no | required | Order id in your application. |
|
434
|
+
| subject | required | Order subject. |
|
435
|
+
| total_fee | required | Order total price. |
|
436
|
+
| return_url | optional | Redirect customer to this url after payment. |
|
437
|
+
| notify_url | optional | Alipay asyn notify url. |
|
438
|
+
|
439
|
+
This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/WS_WAP_PAYWAP.zip .
|
440
|
+
|
441
|
+
### 交易接口
|
442
|
+
|
443
|
+
#### Name
|
444
|
+
|
445
|
+
```ruby
|
446
|
+
alipay.wap.auth.authAndExecute
|
447
|
+
```
|
448
|
+
|
449
|
+
#### Definition
|
450
|
+
|
451
|
+
```ruby
|
452
|
+
Alipay::Wap::Service.auth_and_execute({ARGUMENTS}, {OPTIONS})
|
453
|
+
```
|
454
|
+
|
455
|
+
#### Example
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
Alipay::Wap::Service.auth_and_execute(request_token: token)
|
459
|
+
```
|
460
|
+
#### ARGUMENTS
|
461
|
+
|
462
|
+
| Key | Requirement | Description |
|
463
|
+
| --- | ----------- | ----------- |
|
464
|
+
| request_token | required | Get from trade_create_direct_token |
|
465
|
+
|
466
|
+
### 验证通知
|
467
|
+
|
468
|
+
#### Name
|
469
|
+
|
470
|
+
```ruby
|
471
|
+
notify_verify
|
472
|
+
```
|
473
|
+
|
474
|
+
#### Definition
|
475
|
+
|
476
|
+
```ruby
|
477
|
+
Alipay::Wap::Notify.verify?({PARAMS}, {OPTIONS})
|
478
|
+
```
|
479
|
+
|
480
|
+
#### Example
|
481
|
+
|
482
|
+
```ruby
|
483
|
+
# Rails
|
484
|
+
# params except :controller_name, :action_name, :host, etc.
|
485
|
+
notify_params = params.except(*request.path_parameters.keys)
|
486
|
+
|
487
|
+
Alipay::Wap::Notify.verify?(notify_params)
|
212
488
|
```
|
213
489
|
|
214
490
|
## Contributing
|