Skip to content

Commit

Permalink
Merge pull request #433 from sebcode/fix/ing
Browse files Browse the repository at this point in the history
ING-spezifische fixes
  • Loading branch information
nemiah authored Jun 26, 2024
2 parents 8ac1556 + 63373e1 commit 4f2ea90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Fhp/Model/StatementOfAccount/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Statement
protected $endBalance = null;

/**
* @var string
* @var string|null
*/
protected $creditDebit;
protected $creditDebit = null;

/**
* @var \DateTime|null
Expand Down Expand Up @@ -91,7 +91,7 @@ public function setEndBalance(float $endBalance)
/**
* Get creditDebit
*/
public function getCreditDebit(): string
public function getCreditDebit(): ?string
{
return $this->creditDebit;
}
Expand Down
10 changes: 7 additions & 3 deletions lib/Fhp/Model/StatementOfAccount/StatementOfAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ public static function fromMT940Array(array $array): StatementOfAccount
} else {
$statementModel = new Statement();
$statementModel->setDate(static::parseDate($date));
$statementModel->setStartBalance((float) $statement['start_balance']['amount']);
if(isset($statement['end_balance'])){
if (isset($statement['start_balance']['amount'])) {
$statementModel->setStartBalance((float) $statement['start_balance']['amount']);
}
if (isset($statement['end_balance'])) {
$statementModel->setEndBalance((float) $statement['end_balance']['amount']);
}
$statementModel->setCreditDebit($statement['start_balance']['credit_debit']);
if (isset($statement['start_balance']['credit_debit'])) {
$statementModel->setCreditDebit($statement['start_balance']['credit_debit']);
}
$result->statements[] = $statementModel;
}

Expand Down

0 comments on commit 4f2ea90

Please sign in to comment.