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
// Copyright (c) 2022 Labrador contributors
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notice may not be copied,
// modified, or distributed except according to those terms.
//! This create offers:
//!
//! * A convenient mainstream third-party service client
//! * Convenient and quick use of corresponding services in rust
//!
//! Features:
//!
//! * ```taobao``` - Taobao customer related services
//! * ```alipay``` - Alipay related services
//! * ```pdd``` - Pinduoduo related services
//! * ```jd``` - Jingdong related services
//! * ```wechat``` - Wechat related services
//!
//! ## Installation
//!
//! Put the desired version of the crate into the `dependencies` section of your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! labrador = "0.1.0"
//! ```
//!
//!
//!
//! ## Example
//!
//! ### With Wechat(微信开放平台、包含微信支付)
//!
//! ```rust
//! use labrador::{WechatPayClient, SimpleStorage, TradeType, WechatPayRequestV3, Amount, Payer};
//! use chrono::{Local, SecondsFormat};
//!
//! #[tokio::main]
//! async fn main() {
//! let c = WechatPayClient::new("appid", "secret");
//! let mut client =c.wxpay();
//! let date = Local::now().to_rfc3339_opts(SecondsFormat::Secs, false);
//! let result = client.unified_order_v3(TradeType::Jsapi, WechatPayRequestV3 {
//! appid: "appid".to_string().into(),
//! mch_id: "mchid".to_string(),
//! description: "测试商品支付".to_string(),
//! out_trade_no: "1602920235sdfsdfas32234234".to_string(),
//! time_expire: date,
//! attach: None,
//! notify_url: "https:xxx.cn/trade/notify".to_string(),
//! amount: Amount {
//! total: 1,
//! currency: String::from("CNY").into(),
//! payer_total: None,
//! payer_currency: None
//! },
//! payer: Payer {
//! openid: "oUVZc6S_uGx3bsNPUA-davo4Dt7Us".to_string()
//! }.into(),
//! detail: None,
//! scene_info: None,
//! settle_info: None
//! });
//! match result.await {
//! Ok(res) => {}
//! Err(err) => {}
//! }
//! }
//! ```
//!
//! ### With Alipay(支付宝)
//!
//! ```rust
//! use labrador::{AlipayTradeWapPayRequest, AlipayClient};
//!
//! #[tokio::main]
//! async fn main() {
//! let param = AlipayTradeWapPayRequest::default();
//! let client = AlipayClient::new("appKey", false);
//! match client.wap_pay("POST".into(), param).await {
//! Ok(res) => {}
//! Err(err) => {}
//! }
//! match result.await {
//! Ok(res) => {}
//! Err(err) => {}
//! }
//! }
//! ```
//!
//! ### With Taobao(淘宝客相关)
//!
//! ```rust
//! use labrador::{TbItemDetailRequest, TaobaoClient, SimpleStorage};
//!
//! #[tokio::main]
//! async fn main() {
//! let client = TaobaoClient::<SimpleStorage>::new("appkey", "secret");
//! let req = TbItemDetailRequest {
//! num_iids: Some("597649283190".to_string()),
//! platform: None,
//! ip: None
//! };
//! let result = client.get_item_detail(req);
//! match result.await {
//! Ok(res) => {
//! }
//! Err(err) => {
//! }
//! }
//! }
//! ```
//!
//!
//! ### With JD(京东,目前暂时只支持联盟相关)
//!
//! ```rust
//! use labrador::{JDClient, JdOrderRawQueryParam, SimpleStorage};
//! use chrono::{Local, SecondsFormat};
//!
//! #[tokio::main]
//! async fn main() {
//! let client = JDClient::<SimpleStorage>::new("appkey", "secert");
//! let param = JdOrderRawQueryParam {
//! page_index: 1.into(),
//! page_size: 10.into(),
//! bill_type: 1,
//! start_time: "2022-08-02 21:23:00".to_string(),
//! end_time: "2022-08-02 21:43:00".to_string(),
//! child_union_id: None,
//! key: None,
//! fields: None
//! };
//! let result = client.query_raw_order(param);
//! match result.await {
//! Ok(res) => {
//! }
//! Err(err) => {
//! }
//! }
//! }
//! ```
//!
//! ### With Custom Request
//!
//! You can implement this trait and then use the custom request
//!
//! + AlipayRequest - For Alipay(支付宝)
//! + JDRequest - For jingdong(京东)
//! + TaobaoRequest - For taobao(淘宝)
//!
//!
//! ## Feature
//!
//! We will gradually improve the corresponding API
//!
//!
pub use *;
pub use *;
pub use *;
pub use *;
pub type LabradorResult<T, E = LabraError> = ;
pub use *;
pub use LabraError;
pub use *;
pub use *;
pub use APIClient;
pub use *;
pub use ;
pub use bytes;
pub use serde_urlencoded;
pub use urlencoding;
pub use dashmap;
pub use redis;