Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9ea97c7
feat: phase 1 foundations — tests + sdk hooks at 100% cov
vildanbina Apr 14, 2026
ec833f9
feat: phase 2 — http strategies + mockbuckaroo harness at 100% cov
vildanbina Apr 15, 2026
ab0a5d9
feat: phase 3 — http client + observers at 100% cov
vildanbina Apr 15, 2026
1d6b7cb
feat: phase 4 — builder bases + capability mixins at 100% cov
vildanbina Apr 15, 2026
1c3df22
feat: phase 6 — factories at 100% cov
vildanbina Apr 15, 2026
4a319e5
feat: phase 5 — services + parameter validator at 100% cov
vildanbina Apr 15, 2026
66785ec
feat: phase 7 — concrete builders at 100% cov
vildanbina Apr 16, 2026
29d9bca
feat: phase 8 — entry points at 100% cov
vildanbina Apr 16, 2026
5cefca7
feat: phase 9 — feature tests per payment method at 100% cov
vildanbina Apr 16, 2026
c1ab5a2
fix: resolve 30 confirmed test suite audit findings
vildanbina Apr 16, 2026
30aef13
fix: resolve 3 source bugs behind 5 xfail tests
vildanbina Apr 16, 2026
9f5c65f
feat: implement CI workflow and enhance test helpers for improved cov…
vildanbina Apr 20, 2026
601070d
refactor: payment builder tests to utilize populate_required_fields f…
vildanbina Apr 20, 2026
1074a87
refactor: payment tests to use standard payload helper
vildanbina Apr 20, 2026
e339e21
refactor: payment tests to use assert_pay_returns_pending_with_redire…
vildanbina Apr 20, 2026
8cdbda0
refactor: streamline payment tests to utilize new helper methods for …
vildanbina Apr 20, 2026
2fffc64
refactor: payment builder tests to remove capability mixin assertions
vildanbina Apr 20, 2026
62da461
refactor: update mock strategy fixture and improve error message form…
vildanbina Apr 20, 2026
67a6b6f
refactor: enhance recording mock utilities and add wire-level asserti…
vildanbina Apr 20, 2026
d6de9db
refactor: streamline payment request handling and update test cases f…
vildanbina Apr 20, 2026
81a6ae8
refactor: polish test helpers, tighten sdk correctness, enforce lint
vildanbina Apr 21, 2026
6fec559
refactor: remove outdated test suite audit report
vildanbina Apr 21, 2026
7a7b7dd
refactor: update Python version compatibility in CI, setup, and confi…
vildanbina Apr 21, 2026
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Normalize line endings to LF on checkout + commit regardless of host platform.
* text=auto eol=lf
*.py text eol=lf
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
pull_request:
push:
branches: [master, develop]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: pip
- run: pip install ruff
- run: ruff check .
- run: ruff format --check .

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: pip install -r requirements-dev.txt
- run: pytest --cov=buckaroo --cov-report=term-missing
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /app

# Copy requirements and install Python packages
COPY requirements.txt .
COPY requirements.txt requirements-dev.txt ./

RUN pip install --root-user-action=ignore -r requirements.txt
RUN pip install --root-user-action=ignore -r requirements-dev.txt

CMD ["tail", "-f", "/dev/null"]
62 changes: 29 additions & 33 deletions buckaroo/_buckaroo_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

from typing import Optional, Union
from typing import Optional
from .exceptions._authentication_error import AuthenticationError
from .config.buckaroo_config import BuckarooConfig, create_config_from_mode
from .http.client import BuckarooHttpClient
Expand All @@ -8,10 +7,10 @@
class BuckarooClient(object):
"""
Buckaroo Payment Gateway Client.

This is the main client class for interacting with the Buckaroo payment gateway.
It provides access to payment services and manages authentication and configuration.

Args:
store_key (str): Your Buckaroo store key.
secret_key (str): Your Buckaroo secret key.
Expand All @@ -21,34 +20,34 @@ class BuckarooClient(object):
a default configuration will be created based on the mode parameter.
http_strategy (str, optional): HTTP strategy to use ('requests' or 'curl').
If not provided, will auto-select the best available strategy.

Example:
Basic usage with mode:
>>> client = BuckarooClient("store_key", "secret_key", mode="test")

Advanced usage with configuration:
>>> from buckaroo.config.buckaroo_config import BuckarooConfig, Environment
>>> config = BuckarooConfig(environment=Environment.LIVE, timeout=60)
>>> client = BuckarooClient("store_key", "secret_key", config=config)

Usage with specific HTTP strategy:
>>> client = BuckarooClient("store_key", "secret_key", http_strategy="curl")
"""

def __init__(
self,
store_key: str,
secret_key: str,
self,
store_key: str,
secret_key: str,
mode: str = "test",
config: Optional[BuckarooConfig] = None,
http_strategy: Optional[str] = None
http_strategy: Optional[str] = None,
) -> None:
"""
Initialize the Buckaroo Client class.

Args:
store_key (str): Your Buckaroo store key
secret_key (str): Your Buckaroo secret key
secret_key (str): Your Buckaroo secret key
mode (str): Environment mode ('test' or 'live'). Deprecated, use config instead
config (BuckarooConfig, optional): Configuration object
http_strategy (str, optional): HTTP strategy to use ('requests' or 'curl')
Expand All @@ -57,78 +56,75 @@ def __init__(

if store_key is None or not store_key.strip():
raise AuthenticationError("Store key must be provided")

if secret_key is None or not secret_key.strip():
raise AuthenticationError("Secret key must be provided")

self.store_key = store_key.strip()
self.secret_key = secret_key.strip()
self.http_strategy = http_strategy

# Handle configuration
if config is not None:
self.config = config
else:
# Create config from mode for backward compatibility
self.config = create_config_from_mode(mode)

# Initialize HTTP client with strategy
self.http_client = BuckarooHttpClient(
self.store_key,
self.secret_key,
self.config,
self.http_strategy
self.store_key, self.secret_key, self.config, self.http_strategy
)

@property
def is_test_environment(self) -> bool:
"""
Check if client is configured for test environment.

Returns:
bool: True if in test environment, False if live.
"""
return self.config.is_test_environment

@property
def is_live_environment(self) -> bool:
"""
Check if client is configured for live environment.

Returns:
bool: True if in live environment, False if test.
"""
return self.config.is_live_environment

@property
def api_endpoint(self) -> str:
"""
Get the API endpoint URL.

Returns:
str: The API endpoint URL.
"""
return self.config.api_endpoint

def confirm_credential(self) -> bool:
"""
Verify that the configured store key and secret key are valid.

Calls the Transaction Specification endpoint which requires HMAC authentication.

Returns:
bool: True if credentials are valid, False otherwise.
"""
try:
response = self.http_client.get('/json/Transaction/Specification/ideal')
response = self.http_client.get("/json/Transaction/Specification/ideal")
return response.success
except Exception:
return False

def get_config_info(self) -> dict:
"""
Get configuration information.

Returns:
dict: Configuration information (safe for logging).
"""
Expand Down
Loading
Loading