Simulations Asynchronous Endpoints
This Simulations
endpoint provides asynchronous methods to interact with the simulations of the authenticated user.
Example usage of the Simulations endpoint object:
import asyncio
from pyrevolut.client import AsyncClient
CREDS_JSON_LOC = "path/to/creds.json"
client = AsyncClient(
creds_loc=CREDS_JSON_LOC,
sandbox=True,
)
async def run():
async with client:
response = await client.Simulations.simulate_account_topup(
account_id="SOME_ACCOUNT_ID",
amount=100.0,
currency="USD",
reference="Sugar Daddy :heart:",
state=EnumTransactionState.COMPLETED,
)
print(response)
asyncio.run(run())
EndpointSimulationsAsync
Bases: BaseEndpointAsync
The async Simulations API
The Simulations API is only available in the Sandbox environment. It lets you simulate certain events that are otherwise only possible in the production environment, such as your account's top-up and transfer state changes.
Source code in pyrevolut/api/simulations/endpoint/asynchronous.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
__check_sandbox()
Check if the sandbox is enabled.
Raises:
Type | Description |
---|---|
PyRevolutInvalidEnvironment
|
If the sandbox is enabled. |
Source code in pyrevolut/api/simulations/endpoint/asynchronous.py
140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
simulate_account_topup(account_id, amount, currency, reference=None, state=None, **kwargs)
async
Simulate a top-up of your account in the Sandbox environment.
This is useful during testing, when you run out of money in your test account and need to add more.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_id |
UUID
|
The ID of the account that you want to top up. |
required |
amount |
float
|
The amount with which you want to top up the account. Must be <= 10000 |
required |
currency |
str
|
The currency of the top-up amount. Must be a valid ISO 4217 currency code. |
required |
reference |
str
|
A short description for your top up. Default value: 'Test Top-up' if not provided. |
None
|
state |
EnumTransactionState
|
The state to which you want to set the top-up transaction. If not provided, the default value is 'completed'. Possible values:
|
None
|
Returns:
Type | Description |
---|---|
dict | Response
|
The top-up transaction information. |
Source code in pyrevolut/api/simulations/endpoint/asynchronous.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
simulate_transfer_state_update(transfer_id, action, **kwargs)
async
Simulate a transfer state change in the Sandbox environment.
For example, after you make a transfer in Sandbox, you can change its state to completed.
The resulting state is final and cannot be changed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transfer_id |
UUID
|
The ID of the transfer whose state you want to update. |
required |
action |
Literal['complete', 'revert', 'decline', 'fail']
|
The action you want to perform on the transfer. Possible values:
|
required |
Returns:
Type | Description |
---|---|
dict | Response
|
The updated transfer information. |
Source code in pyrevolut/api/simulations/endpoint/asynchronous.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|