@@ -92,16 +92,17 @@ public function __construct(
92
92
public function processOrder (CheckoutFormInterface $ checkoutForm ): void
93
93
{
94
94
$ connection = $ this ->resource ->getConnection ();
95
+ $ checkoutFormId = $ checkoutForm ->getId ();
95
96
try {
96
97
$ connection ->beginTransaction ();
97
98
98
99
if ($ checkoutForm ->getStatus () === Status::ALLEGRO_READY_FOR_PROCESSING ) {
99
- if (!$ this ->tryToGetOrder ($ checkoutForm -> getId () )) {
100
- $ this ->allegroReservation ->compensateReservation ($ checkoutForm -> getId () );
100
+ if (!$ this ->tryToGetOrder ($ checkoutFormId )) {
101
+ $ this ->allegroReservation ->compensateReservation ($ checkoutFormId );
101
102
$ this ->tryCreateOrder ($ checkoutForm );
102
103
}
103
104
} elseif ($ checkoutForm ->getStatus () === Status::ALLEGRO_CANCELLED ) {
104
- $ this ->allegroReservation ->compensateReservation ($ checkoutForm -> getId () );
105
+ $ this ->allegroReservation ->compensateReservation ($ checkoutFormId );
105
106
} else {
106
107
$ this ->allegroReservation ->placeReservation ($ checkoutForm );
107
108
}
@@ -110,7 +111,7 @@ public function processOrder(CheckoutFormInterface $checkoutForm): void
110
111
$ connection ->commit ();
111
112
} catch (\Exception $ e ) {
112
113
$ connection ->rollBack ();
113
- $ this ->addOrderWithErrorToTable ($ checkoutForm , $ e );
114
+ $ this ->addOrderWithErrorToTable ($ checkoutFormId , $ e );
114
115
throw $ e ;
115
116
}
116
117
}
@@ -129,14 +130,12 @@ protected function tryToGetOrder($id): ?OrderInterface
129
130
}
130
131
131
132
/**
132
- * @param CheckoutFormInterface $checkoutForm
133
+ * @param string $checkoutFormId
133
134
* @param \Exception $e
134
- * @throws \Exception
135
+ * @throws OrderProcessingException
135
136
*/
136
- private function addOrderWithErrorToTable (CheckoutFormInterface $ checkoutForm , \Exception $ e ): void
137
+ public function addOrderWithErrorToTable (string $ checkoutFormId , \Exception $ e ): void
137
138
{
138
- $ checkoutFormId = $ checkoutForm ->getId ();
139
-
140
139
$ date = $ this ->date ->gmtDate ();
141
140
142
141
try {
0 commit comments