1mod manage;
8mod models;
9mod notify;
10mod order;
11mod shipping;
12
13pub use manage::{
14 is_trade_managed, is_trade_management_confirmation_completed, op_special_order,
15 IsTradeManagedResponse, IsTradeManagementConfirmationCompletedResponse, OpSpecialOrderRequest,
16 SpecialOrderType,
17};
18pub use models::{
19 now_upload_time, Contact, DeliveryMode, LogisticsType, Order, OrderKey, OrderNumberType,
20 OrderState, Payer, ShippingInfo, ShippingItem, ShippingListItemView,
21};
22pub use notify::{
23 notify_confirm_receive, set_msg_jump_path, NotifyConfirmReceiveRequest, SetMsgJumpPathRequest,
24};
25pub use order::{
26 get_order, get_order_list, GetOrderListRequest, GetOrderListResponse, GetOrderRequest,
27 GetOrderResponse, PayTimeRange,
28};
29pub use shipping::{
30 upload_combined_shipping_info, upload_shipping_info, CombinedSubOrder,
31 UploadCombinedShippingInfoRequest, UploadShippingInfoRequest,
32};
33
34use wechat_mp_core::MpClient;
35
36#[derive(Clone)]
38pub struct TradeApi {
39 client: MpClient,
40}
41
42impl TradeApi {
43 pub fn new(client: MpClient) -> Self {
45 Self { client }
46 }
47
48 pub fn client(&self) -> &MpClient {
50 &self.client
51 }
52
53 pub async fn upload_shipping_info(
55 &self,
56 req: &UploadShippingInfoRequest,
57 ) -> wechat_mp_core::Result<()> {
58 upload_shipping_info(&self.client, req).await
59 }
60
61 pub async fn upload_combined_shipping_info(
63 &self,
64 req: &UploadCombinedShippingInfoRequest,
65 ) -> wechat_mp_core::Result<()> {
66 upload_combined_shipping_info(&self.client, req).await
67 }
68
69 pub async fn get_order(
71 &self,
72 req: &GetOrderRequest,
73 ) -> wechat_mp_core::Result<GetOrderResponse> {
74 get_order(&self.client, req).await
75 }
76
77 pub async fn get_order_list(
79 &self,
80 req: &GetOrderListRequest,
81 ) -> wechat_mp_core::Result<GetOrderListResponse> {
82 get_order_list(&self.client, req).await
83 }
84
85 pub async fn notify_confirm_receive(
87 &self,
88 req: &NotifyConfirmReceiveRequest,
89 ) -> wechat_mp_core::Result<()> {
90 notify_confirm_receive(&self.client, req).await
91 }
92
93 pub async fn set_msg_jump_path(&self, path: &str) -> wechat_mp_core::Result<()> {
95 set_msg_jump_path(&self.client, path).await
96 }
97
98 pub async fn is_trade_managed(&self, appid: &str) -> wechat_mp_core::Result<bool> {
100 is_trade_managed(&self.client, appid).await
101 }
102
103 pub async fn is_trade_management_confirmation_completed(
105 &self,
106 appid: &str,
107 ) -> wechat_mp_core::Result<bool> {
108 is_trade_management_confirmation_completed(&self.client, appid).await
109 }
110
111 pub async fn op_special_order(
113 &self,
114 req: &OpSpecialOrderRequest,
115 ) -> wechat_mp_core::Result<()> {
116 op_special_order(&self.client, req).await
117 }
118}