pixelarraythirdparty 1.0.2__tar.gz → 1.0.3__tar.gz

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.
Files changed (22) hide show
  1. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/PKG-INFO +1 -1
  2. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/__init__.py +1 -1
  3. pixelarraythirdparty-1.0.3/pixelarraythirdparty/order/order.py +110 -0
  4. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty.egg-info/PKG-INFO +1 -1
  5. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty.egg-info/SOURCES.txt +0 -1
  6. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pyproject.toml +1 -1
  7. pixelarraythirdparty-1.0.2/pixelarraythirdparty/order/order.py +0 -92
  8. pixelarraythirdparty-1.0.2/pixelarraythirdparty/order/pay.py +0 -44
  9. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/LICENSE +0 -0
  10. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/MANIFEST.in +0 -0
  11. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/celery/__init__.py +0 -0
  12. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/celery/celery.py +0 -0
  13. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/client.py +0 -0
  14. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/order/__init__.py +0 -0
  15. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/product/__init__.py +0 -0
  16. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/product/product.py +0 -0
  17. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/user/__init__.py +0 -0
  18. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty/user/user.py +0 -0
  19. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty.egg-info/dependency_links.txt +0 -0
  20. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty.egg-info/requires.txt +0 -0
  21. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/pixelarraythirdparty.egg-info/top_level.txt +0 -0
  22. {pixelarraythirdparty-1.0.2 → pixelarraythirdparty-1.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ PixelArray 第三方微服务客户端
10
10
  - user: 用户管理模块
11
11
  """
12
12
 
13
- __version__ = "1.0.2"
13
+ __version__ = "1.0.3"
14
14
  __author__ = "Lu qi"
15
15
  __email__ = "qi.lu@pixelarrayai.com"
16
16
 
@@ -0,0 +1,110 @@
1
+ from pixelarraythirdparty.client import Client
2
+
3
+
4
+ class OrderManager(Client):
5
+ def create_order(
6
+ self,
7
+ product_id: str,
8
+ body: str = None,
9
+ remark: str = None,
10
+ payment_channel: str = "WECHAT",
11
+ ):
12
+ data = {
13
+ "product_id": product_id,
14
+ "body": body,
15
+ "remark": remark,
16
+ "payment_channel": payment_channel,
17
+ }
18
+ data, success = self._request("POST", "/api/orders/create", json=data)
19
+ if not success:
20
+ return {}, False
21
+ return data, True
22
+
23
+ def list_order(
24
+ self,
25
+ page: int = 1,
26
+ page_size: int = 10,
27
+ payment_status: str = None,
28
+ out_trade_no: str = None,
29
+ ):
30
+ params = {
31
+ "page": page,
32
+ "page_size": page_size,
33
+ "payment_status": payment_status,
34
+ "out_trade_no": out_trade_no,
35
+ }
36
+ data, success = self._request("GET", "/api/orders/list", params=params)
37
+ if not success:
38
+ return {}, False
39
+ return data, True
40
+
41
+ def get_order_detail(self, out_trade_no: str):
42
+ data, success = self._request("GET", f"/api/orders/{out_trade_no}")
43
+ if not success:
44
+ return {}, False
45
+ return data, True
46
+
47
+ def update_order_status(
48
+ self,
49
+ out_trade_no: str,
50
+ payment_status: str,
51
+ ):
52
+ data = {
53
+ "payment_status": payment_status,
54
+ }
55
+ data, success = self._request(
56
+ "PUT", f"/api/orders/{out_trade_no}/status", json=data
57
+ )
58
+ if not success:
59
+ return {}, False
60
+ return data, True
61
+
62
+ def delete_order(self, out_trade_no: str):
63
+ data, success = self._request("DELETE", f"/api/orders/{out_trade_no}")
64
+ if not success:
65
+ return {}, False
66
+ return data, True
67
+
68
+ def get_order_stats(self):
69
+ data, success = self._request("GET", "/api/orders/stats/summary")
70
+ if not success:
71
+ return {}, False
72
+ return data, True
73
+
74
+ def generate_qr_code(
75
+ self,
76
+ out_trade_no: str,
77
+ payment_channel: str = "WECHAT",
78
+ ):
79
+ if payment_channel == "WECHAT":
80
+ url = "/api/orders/wx_pay/generate_qr_code"
81
+ elif payment_channel == "ALIPAY":
82
+ url = "/api/orders/ali_pay/generate_qr_code"
83
+ else:
84
+ raise ValueError("Invalid payment channel")
85
+ data, success = self._request(
86
+ "POST",
87
+ url,
88
+ json={
89
+ "out_trade_no": out_trade_no,
90
+ },
91
+ )
92
+ if not success:
93
+ return {}, False
94
+ return data, True
95
+
96
+ def refund_order(self, out_trade_no: str, payment_channel: str = "WECHAT"):
97
+ if payment_channel == "WECHAT":
98
+ url = "/api/orders/wx_pay/refund"
99
+ elif payment_channel == "ALIPAY":
100
+ url = "/api/orders/ali_pay/refund"
101
+ else:
102
+ raise ValueError("Invalid payment channel")
103
+ data, success = self._request(
104
+ "POST",
105
+ url,
106
+ json={"out_trade_no": out_trade_no},
107
+ )
108
+ if not success:
109
+ return {}, False
110
+ return data, True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -12,7 +12,6 @@ pixelarraythirdparty/celery/__init__.py
12
12
  pixelarraythirdparty/celery/celery.py
13
13
  pixelarraythirdparty/order/__init__.py
14
14
  pixelarraythirdparty/order/order.py
15
- pixelarraythirdparty/order/pay.py
16
15
  pixelarraythirdparty/product/__init__.py
17
16
  pixelarraythirdparty/product/product.py
18
17
  pixelarraythirdparty/user/__init__.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pixelarraythirdparty"
7
- version = "1.0.2"
7
+ version = "1.0.3"
8
8
  authors = [
9
9
  {name = "Lu qi", email = "qi.lu@pixelarrayai.com"},
10
10
  ]
@@ -1,92 +0,0 @@
1
- from pixelarraythirdparty.client import Client
2
-
3
-
4
- class OrderManager(Client):
5
- def create_order(
6
- self,
7
- product_name: str,
8
- product_id: str,
9
- amount: float,
10
- body: str,
11
- remark: str,
12
- payment_channel: str,
13
- ):
14
- data = {
15
- "product_name": product_name,
16
- "product_id": product_id,
17
- "amount": amount,
18
- "body": body,
19
- "remark": remark,
20
- "payment_channel": payment_channel,
21
- }
22
- data, success = self._request("POST", "/api/orders/create", json=data)
23
- if not success:
24
- return {}, False
25
- return data, True
26
-
27
- def list_order(
28
- self,
29
- page: int = 1,
30
- page_size: int = 10,
31
- payment_status: str = None,
32
- order_no: str = None,
33
- ):
34
- params = {
35
- "page": page,
36
- "page_size": page_size,
37
- "payment_status": payment_status,
38
- "order_no": order_no,
39
- }
40
- data, success = self._request("GET", "/api/orders/list", params=params)
41
- if not success:
42
- return {}, False
43
- return data, True
44
-
45
- def get_order_detail(self, order_no: str):
46
- data, success = self._request("GET", f"/api/orders/{order_no}")
47
- if not success:
48
- return {}, False
49
- return data, True
50
-
51
- def update_order(
52
- self,
53
- order_no: str,
54
- payment_status: str,
55
- wx_order_no: str,
56
- transaction_id: str,
57
- openid: str,
58
- trade_type: str,
59
- bank_type: str,
60
- fee_type: str,
61
- is_subscribe: str,
62
- time_end: str,
63
- remark: str,
64
- ):
65
- data = {
66
- "payment_status": payment_status,
67
- "wx_order_no": wx_order_no,
68
- "transaction_id": transaction_id,
69
- "openid": openid,
70
- "trade_type": trade_type,
71
- "bank_type": bank_type,
72
- "fee_type": fee_type,
73
- "is_subscribe": is_subscribe,
74
- "time_end": time_end,
75
- "remark": remark,
76
- }
77
- data, success = self._request("PUT", f"/api/orders/{order_no}", json=data)
78
- if not success:
79
- return {}, False
80
- return data, True
81
-
82
- def delete_order(self, order_no: str):
83
- data, success = self._request("DELETE", f"/api/orders/{order_no}")
84
- if not success:
85
- return {}, False
86
- return data, True
87
-
88
- def get_order_stats(self):
89
- data, success = self._request("GET", "/api/orders/stats/summary")
90
- if not success:
91
- return {}, False
92
- return data, True
@@ -1,44 +0,0 @@
1
- from pixelarraythirdparty.client import Client
2
-
3
-
4
- class WeChatPayManager(Client):
5
- def generate_qr_code(
6
- self,
7
- out_trade_no: str,
8
- total_fee: int,
9
- body: str,
10
- product_name: str,
11
- product_id: str,
12
- ):
13
- data, success = self._request(
14
- "POST",
15
- "/api/wx_pay/generate_qr_code",
16
- json={
17
- "out_trade_no": out_trade_no,
18
- "total_fee": total_fee,
19
- "body": body,
20
- "product_name": product_name,
21
- "product_id": product_id,
22
- },
23
- )
24
- if not success:
25
- return {}, False
26
- return data, True
27
-
28
- def query_order(self, out_trade_no: str):
29
- data, success = self._request(
30
- "POST", "/api/wx_pay/query_order", json={"out_trade_no": out_trade_no}
31
- )
32
- if not success:
33
- return {}, False
34
- return data, True
35
-
36
- def refund(self, out_trade_no: str, total_fee: int):
37
- data, success = self._request(
38
- "POST",
39
- "/api/wx_pay/refund",
40
- json={"out_trade_no": out_trade_no, "total_fee": total_fee},
41
- )
42
- if not success:
43
- return {}, False
44
- return data, True