Skip to content

Commit 176f02f

Browse files
committed
chore: restore
1 parent 1df9887 commit 176f02f

19 files changed

+80
-389
lines changed

src/ttt/application/player/approve_stars_purchase_invoce.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/ttt/application/player/complete_stars_purshase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
from ttt.application.player.ports.player_views import PlayerViews
1010
from ttt.application.player.ports.players import Players
11-
from ttt.entities.finance.payment.payment import PaymentIsNotInProgressError
11+
from ttt.entities.finance.payment.payment import PaymentAlreadyCompletedError
1212
from ttt.entities.tools.tracking import Tracking
1313

1414

@@ -38,7 +38,7 @@ async def __call__(self) -> None:
3838
current_datetime,
3939
tracking,
4040
)
41-
except (PaymentIsNotInProgressError):
41+
except (PaymentAlreadyCompletedError):
4242
...
4343
else:
4444
await self.map_(tracking)

src/ttt/application/player/dto/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77

88
@dataclass(frozen=True)
99
class PaidStarsPurchasePayment:
10+
purshase_id: UUID
1011
location: PlayerLocation
1112
success: PaymentSuccess

src/ttt/application/player/initiate_stars_purchase_payment.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ async def __call__(
6161
await self.map_(tracking)
6262
await self.fsm.set(None)
6363
await gather(*[
64-
self.player_views.render_stars_purchase_invoice_view(
65-
location, it.new_stars, it.payment.paid_rubles,
66-
)
64+
self.payment_gateway.process_payment(it, location)
6765
for it in tracking.new
6866
if isinstance(it, StarsPurchase)
6967
])

src/ttt/application/player/ports/player_views.py

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

44
from ttt.entities.core.player.location import PlayerLocation
55
from ttt.entities.core.player.player import Player
6-
from ttt.entities.core.player.stars_purchase import StarsPurchase
76
from ttt.entities.core.stars import Stars
8-
from ttt.entities.finance.rubles import Rubles
97

108

119
class PlayerViews(ABC):
@@ -94,9 +92,3 @@ async def render_stars_purchase_will_be_completed_view(
9492
async def render_completed_stars_purshase_view(
9593
self, player: Player, purshase_id: UUID, location: PlayerLocation, /,
9694
) -> None: ...
97-
98-
@abstractmethod
99-
async def render_stars_purchase_invoice_view(
100-
self, location: PlayerLocation, stars: Stars, rubles: Rubles, /,
101-
) -> None:
102-
...

src/ttt/application/player/ports/stars_purchase_payment_gateway.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33

44
from ttt.application.player.dto.common import PaidStarsPurchasePayment
55
from ttt.entities.core.player.location import PlayerLocation
6+
from ttt.entities.core.player.stars_purchase import StarsPurchase
67

78

89
class StarsPurchasePaymentGateway(ABC):
910
@abstractmethod
10-
async def start_payment(self, location: PlayerLocation) -> None:
11+
async def process_payment(
12+
self,
13+
purshase: StarsPurchase,
14+
location: PlayerLocation,
15+
) -> None:
1116
...
1217

1318
@abstractmethod

src/ttt/application/player/view_stars_purchase_invoice.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/ttt/application/player/wait_rubles_to_view_stars_purchase_invoice.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/ttt/entities/core/player/player.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -217,27 +217,7 @@ def complete_stars_purchase(
217217
) -> None:
218218
"""
219219
:raises ttt.entities.player.player.NoPurchaseError:
220-
:raises ttt.entities.finance.payment.payment.PaymentIsNotInProgressError:
221-
""" # noqa: E501
222-
223-
purchase = self._stars_purchase(purchase_id)
224-
225-
self.account = self.account.map(
226-
lambda stars: stars + purchase.new_stars,
227-
)
228-
tracking.register_mutated(self)
229-
purchase.payment.complete(payment_success, current_datetime, tracking)
230-
231-
def complete_stars_purchase(
232-
self,
233-
purchase_id: UUID,
234-
payment_success: PaymentSuccess,
235-
current_datetime: datetime,
236-
tracking: Tracking,
237-
) -> None:
238-
"""
239-
:raises ttt.entities.player.player.NoPurchaseError:
240-
:raises ttt.entities.finance.payment.payment.PaymentIsNotInProgressError:
220+
:raises ttt.entities.finance.payment.payment.PaymentAlreadyCompletedError:
241221
""" # noqa: E501
242222

243223
purchase = self._stars_purchase(purchase_id)
@@ -256,7 +236,7 @@ def cancel_stars_purchase(
256236
) -> None:
257237
"""
258238
:raises ttt.entities.player.player.NoPurchaseError:
259-
:raises ttt.entities.finance.payment.payment.PaymentIsNotInProgressError:
239+
:raises ttt.entities.finance.payment.payment.PaymentAlreadyCompletedError:
260240
""" # noqa: E501
261241

262242
purchase = self._stars_purchase(purchase_id)

src/ttt/entities/core/player/stars_purchase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from dataclasses import dataclass
22
from datetime import datetime
3-
from enum import Enum
43
from uuid import UUID
54

65
from ttt.entities.core.player.location import PlayerLocation

0 commit comments

Comments
 (0)