@@ -30,50 +30,59 @@ class Check extends Base
3030{
3131 protected $ event = Checked::class;
3232
33+ protected $ doneInsteadThrow = true ;
34+
3335 public function handle ()
3436 {
35- $ this ->checkExternalId ();
37+ $ this ->call (function () {
38+ $ this ->checkExternalId ();
3639
37- $ response = $ this ->process ();
40+ $ response = $ this ->process ();
3841
39- $ status = $ response ->getStatus ();
42+ $ status = $ response ->getStatus ();
4043
41- switch (true ) {
42- case $ this ->hasFailed ($ status ):
43- $ this ->update ($ response , Status::FAILED );
44- break ;
44+ switch (true ) {
45+ case $ this ->hasFailed ($ status ):
46+ $ this ->update ($ response , Status::FAILED );
47+ break ;
4548
46- case $ this ->hasRefunding ($ status ):
47- $ this ->update ($ response , Status::WAIT_REFUND );
48- break ;
49+ case $ this ->hasRefunding ($ status ):
50+ $ this ->update ($ response , Status::WAIT_REFUND );
51+ break ;
4952
50- case $ this ->hasRefunded ($ status ):
51- $ this ->update ($ response , Status::REFUND );
52- break ;
53+ case $ this ->hasRefunded ($ status ):
54+ $ this ->update ($ response , Status::REFUND );
55+ break ;
5356
54- case $ this ->hasSuccess ($ status ):
55- $ this ->update ($ response , Status::SUCCESS );
56- break ;
57+ case $ this ->hasSuccess ($ status ):
58+ $ this ->update ($ response , Status::SUCCESS );
59+ break ;
5760
58- default :
59- if ($ this ->hasBreak ()) {
60- return ;
61- }
61+ default :
62+ if ($ this ->hasBreak ()) {
63+ return ;
64+ }
6265
63- $ this ->returnToQueue ();
64- }
66+ $ this ->returnToQueue ();
67+ }
68+ });
6569 }
6670
67- public function retryUntil (): Carbon
71+ protected function process (): Response
6872 {
69- $ timeout = Main::getCheckTimeout ();
73+ return $ this ->resolveDriver ()->check ();
74+ }
7075
71- return Carbon::now ()->addSeconds ($ timeout );
76+ protected function queueName (): ?string
77+ {
78+ return $ this ->resolveDriver ()->queue ()->getCheck ();
7279 }
7380
74- protected function process (): Response
81+ public function retryUntil (): ? Carbon
7582 {
76- return $ this ->resolveDriver ()->check ();
83+ $ timeout = Main::getCheckTimeout ();
84+
85+ return Carbon::now ()->addSeconds ($ timeout );
7786 }
7887
7988 protected function update (Response $ response , string $ status ): void
@@ -82,11 +91,6 @@ protected function update(Response $response, string $status): void
8291 $ this ->store ($ response , false );
8392 }
8493
85- protected function queueName (): ?string
86- {
87- return $ this ->resolveDriver ()->queue ()->getCheck ();
88- }
89-
9094 protected function checkExternalId (): void
9195 {
9296 $ this ->resolveCashier ($ this ->model );
0 commit comments