protected function bcaFilterTransactionTable($tables) { $ref = IBank::reference('table_header_account_statement'); $ref = array_flip($ref); $transactions = []; while (!empty($tables)) { $transaction = []; $table = array_shift($tables); if (count($table) == 6) { list($tgl, $keterangan, $cab, $mutasi_1, $mutasi_2, $saldo) = $table; $transaction['date'] = $this->bcaConvertDateTransaction($tgl); $keterangan = implode('', $keterangan); $keterangan = preg_replace('/<[^>]+>/', ' ', $keterangan); $keterangan = preg_replace('/\\s\\s+/', ' ', $keterangan); $keterangan = trim($keterangan); $transaction['description'] = $keterangan; $transaction['bca_branch'] = $cab; $transaction['bca_date'] = $tgl; $transaction['amount'] = $mutasi_1; $transaction['type'] = $mutasi_2; $transaction['balance'] = $saldo; $transaction['no'] = null; $transaction['id'] = null; } $transactions[] = array_merge($ref, $transaction); } return $transactions; }
/** * Mendapatkan array transaksi dengan format yang sudah rapih. */ protected function bniFilterTransactionTable($tables) { $ref = IBank::reference('table_header_account_statement'); $ref = array_flip($ref); $language = $this->configuration('language'); $language = null === $language ? 'id' : $language; $transactions = []; while (!empty($tables)) { $table = array_shift($tables); if (isset($table[0]) && isset($table[1])) { $info = $language == 'id' ? $this->bniTranslate($table[0]) : $table[0]; $value = $table[1]; switch ($info) { case 'Transaction Date': $transaction = ['no' => null, 'id' => null]; $transaction['date'] = $value; break; case 'Transaction Remarks': $transaction['detail'] = $value; break; case 'Amount type': $transaction['type'] = $value; break; case 'Amount': $transaction['amount'] = $value; break; case 'Account Balance': $transaction['balance'] = $value; $transactions[] = array_merge($ref, $transaction); break; } } } return $transactions; }