App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-18 e5d34f5c51e4a852e67d24709ec7e7b708846066
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="320">
<title>Payment Document</title>
<link rel="stylesheet" type="text/css" href="res/doc.css" charset="utf-8">
<link rel="stylesheet" type="text/css" href="res/prettify.sons.css" charset="utf-8">
<script type="text/javascript" src="res/doc.js" charset="utf-8"></script><script type="text/javascript" src="res/prettify.js" charset="utf-8"></script>
</head>
<body><div id="content" class="content">
<h1><a name="plus.payment">payment</a></h1>
<p>Payment模块管理支付功能,用于提供网页安全支付能力,支持通过Web接口进行支付操作。通过plus.payment可获取支付管理对象。</p>
<h2>方法:</h2>
<ul>
<li>
<a href="#plus.payment.getChannels">getChannels</a>: 获取支付通道</li>
<li>
<a href="#plus.payment.request">request</a>: 请求支付操作</li>
</ul>
<h2>对象:</h2>
<ul>
<li>
<a href="#plus.payment.PaymentChannel">PaymentChannel</a>: 支付通道对象</li>
<li>
<a href="#plus.payment.OrderStatementIAP">OrderStatementIAP</a>: IAP订单数据对象</li>
<li>
<a href="#plus.payment.PaymentResult">PaymentResult</a>: 支付操作结果对象</li>
<li>
<a href="#plus.payment.IAPProduct">IAPProduct</a>: IAP商品对象</li>
<li>
<a href="#plus.payment.IAPProductInfo">IAPProductInfo</a>: 购买IAP商品对象</li>
<li>
<a href="#plus.payment.IAPTransaction">IAPTransaction</a>: 购买IAP商品交易信息对象</li>
</ul>
<h2>回调方法:</h2>
<ul>
<li>
<a href="#plus.payment.ChannelsSuccessCallback">ChannelsSuccessCallback</a>: 获取支付通道成功回调</li>
<li>
<a href="#plus.payment.IapRequestOrderSuccessCallback">IapRequestOrderSuccessCallback</a>: 请求支付商品列表回调方法</li>
<li>
<a href="#plus.payment.IapRestoreComplateRequestCallback">IapRestoreComplateRequestCallback</a>: 请求已经购买的非消耗性商品和订阅商品回调方法</li>
<li>
<a href="#plus.payment.PaymentSuccessCallback">PaymentSuccessCallback</a>: 支付操作成功回调</li>
<li>
<a href="#plus.payment.PaymentErrorCallback">PaymentErrorCallback</a>: 支付操作失败回调</li>
</ul>
<h2>权限:</h2>
<p>permissions</p>
<pre class="prettyprint linenums">
{
// ...
"permissions":{
    // ...
    "Payment": {
        "description": "支付"
    }
}
}
            </pre>
<h1><a name="plus.payment.PaymentChannel">PaymentChannel</a></h1>
<p>支付通道对象</p>
<pre class="prettyprint linenums">
interface plus.payment.PaymentChannel{
    attribute String id;
    attribute String description;
    attribute Boolean serviceReady;
    function void installService();
    
    // iOS iAP
    function void requestOrder(ids, successCB, errorCB);
    function void restoreComplateRequest(options, successCB);
}
                </pre>
<h2>说明:</h2>
<p class="des">
PaymentChannel对象表示特定的支付通道,用于向系统请求支付操作。
                </p>
<h2>属性:</h2>
<ul>
<li>
<a href="#plus.payment.PaymentChannel.id">id</a>: 支付通道标识</li>
<li>
<a href="#plus.payment.PaymentChannel.description">description</a>: 支付通道描述</li>
<li>
<a href="#plus.payment.PaymentChannel.serviceReady">serviceReady</a>: 支付通道服务是否安装</li>
</ul>
<h2>方法:</h2>
<ul>
<li>
<a href="#plus.payment.PaymentChannel.installService">installService</a>: 安装支付通道依赖的服务</li>
<li>
<a href="#plus.payment.PaymentChannel.requestOrder">requestOrder</a>: 向IAP服务器请求支付订单</li>
<li>
<a href="#plus.payment.PaymentChannel.restoreComplateRequest">restoreComplateRequest</a>: 向IAP服务器请求已经购买的非消耗性商品和订阅商品</li>
</ul>
<h1><a name="plus.payment.OrderStatementIAP">OrderStatementIAP</a></h1>
<p>IAP订单数据对象</p>
<pre class="prettyprint linenums">
interface plus.payment.OrderStatementIAP {
    attribute String productid;
    attribute String username;
    attribute String quantity;
}
                </pre>
<h2>说明:</h2>
<p class="des">
    描述IAP商品订单信息,如标识、数量等。
                </p>
<h2>属性:</h2>
<ul>
<li>productid: <em>(<font class="type">String</font>
    类型
)</em>商品的标识<br>
</li>
<li>username: <em>(<font class="type">String</font>
    类型
)</em>购买用户名称<br>
</li>
<li>quantity: <em>(<font class="type">String</font>
    类型
)</em>商品数量<br>
</li>
</ul>
<h1><a name="plus.payment.PaymentResult">PaymentResult</a></h1>
<p>支付操作结果对象</p>
<pre class="prettyprint linenums">
interface plus.payment.PaymentResult {
    attribute PaymentChannel channel;
    attribute String tradeno;
    attribute String description;
    attribute String url;
    attribute String signature;
    attribute String rawdata;
}
                </pre>
<h2>说明:</h2>
<p class="des">
PaymentResult对象表示支付操作返回结果,用于确认支付操作成功。
                </p>
<h2>属性:</h2>
<ul>
<li>channel: <em>(<a href="#plus.payment.PaymentChannel">PaymentChannel</a>
    类型
)</em>支付通道对象<br><p>
        用于发起支付操作的支付通道对象。
                        </p>
</li>
<li>tradeno: <em>(<font class="type">String</font>
    类型
)</em>交易编号信息<br><p>
    如果支付平台不支持此数据则返回undefined。
                        </p>
</li>
<li>description: <em>(<font class="type">Boolean</font>
    类型
)</em>交易描述信息<br><p>
    如果支付平台不支持此数据则返回undefined。
                        </p>
</li>
<li>url: <em>(<font class="type">Boolean</font>
    类型
)</em>查找支付交易信息地址<br><p>
    用于向支付平台查询交易信息,如果支付平台不支持此数据则返回undefined。
                        </p>
</li>
<li>signature: <em>(<font class="type">String</font>
    类型
)</em>支付操作指纹信息<br><p>
    用于向支付平台查询支付订单信息,如果支付平台不支持此数据则返回undefined。
                        </p>
</li>
<li>rawdata: <em>(<font class="type">String</font>
    类型
)</em>支付平台返回的原始数据<br><p>
    如果支付平台返回key-value类型字符串,则组合成符合JSON格式的字符串。
                        </p>
</li>
</ul>
<h1><a name="plus.payment.IAPProduct">IAPProduct</a></h1>
<p>IAP商品对象</p>
<pre class="prettyprint linenums">
interface plus.payment.IAPProduct {
    attribute String productid;
    attribute String price;
    attribute String title;
    attribute String description;
}
                </pre>
<h2>说明:</h2>
<p class="des">
    描述IAP商品详细信息,如标识、价格、标题、描述信息等。
                </p>
<h2>属性:</h2>
<ul>
<li>productid: <em>(<font class="type">String</font>
    类型
)</em>商品的标识<br>
</li>
<li>price: <em>(<font class="type">String</font>
    类型
)</em>商品的价格<br>
</li>
<li>title: <em>(<font class="type">String</font>
    类型
)</em>商品标题<br>
</li>
<li>description: <em>(<font class="type">String</font>
    类型
)</em>商品的描述信息<br>
</li>
</ul>
<h1><a name="plus.payment.IAPProductInfo">IAPProductInfo</a></h1>
<p>购买IAP商品对象</p>
<pre class="prettyprint linenums">
interface plus.payment.IAPProductInfo {
    attribute String productIdentifier;
    attribute String quantity;
}
                </pre>
<h2>说明:</h2>
<p class="des">
    描述购买的IAP商品详细信息,如标识、数量等。
                </p>
<h2>属性:</h2>
<ul>
<li>productIdentifier: <em>(<font class="type">String</font>
    类型
)</em>商品的标识<br>
</li>
<li>quantity: <em>(<font class="type">String</font>
    类型
)</em>商品的数量<br>
</li>
</ul>
<h1><a name="plus.payment.IAPTransaction">IAPTransaction</a></h1>
<p>购买IAP商品交易信息对象</p>
<pre class="prettyprint linenums">
interface plus.payment.IAPTransaction {
    attribute IAPProductInfo payment;
    attribute String transactionDate;
    attribute String transactionIdentifier;
    attribute String transactionReceipt;
    attribute String transactionState;
}
                </pre>
<h2>说明:</h2>
<p class="des">
    描述购买的IAP商品交易详细信息,如购买商品信息、交易日期、订单标识等。
                </p>
<h2>属性:</h2>
<ul>
<li>payment: <em>(<font class="type">String</font>
    类型
)</em>购买商品的信息<br>
</li>
<li>transactionDate: <em>(<font class="type">String</font>
    类型
)</em>购买商品的交易日期<br>
</li>
<li>transactionIdentifier: <em>(<font class="type">String</font>
    类型
)</em>购买商品的交易订单标识<br>
</li>
<li>transactionReceipt: <em>(<font class="type">String</font>
    类型
)</em>购买商品的交易收据<br><p>
    base64编码格式字符串数据。
                        </p>
</li>
<li>transactionState: <em>(<font class="type">String</font>
    类型
)</em>购买商品的交易状态<br><p>
    可取值:"1"为支付成功;"2"为支付失败;"3"为支付已恢复。
                        </p>
</li>
</ul>
<h1><a name="plus.payment.ChannelsSuccessCallback">ChannelsSuccessCallback</a></h1>
<p>获取支付通道成功回调</p>
<pre class="prettyprint linenums">
void ChannelsSuccessCallback( channels ) {
    // Get payment channels success code
}
                </pre>
<h2>说明:</h2>
<p class="des">
    当获取支付通道列表成功时的回调函数,用于返回终端支持的支付通道列表。
                </p>
<h2>参数:</h2>
<ul><li>channels: 
        <em>(
            <font class="type">Array</font>
            )
            必选 </em>数组,系统支持的支付通道PaymentChannel列表<br>
</li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.payment.IapRequestOrderSuccessCallback">IapRequestOrderSuccessCallback</a></h1>
<p>请求支付商品列表回调方法</p>
<pre class="prettyprint linenums">
void onsuccess( results ) {
    // Payment success code
}
                </pre>
<h2>说明:</h2>
<p class="des">
    获取IAP商品列表信息成功时的回调函数,返回商品详细信息。
                </p>
<h2>参数:</h2>
<ul><li>results: 
        <em>(
            <font class="type">Array</font>[
                        <a href="#plus.payment.IAPProduct">IAPProduct</a>
                        ]
                    
            )
            必选 </em>商品信息数据<br>
</li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.payment.IapRestoreComplateRequestCallback">IapRestoreComplateRequestCallback</a></h1>
<p>请求已经购买的非消耗性商品和订阅商品回调方法</p>
<pre class="prettyprint linenums">
void onsuccess( results ) {
    // Payment success code
}
                </pre>
<h2>说明:</h2>
<p class="des">
    获取IAP商品列表信息成功时的回调函数,返回商品详细信息。
                </p>
<h2>参数:</h2>
<ul><li>results: 
        <em>(
            <font class="type">Array</font>[
                        <a href="#plus.payment.IAPTransaction">IAPTransaction</a>
                        ]
                    
            )
            必选 </em>已购买的非消耗性商品和订阅商品交易信息<br>
</li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.payment.PaymentSuccessCallback">PaymentSuccessCallback</a></h1>
<p>支付操作成功回调</p>
<pre class="prettyprint linenums">
void PaymentSuccessCallback ( result ) {
    // Payment success code
}
                </pre>
<h2>说明:</h2>
<p class="des">
    当支付操作成功时的回调函数,用于返回支付操作的成功信息。
                </p>
<h2>参数:</h2>
<ul><li>result : 
        <em>(
            <a href="#plus.payment.PaymentResult">PaymentResult</a>
    |
    <a href="#plus.payment.IAPTransaction">IAPTransaction</a>
            )
            必选 </em>支付操作成功的信息<br>
    iOS平台使用IAP支付返回的数据类型为IAPTransaction。
                        </li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<h1><a name="plus.payment.PaymentErrorCallback">PaymentErrorCallback</a></h1>
<p>支付操作失败回调</p>
<pre class="prettyprint linenums">
void PaymentErrorCallback(error){
    // Payment error code
}
                </pre>
<h2>说明:</h2>
<p class="des">当支付操作失败时的回调函数,用于返回支付操作失败的错误信息。</p>
<h2>参数:</h2>
<ul><li>error: 
        <em>(
            <font class="type">DOMException</font>
            )
            必选 </em>支付操作失败错误信息,可通过error.code获取错误代码,具体错误码有各支付通道定义<br>
    支付宝支付错误代码如下:
    62000,客户端未安装支付通道依赖的服务;
    62001,用户取消支付操作;
    62002,此设备不支持支付;
    62003,数据格式错误;
    62004,支付账号状态错误;
    62005,订单信息错误;
    62006,支付操作内部错误;
    62007,支付服务器错误;
    62008,网络问题引起的错误;
    62009,其它未定义的错误。
    微信支付错误代码如下:
    -1,一般错误;
    -2,用户取消;
    -3,发送失败;
    -4,认证被否决;
    -5,不支持错误。
                        </li></ul>
<h2>返回值:</h2>
<font class="type">void</font>
            : 无<br><br>
</div></body>
</html>