File tree Expand file tree Collapse file tree 4 files changed +18
-18
lines changed Expand file tree Collapse file tree 4 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 66
77use Bavix \Wallet \Internal \Dto \TransactionDto ;
88use Bavix \Wallet \Internal \Dto \TransactionDtoInterface ;
9+ use Bavix \Wallet \Internal \Service \ClockServiceInterface ;
910use Bavix \Wallet \Internal \Service \UuidFactoryServiceInterface ;
1011use Illuminate \Database \Eloquent \Model ;
1112
1213final readonly class TransactionDtoAssembler implements TransactionDtoAssemblerInterface
1314{
1415 public function __construct (
15- private UuidFactoryServiceInterface $ uuidService
16+ private UuidFactoryServiceInterface $ uuidService ,
17+ private ClockServiceInterface $ clockService ,
1618 ) {
1719 }
1820
@@ -33,7 +35,9 @@ public function create(
3335 $ type ,
3436 $ amount ,
3537 $ confirmed ,
36- $ meta
38+ $ meta ,
39+ $ this ->clockService ->now (),
40+ $ this ->clockService ->now (),
3741 );
3842 }
3943}
Original file line number Diff line number Diff line change 66
77use Bavix \Wallet \Internal \Dto \TransferDto ;
88use Bavix \Wallet \Internal \Dto \TransferDtoInterface ;
9+ use Bavix \Wallet \Internal \Service \ClockServiceInterface ;
910use Bavix \Wallet \Internal \Service \UuidFactoryServiceInterface ;
1011use Illuminate \Database \Eloquent \Model ;
1112
1213final readonly class TransferDtoAssembler implements TransferDtoAssemblerInterface
1314{
1415 public function __construct (
15- private UuidFactoryServiceInterface $ uuidService
16+ private UuidFactoryServiceInterface $ uuidService ,
17+ private ClockServiceInterface $ clockService ,
1618 ) {
1719 }
1820
@@ -34,7 +36,9 @@ public function create(
3436 $ fromModel ->getKey (),
3537 $ toModel ->getKey (),
3638 $ discount ,
37- $ fee
39+ $ fee ,
40+ $ this ->clockService ->now (),
41+ $ this ->clockService ->now (),
3842 );
3943 }
4044}
Original file line number Diff line number Diff line change 99/** @immutable */
1010final readonly class TransactionDto implements TransactionDtoInterface
1111{
12- private DateTimeImmutable $ createdAt ;
13-
14- private DateTimeImmutable $ updatedAt ;
15-
1612 /**
1713 * @param array<mixed>|null $meta
1814 */
@@ -24,10 +20,10 @@ public function __construct(
2420 private string $ type ,
2521 private float |int |string $ amount ,
2622 private bool $ confirmed ,
27- private ?array $ meta
23+ private ?array $ meta ,
24+ private DateTimeImmutable $ createdAt ,
25+ private DateTimeImmutable $ updatedAt ,
2826 ) {
29- $ this ->createdAt = new DateTimeImmutable ();
30- $ this ->updatedAt = new DateTimeImmutable ();
3127 }
3228
3329 public function getUuid (): string
Original file line number Diff line number Diff line change 99/** @immutable */
1010final readonly class TransferDto implements TransferDtoInterface
1111{
12- private DateTimeImmutable $ createdAt ;
13-
14- private DateTimeImmutable $ updatedAt ;
15-
1612 public function __construct (
1713 private string $ uuid ,
1814 private int $ depositId ,
@@ -21,10 +17,10 @@ public function __construct(
2117 private int $ fromId ,
2218 private int $ toId ,
2319 private int $ discount ,
24- private string $ fee
20+ private string $ fee ,
21+ private DateTimeImmutable $ createdAt ,
22+ private DateTimeImmutable $ updatedAt ,
2523 ) {
26- $ this ->createdAt = new DateTimeImmutable ();
27- $ this ->updatedAt = new DateTimeImmutable ();
2824 }
2925
3026 public function getUuid (): string
You can’t perform that action at this time.
0 commit comments