protected function createTransaction(\SimpleXMLElement $node, Transaction $tx, Account $account) { $nodes = ['accountFrom' => $account->getAccountNumber(), 'currency' => $tx->getCurrency(), 'amount' => number_format($tx->getAmount(), 2), 'accountTo' => $tx->getAccountNumber(), 'ks' => $tx->getConstantSymbol(), 'vs' => $tx->getVariableSymbol(), 'ss' => $tx->getSpecificSymbol(), 'bic' => $tx->getBankCode(), 'date' => $tx->getDate()->format('Y-m-d'), 'comment' => $tx->getComment(), 'benefName' => $tx->getBenefName(), 'benefStreet' => $tx->getBenefStreet(), 'benefCity' => $tx->getBenefCity(), 'benefCountry' => $tx->getBenefCountry(), 'remittanceInfo1' => $tx->getRemittanceInfo1(), 'remittanceInfo2' => $tx->getRemittanceInfo2(), 'remittanceInfo3' => $tx->getRemittanceInfo3(), 'paymentType' => $tx->getSpecification()]; foreach ($nodes as $el => $value) { if (!empty($value)) { $node->addChild($el, $value); } } }
protected function createTransaction(\SimpleXMLElement $node, Transaction $tx, Account $account) { $nodes = ['accountFrom' => $account->getAccountNumber(), 'currency' => $tx->getCurrency(), 'amount' => number_format($tx->getAmount(), 2), 'accountTo' => $tx->getAccountNumber(), 'bankCode' => $tx->getBankCode(), 'ks' => $tx->getConstantSymbol(), 'vs' => $tx->getVariableSymbol(), 'ss' => $tx->getSpecificSymbol(), 'date' => $tx->getDate()->format('Y-m-d'), 'messageForRecipient' => $tx->getUserMessage(), 'comment' => $tx->getComment(), 'paymentType' => $tx->getSpecification()]; foreach ($nodes as $el => $value) { if (!empty($value)) { $node->addChild($el, $value); } } }
/** * Helper function for adding transactions to the daily balance. * * @param Transaction $transaction * @param boolean $sort Flag for disabling sort on insert. Used for bulk loading. */ private function safeInsertDate(Transaction $transaction, $sort = false) { $date = $transaction->getDate(); if (!array_key_exists($date, $this->mDailyBalances)) { $this->mDailyBalances[$date] = 0.0; } $this->mDailyBalances[$date] += $transaction->getAmount(); if ($sort) { uksort($this->mDailyBalances, array($this, "dateCompare")); } }