|
1 | 1 | import json
|
2 |
| -from re import search |
3 |
| -from os.path import isfile |
4 |
| -from os import remove |
5 | 2 | import socket
|
| 3 | +from os import remove |
| 4 | +from os.path import isfile |
6 | 5 | from time import sleep
|
7 | 6 |
|
8 | 7 | import requests
|
|
13 | 12 | from bunq.sdk.exception import BunqException
|
14 | 13 | from bunq.sdk.exception import ForbiddenException
|
15 | 14 | from bunq.sdk.model.generated import endpoint
|
16 |
| -from bunq.sdk.model.generated.object_ import Pointer, Amount, NotificationFilter |
17 |
| - |
| 15 | +from bunq.sdk.model.generated.object_ import Amount |
| 16 | +from bunq.sdk.model.generated.object_ import CardPinAssignment |
| 17 | +from bunq.sdk.model.generated.object_ import NotificationFilter |
| 18 | +from bunq.sdk.model.generated.object_ import Pointer |
18 | 19 |
|
19 | 20 | NOTIFICATION_DELIVERY_METHOD_URL = 'URL'
|
20 | 21 |
|
@@ -196,8 +197,15 @@ def link_card(self, card_id, account_id):
|
196 | 197 | :type account_id: int
|
197 | 198 | """
|
198 | 199 |
|
199 |
| - endpoint.Card.update(card_id=int(card_id), |
200 |
| - monetary_account_current_id=int(account_id)) |
| 200 | + endpoint.Card.update( |
| 201 | + card_id=int(card_id), |
| 202 | + pin_code_assignment=[ |
| 203 | + CardPinAssignment( |
| 204 | + type_='PRIMARY', |
| 205 | + monetary_account_id=int(account_id) |
| 206 | + ) |
| 207 | + ] |
| 208 | + ) |
201 | 209 |
|
202 | 210 | def add_callback_url(self, callback_url):
|
203 | 211 | """
|
@@ -272,4 +280,4 @@ def __request_spending_money_if_needed(self):
|
272 | 280 |
|
273 | 281 | def __should_request_spending_money(self):
|
274 | 282 | return self.env == ApiEnvironmentType.SANDBOX \
|
275 |
| - and float(BunqContext.user_context().primary_monetary_account.balance.value) <= self._ZERO_BALANCE |
| 283 | + and float(BunqContext.user_context().primary_monetary_account.balance.value) <= self._ZERO_BALANCE |
0 commit comments