|
| 1 | +from typing import TYPE_CHECKING, Any |
| 2 | + |
1 | 3 | from .base import ObjectBase |
2 | 4 |
|
| 5 | +if TYPE_CHECKING: |
| 6 | + from ..client import Client |
| 7 | + from ..resources import PaymentCaptures |
| 8 | + |
3 | 9 |
|
4 | 10 | class Capture(ObjectBase): |
5 | 11 | @classmethod |
6 | | - def get_resource_class(cls, client): |
| 12 | + def get_resource_class(cls, client: "Client", **kwargs: Any) -> "PaymentCaptures": |
7 | 13 | from ..resources import PaymentCaptures |
8 | 14 |
|
9 | | - return PaymentCaptures(client) |
| 15 | + payment = kwargs["payment"] |
| 16 | + return PaymentCaptures(client, payment) |
10 | 17 |
|
11 | 18 | @property |
12 | 19 | def id(self): |
@@ -50,9 +57,10 @@ def get_shipment(self): |
50 | 57 | url = self._get_link("shipment") |
51 | 58 | if url: |
52 | 59 | from ..resources import OrderShipments |
| 60 | + from .order import Order |
53 | 61 |
|
54 | | - # We fake the order object here, since it is not used by from_url() |
55 | | - return OrderShipments(self.client, order=None).from_url(url) |
| 62 | + order = Order({}, self.client) |
| 63 | + return OrderShipments(self.client, order).from_url(url) |
56 | 64 |
|
57 | 65 | def get_settlement(self): |
58 | 66 | """Return the settlement for this capture.""" |
|
0 commit comments