Skip to content

Commit bb0c663

Browse files
authored
feat(wallet): Allow to set the name of a wallet's initial transactions (#342)
## Roadmap Task 👉 https://getlago.canny.io/feature-requests/p/define-the-name-of-a-wallet-transaction-at-top-up ## Context Follow up of getlago/lago-api@43061b1. ## Description This allows to provide a `name` for the wallet transactions created when creating a wallet via the `transaction_name` field.
1 parent 99b1e86 commit bb0c663

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

lago_python_client/models/wallet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Wallet(BaseModel):
6060
currency: Optional[str]
6161
recurring_transaction_rules: Optional[RecurringTransactionRuleList]
6262
transaction_metadata: Optional[List[Dict[str, str]]]
63+
transaction_name: Optional[str]
6364
applies_to: Optional[AppliesTo]
6465
invoice_requires_successful_payment: Optional[bool]
6566

tests/test_wallet_client.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def wallet_object():
3737
recurring_transaction_rules=rules_list,
3838
applies_to=applies_to,
3939
invoice_requires_successful_payment=False,
40+
transaction_name="Transaction Name",
4041
)
4142

4243

@@ -63,6 +64,37 @@ def test_valid_create_wallet_request(httpx_mock: HTTPXMock):
6364
method="POST",
6465
url="https://api.getlago.com/api/v1/wallets",
6566
content=mock_response(),
67+
match_json={
68+
"wallet": {
69+
"external_customer_id": "12345",
70+
"rate_amount": "1",
71+
"name": "name",
72+
"paid_credits": "10",
73+
"granted_credits": "10",
74+
"expiration_at": None,
75+
"currency": None,
76+
"recurring_transaction_rules": [
77+
{
78+
"lago_id": None,
79+
"interval": "monthly",
80+
"threshold_credits": None,
81+
"trigger": "interval",
82+
"method": "target",
83+
"paid_credits": "105.0",
84+
"granted_credits": "105.0",
85+
"started_at": None,
86+
"expiration_at": None,
87+
"target_ongoing_balance": "105.0",
88+
"transaction_metadata": None,
89+
"transaction_name": "Recurring Transaction Rule",
90+
}
91+
],
92+
"transaction_metadata": None,
93+
"invoice_requires_successful_payment": False,
94+
"transaction_name": "Transaction Name",
95+
"applies_to": {"fee_types": ["charge"], "billable_metric_codes": ["usage"]},
96+
}
97+
},
6698
)
6799
response = client.wallets.create(wallet_object())
68100

0 commit comments

Comments
 (0)