Skip to content

Commit 0355d5e

Browse files
committed
Merge branch 'release/v1.0.0rc3'
2 parents d060060 + 84fc16e commit 0355d5e

9 files changed

Lines changed: 27 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PyPI version](<https://img.shields.io/pypi/v/payos.svg?label=pypi%20(stable)>)](https://pypi.org/project/payos/)
44

5-
The payOS Python library provides convenient access to the payOS Merchant API from applications written in Python. The library includes type definitions for all request params and response fields, and offers both synchronous ans asynchronous clients powered by [httpx](https://github.com/encode/httpx)
5+
The payOS Python library provides convenient access to the payOS Merchant API from applications written in Python. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
66

77
To learn how to use payOS Merchant API, checkout our [API Reference](https://payos.vn/docs/api) and [Documentation](https://payos.vn/docs). We also have some examples in [Examples](./examples/).
88

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "payos"
3-
version = "1.0.0rc2"
3+
version = "1.0.0rc3"
44
description = "payOS Python SDK"
55
readme = "README.md"
66
requires-python = ">=3.9"

src/payos/_async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def _verify_response_signature(
358358
else:
359359
raise InvalidSignatureError("Invalid signature response type")
360360

361-
if response_signature != expected_signature:
361+
if not expected_signature or response_signature != expected_signature:
362362
raise InvalidSignatureError("Response signature verification failed")
363363

364364
async def request(

src/payos/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def _verify_response_signature(
353353
else:
354354
raise InvalidSignatureError("Invalid signature response type")
355355

356-
if response_signature != expected_signature:
356+
if not expected_signature or response_signature != expected_signature:
357357
raise InvalidSignatureError("Response signature verification failed")
358358

359359
def request(

src/payos/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Do not update manually, this will be generate when building
2-
__version__ = "1.0.0rc2"
2+
__version__ = "1.0.0rc3"

src/payos/resources/v1/payouts/batch/batch.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Batch payout resource for payOS API v1."""
22

3-
import uuid
43
from typing import Any, Optional
54

65
from .....types.v1 import Payout, PayoutBatchRequest
@@ -22,7 +21,7 @@ def create(
2221
Create a batch payout.
2322
"""
2423
if idempotency_key is None:
25-
idempotency_key = str(uuid.uuid4())
24+
idempotency_key = self._client.crypto.create_uuid4()
2625

2726
headers_with_idempotency = {
2827
"x-idempotency-key": idempotency_key,
@@ -56,7 +55,7 @@ async def create(
5655
Create a batch payout.
5756
"""
5857
if idempotency_key is None:
59-
idempotency_key = str(uuid.uuid4())
58+
idempotency_key = self._client.crypto.create_uuid4()
6059

6160
headers_with_idempotency = {
6261
"x-idempotency-key": idempotency_key,

src/payos/resources/v1/payouts/payouts.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ def create(
2424
self,
2525
payout_data: PayoutRequest,
2626
*,
27+
idempotency_key: Optional[str] = None,
2728
extra_headers: Optional[dict[str, str]] = None,
2829
**kwargs: Any,
2930
) -> Payout:
3031
"""Create a new payout."""
32+
if idempotency_key is None:
33+
idempotency_key = self._client.crypto.create_uuid4()
34+
35+
headers_with_idempotency = {
36+
"x-idempotency-key": idempotency_key,
37+
**(extra_headers or {}),
38+
}
3139
response = self._client.post(
3240
"/v1/payouts",
3341
body=payout_data,
34-
headers=extra_headers,
42+
headers=headers_with_idempotency,
3543
cast_to=Payout,
3644
signature_request="header",
3745
signature_response="header",
@@ -112,14 +120,22 @@ async def create(
112120
self,
113121
payout_data: PayoutRequest,
114122
*,
123+
idempotency_key: Optional[str] = None,
115124
extra_headers: Optional[dict[str, str]] = None,
116125
**kwargs: Any,
117126
) -> Payout:
118127
"""Create a new payout."""
128+
if idempotency_key is None:
129+
idempotency_key = self._client.crypto.create_uuid4()
130+
131+
headers_with_idempotency = {
132+
"x-idempotency-key": idempotency_key,
133+
**(extra_headers or {}),
134+
}
119135
response = await self._client.post(
120136
"/v1/payouts",
121137
body=payout_data,
122-
headers=extra_headers,
138+
headers=headers_with_idempotency,
123139
cast_to=Payout,
124140
signature_request="header",
125141
signature_response="header",

src/payos/resources/webhooks/webhooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
from ..._core.exceptions import PayOSError, WebhookError
88
from ...types.webhooks import (
9-
ConfirmWebhookResponse,
109
ConfirmWebhookRequest,
10+
ConfirmWebhookResponse,
1111
Webhook,
1212
WebhookData,
1313
)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)