forked from nemiah/phpFinTS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetBalanceTest.php
More file actions
34 lines (28 loc) · 1.65 KB
/
GetBalanceTest.php
File metadata and controls
34 lines (28 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Fhp\Tests\Unit\Integration\DKB;
use Fhp\Action\GetBalance;
class GetBalanceTest extends DKBIntegrationTestBase
{
public const GET_BALANCE_REQUEST = "HKSAL:3:5+1234567890::280:12030000+J'";
public const GET_BALANCE_RESPONSE = "HIRMG:3:2+3060::Bitte beachten Sie die enthaltenen Warnungen/Hinweise.'HIRMS:4:2:3+0020::Der Auftrag wurde ausgefuhrt.'HIRMS:5:2:4+3076::Starke Kundenauthentifizierung nicht notwendig.'HITAN:6:6:4+4++noref+nochallenge+++SomePhone1'HISAL:7:5:3+1234567890::280:12030000+Sichteinlagen+EUR+C:123,45:EUR:20200409+C:0,:EUR:20200409+0,:EUR+123,45:EUR'";
/**
* @throws \Throwable
*/
public function testGetBalance()
{
$this->initDialog();
$this->expectMessage(static::GET_BALANCE_REQUEST, static::GET_BALANCE_RESPONSE);
$getBalance = GetBalance::create($this->getTestAccount(), true);
$this->fints->execute($getBalance);
$this->assertFalse($getBalance->needsTan());
$balances = $getBalance->getBalances();
$this->assertCount(1, $balances);
$balance = $balances[0];
$this->assertEquals('1234567890', $balance->getAccountInfo()->getAccountNumber());
$this->assertEquals('12030000', $balance->getAccountInfo()->getBankIdentifier());
$this->assertEquals('Sichteinlagen', $balance->getKontoproduktbezeichnung());
$this->assertEqualsWithDelta(+123.45, $balance->getGebuchterSaldo()->getAmount(), 0.01);
$this->assertEquals(new \DateTime('2020-04-09T00:00:00'), $balance->getGebuchterSaldo()->getTimestamp());
$this->assertEqualsWithDelta(0, $balance->getSaldoDerVorgemerktenUmsaetze()->getAmount(), 0.01);
}
}