Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="fib-python-payment-sdk",
version='0.1.10',
version='0.2.0',
description="SDK for integrating with the FIB payment system, enabling user authentication and payment "
"transactions.",
long_description=long_description,
Expand Down
6 changes: 4 additions & 2 deletions src/fib_payments/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ async def _request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]
return response.json()

async def create_payment(self, amount: float, currency: Optional[str] = None,
callback_url: Optional[str] = None,
description: Optional[str] = None) -> Dict[str, Any]:
callback_url: Optional[str] = None,
description: Optional[str] = None,
redirect_uri: Optional[str] = None) -> Dict[str, Any]:
"""Create a new payment."""
data = {
'monetaryValue': {'amount': amount, 'currency': currency or self.config.currency},
'statusCallbackUrl': callback_url or self.config.callback_url,
'redirectUri': redirect_uri or '',
'description': description or '',
'refundableFor': self.config.refundable_for,
}
Expand Down
3 changes: 2 additions & 1 deletion tests/test_fib_payments_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def test_request_failure(client, mock_http_client):
async def test_create_payment(client):
client._request = AsyncMock(return_value={'id': 'payment_id'})

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

assert result == {'id': 'payment_id'}
client._request.assert_called_once_with(
Expand All @@ -89,6 +89,7 @@ async def test_create_payment(client):
json={
'monetaryValue': {'amount': 100.0, 'currency': 'EUR'},
'statusCallbackUrl': 'https://custom-callback.com',
'redirectUri': 'https://custom-redirect-uri.com',
'description': 'Test payment',
'refundableFor': client.config.refundable_for,
}
Expand Down