Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 41.67% |
1 | # -*- coding: utf-8 -*- |
||
7 | 10 | class MerchantOrder(BaseWeChatAPI): |
|
8 | |||
9 | 10 | def get(self, order_id): |
|
10 | res = self._post( |
||
11 | 'merchant/order/getbyid', |
||
12 | data={ |
||
13 | 'order_id': order_id |
||
14 | }, |
||
15 | result_processor=lambda x: x['order'] |
||
16 | ) |
||
17 | return res |
||
18 | |||
19 | 10 | def get_by_filter(self, status=None, begin_time=None, end_time=None): |
|
20 | filter_dict = optionaldict( |
||
21 | status=status, |
||
22 | begintime=begin_time, |
||
23 | endtime=end_time |
||
24 | ) |
||
25 | |||
26 | res = self._post( |
||
27 | 'merchant/order/getbyfilter', |
||
28 | data=dict(filter_dict), |
||
29 | result_processor=lambda x: x['order_list'] |
||
30 | ) |
||
31 | return res |
||
32 | |||
33 | 10 | def set_delivery(self, order_id, company, track_no, |
|
34 | need_delivery=1, is_others=0): |
||
35 | return self._post( |
||
36 | 'merchant/order/setdelivery', |
||
37 | data={ |
||
38 | 'order_id': order_id, |
||
39 | 'delivery_company': company, |
||
40 | 'delivery_track_no': track_no, |
||
41 | 'need_delivery': need_delivery, |
||
42 | 'is_others': is_others |
||
43 | } |
||
44 | ) |
||
45 | |||
46 | 10 | def close(self, order_id): |
|
47 | return self._post( |
||
48 | 'merchant/order/close', |
||
49 | data={ |
||
50 | 'order_id': order_id |
||
51 | } |
||
53 |