File tree Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ protected function tryToProcessOrder($checkoutFormId)
5454 {
5555 try {
5656 $ checkoutForm = $ this ->checkoutFormRepository ->get ($ checkoutFormId );
57- if ($ this ->processor ->processOrder ($ checkoutForm )) {
57+ if ($ this ->processor ->validateCheckoutFormBoughtAtDate ($ checkoutForm )) {
58+ $ this ->processor ->processOrder ($ checkoutForm );
5859 $ this ->successIds [] = $ checkoutFormId ;
5960 } else {
6061 $ this ->skippedIds [] = $ checkoutFormId ;
Original file line number Diff line number Diff line change @@ -87,15 +87,10 @@ public function __construct(
8787
8888 /**
8989 * @param CheckoutFormInterface $checkoutForm
90- * @return bool
9190 * @throws \Exception
9291 */
93- public function processOrder (CheckoutFormInterface $ checkoutForm ): bool
92+ public function processOrder (CheckoutFormInterface $ checkoutForm ): void
9493 {
95- if (!$ this ->validateCheckoutFormBoughtAtDate ($ checkoutForm )) {
96- return false ;
97- }
98-
9994 $ connection = $ this ->resource ->getConnection ();
10095 try {
10196 $ connection ->beginTransaction ();
@@ -113,8 +108,6 @@ public function processOrder(CheckoutFormInterface $checkoutForm): bool
113108 }
114109
115110 $ connection ->commit ();
116- return true ;
117-
118111 } catch (\Exception $ e ) {
119112 $ connection ->rollBack ();
120113 $ this ->addOrderWithErrorToTable ($ checkoutForm , $ e );
@@ -218,7 +211,7 @@ private function removeErrorLogIfExist(CheckoutFormInterface $checkoutForm): voi
218211 * @param CheckoutFormInterface $checkoutForm
219212 * @return bool
220213 */
221- private function validateCheckoutFormBoughtAtDate (CheckoutFormInterface $ checkoutForm ): bool
214+ public function validateCheckoutFormBoughtAtDate (CheckoutFormInterface $ checkoutForm ): bool
222215 {
223216 foreach ($ checkoutForm ->getLineItems () as $ lineItem ) {
224217 if ($ lineItem ->getBoughtAt () < $ this ->configuration ->getInitializationTime ()) {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public function getShippingMethodCode(CheckoutFormInterface $checkoutForm)
5252 $ methodName = $ checkoutForm ->getDelivery ()->getMethod ()->getId ();
5353
5454 if ($ methodName == '' ) {
55- return $ this ->getDefaultShippingMethodCode ();
55+ return $ this ->getDefaultMethodCode ();
5656 }
5757
5858 if (!isset ($ this ->shippingCodes [$ methodName ])) {
@@ -62,14 +62,6 @@ public function getShippingMethodCode(CheckoutFormInterface $checkoutForm)
6262 return $ this ->shippingCodes [$ methodName ];
6363 }
6464
65- /**
66- * @return string
67- */
68- public function getDefaultShippingMethodCode ()
69- {
70- return self ::DEFAULT_SHIPPING_METHOD ;
71- }
72-
7365 /**
7466 * @param string $methodId
7567 * @return string
You can’t perform that action at this time.
0 commit comments