Skip to content

Commit 29982e6

Browse files
committed
fix(docs): address API documentation inconsistencies
Fix several inconsistencies between official ATH Móvil API docs and library documentation: - Fix README code examples using incorrect field path (payment.data.ecommerce_id -> payment.ecommerce_id) - Add critical disclaimer about no test environment available - Add token expiration and lifecycle documentation - Expand business account prerequisites with detailed requirements - Remove unnecessary 'env' field from PaymentRequest model - Update tests to remove Environment enum references Addresses issues #8, #10, #13, and #15 from inconsistency audit.
1 parent d980a24 commit 29982e6

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ payment = client.create_payment(
5454
],
5555
)
5656

57-
confirmed = client.wait_for_confirmation(payment.data.ecommerce_id)
57+
confirmed = client.wait_for_confirmation(payment.ecommerce_id)
5858

5959
if confirmed:
60-
result = client.authorize_payment(payment.data.ecommerce_id)
60+
result = client.authorize_payment(payment.ecommerce_id)
6161
print(f"Payment completed: {result.data.reference_number}")
6262
```
6363

athm/models.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ class TransactionStatus(str, Enum):
1717
CANCEL = "CANCEL"
1818

1919

20-
class Environment(str, Enum):
21-
"""Available environments."""
22-
23-
PRODUCTION = "production"
24-
25-
2620
class PaymentItem(BaseModel):
2721
"""Item in a payment request."""
2822

@@ -69,7 +63,6 @@ class PaymentRequest(BaseModel):
6963

7064
model_config = ConfigDict(populate_by_name=True)
7165

72-
env: Environment = Environment.PRODUCTION
7366
public_token: str = Field(..., alias="publicToken")
7467
timeout: str = Field(default="600")
7568
total: str

docs/installation.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Installation
22

3+
!!! danger "No Test Environment Available"
4+
**Important**: ATH Móvil does not provide a sandbox or test environment. All API calls are made to the production environment with real money transactions. You must have:
5+
6+
- An active ATH Business account with a registered payment card
7+
- An active ATH Móvil personal account (separate from business account)
8+
- Different payment cards for your business and personal accounts
9+
10+
When testing, you will create real payment requests that require actual confirmation and cancellation.
11+
12+
## Prerequisites
13+
14+
Before installing the library, ensure you have:
15+
16+
### Required Accounts
17+
18+
1. **ATH Business Account**
19+
- Active merchant account with verified business information
20+
- Registered payment card linked to the business account
21+
- Access to ATH Business app or web portal for API credential management
22+
23+
2. **ATH Móvil Personal Account**
24+
- Active personal ATH Móvil account for testing
25+
- Must use a **different payment card** than your business account
26+
- Cannot use the same card for customer and merchant transactions (will trigger error BTRA_0003)
27+
28+
### Technical Requirements
29+
30+
- Python 3.10 or higher
31+
- Active internet connection (all API calls require HTTPS)
32+
- Secure environment for storing API credentials
33+
334
## Install the Package
435

536
### Using pip
@@ -49,6 +80,22 @@ Once your account is verified:
4980
| **Public Token** | All payment operations | Create, check, authorize, cancel payments |
5081
| **Private Token** | Refunds only | Process refunds on completed payments |
5182

83+
### Token Lifecycle and Expiry
84+
85+
!!! warning "Token Expiration"
86+
API tokens can expire after a period specified by ATH Business. When a token expires:
87+
88+
- You will receive error `token.expired` or `BTRA_0401`/`BTRA_0402`/`BTRA_0403`
89+
- You must generate new tokens from the ATH Business portal
90+
- No automatic token refresh is available
91+
92+
**Best practices:**
93+
94+
- Monitor for authentication errors in your application logs
95+
- Have a process to quickly rotate expired tokens
96+
- Store tokens securely using environment variables or secret managers
97+
- Never hardcode tokens in your source code
98+
5299
## Configure Environment Variables
53100

54101
### Create a `.env` file

tests/unit/test_models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from athm.models import (
1010
APIError,
11-
Environment,
1211
PaymentItem,
1312
PaymentRequest,
1413
PaymentResponse,
@@ -122,7 +121,6 @@ def test_valid_payment_request(self):
122121
assert request.public_token == "test_token"
123122
assert request.total == "100.00"
124123
assert request.phone_number == "7875551234"
125-
assert request.env == Environment.PRODUCTION
126124

127125
def test_payment_request_defaults(self):
128126
request = PaymentRequest(
@@ -132,7 +130,6 @@ def test_payment_request_defaults(self):
132130
items=[PaymentItem(name="Test", description="Test", quantity="1", price="100.00")],
133131
)
134132
assert request.timeout == "600"
135-
assert request.env == Environment.PRODUCTION
136133
assert request.tax is None
137134
assert request.subtotal is None
138135

0 commit comments

Comments
 (0)