@@ -136,8 +136,8 @@ private function createOrder($userId,$amount,$shipping,$productId,$quantity,$qua
136136
137137private function multipleOrder ($ userId ,$ amount ,$ shipping ,$ quarter_delivery ,$ address ,$ productsPayments ,$ reference ){
138138
139- foreach ( $ productsPayments as $ product ){
140- $ order =new Order ;
139+
140+ $ order =new Order ;
141141 $ order ->user_id =$ userId ;
142142 $ order ->isPay =1 ;
143143 $ order ->total =$ amount ;
@@ -150,9 +150,13 @@ private function multipleOrder($userId,$amount,$shipping,$quarter_delivery,$addr
150150 $ order ->address =$ address ;
151151 }
152152 $ order ->save ();
153- SendNewOrderNotificationJob:: dispatch ( $ order -> id , $ product [ ' product_id ' ])-> delay ( now ()-> addMinutes ( 1 ));
153+
154154 $ this ->savePaymentAndOrder ($ reference ,$ order ->id );
155- if ($ product ['hasVariation ' ]=="true " ){
155+ foreach ($ productsPayments as $ product ){
156+
157+ SendNewOrderNotificationJob::dispatch ($ order ->id ,$ product ['product_id ' ])->delay (now ()->addMinutes (1 ));
158+
159+ if ($ product ['hasVariation ' ]==true ){
156160 $ orderVariation =new OrderVariation ;
157161 $ orderVariation ->order_id =$ order ->id ;
158162 if ($ product ['attributeVariationId ' ]==null ){
@@ -169,6 +173,12 @@ private function multipleOrder($userId,$amount,$shipping,$quarter_delivery,$addr
169173 Log::info ('Order variation create success ' );
170174 $ orderVariation ->save ();
171175 }else {
176+ Log::info ('gain order ' ,[
177+ "order_id " =>$ order ->id ,
178+ "product_id " =>$ product ['product_id ' ],
179+ "quantity " =>$ product ['quantity ' ],
180+ "price " =>$ product ['price ' ],
181+ ]);
172182 $ orderDetails =new OrderDetail ;
173183 $ orderDetails ->order_id =$ order ->id ;
174184 $ orderDetails ->product_id =$ product ['product_id ' ];
@@ -181,9 +191,9 @@ private function multipleOrder($userId,$amount,$shipping,$quarter_delivery,$addr
181191 }
182192 }
183193
184- return $ order ;
194+
185195 }
186- return null ;
196+ return $ order ;
187197}
188198
189199private function reduceQuantity ($ productId ,$ quantity ){
0 commit comments