Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function receiveSettlementReport($data, $no_throw) {
- /** @todo clarify what we need to do
- * this report is kind of "consolidated finantion operation data", we dont need this, client can see on ESAL website
- */
- $result = [];
- foreach($data['billerReconUploadRq']['pmtBankRec'] as $rec1) {
- foreach($rec1['pmtBranchRec'] as $rec2) {
- foreach($rec2['pmtRec'] as $rec3) {
- $sadadBillId = $rec3['pmtInfo']['billNumber'];
- $result[$sadadBillId] = [
- 'order_id' => null,
- 'info' => $rec3
- ];
- /** @var \Drupal\commerce_order\Entity\OrderInterface $order */
- $order = \Drupal::entityTypeManager()->getStorage('commerce_order')->loadByProperties([
- 'field_sadad_bills_id' => $sadadBillId
- ]);
- $order = @reset($order);
- if(empty($order)) {
- $ex = new OrderLoadFailException('field_sadad_bills_id', $sadadBillId);
- $this->logger->error($ex->getMessage());
- if($no_throw)
- continue;
- else {
- throw $ex;
- }
- }
- $result[$sadadBillId]['order_id'] = $order->id();
- $order->field_esal_reports[] = json_encode($rec3);
- $order->save();
- }
- }
- }
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement