Skip to content

Commit 3bdea7b

Browse files
Merge pull request #5 from First-Iraqi-Bank/FIBAS-1460-add-redirect-uri-for-python-package
FIBAS-1460-add-redirect-uri-for-python-package
2 parents b8c5d04 + 47b0596 commit 3bdea7b

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

setup.py

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

1010
setup(
1111
name="fib-python-payment-sdk",
12-
version='0.1.10',
12+
version='0.2.0',
1313
description="SDK for integrating with the FIB payment system, enabling user authentication and payment "
1414
"transactions.",
1515
long_description=long_description,

src/fib_payments/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ async def _request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]
5050
return response.json()
5151

5252
async def create_payment(self, amount: float, currency: Optional[str] = None,
53-
callback_url: Optional[str] = None,
54-
description: Optional[str] = None) -> Dict[str, Any]:
53+
callback_url: Optional[str] = None,
54+
description: Optional[str] = None,
55+
redirect_uri: Optional[str] = None) -> Dict[str, Any]:
5556
"""Create a new payment."""
5657
data = {
5758
'monetaryValue': {'amount': amount, 'currency': currency or self.config.currency},
5859
'statusCallbackUrl': callback_url or self.config.callback_url,
60+
'redirectUri': redirect_uri or '',
5961
'description': description or '',
6062
'refundableFor': self.config.refundable_for,
6163
}

tests/test_fib_payments_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def test_request_failure(client, mock_http_client):
8080
async def test_create_payment(client):
8181
client._request = AsyncMock(return_value={'id': 'payment_id'})
8282

83-
result = await client.create_payment(100.0, 'EUR', 'https://custom-callback.com', 'Test payment')
83+
result = await client.create_payment(100.0, 'EUR', 'https://custom-callback.com', 'Test payment', 'https://custom-redirect-uri.com')
8484

8585
assert result == {'id': 'payment_id'}
8686
client._request.assert_called_once_with(
@@ -89,6 +89,7 @@ async def test_create_payment(client):
8989
json={
9090
'monetaryValue': {'amount': 100.0, 'currency': 'EUR'},
9191
'statusCallbackUrl': 'https://custom-callback.com',
92+
'redirectUri': 'https://custom-redirect-uri.com',
9293
'description': 'Test payment',
9394
'refundableFor': client.config.refundable_for,
9495
}

0 commit comments

Comments
 (0)