Commit 25ebca29 authored by Karamel's avatar Karamel
Browse files

Fix general input failure input content

parent 521c1d37
......@@ -96,7 +96,7 @@ class CashsessionAPI extends APIHelper implements API
$fiscalTicket->setNumber(1);
}
$fiscalTicket->setDate(new \DateTime());
$stone = ['input' => $data, 'failure' => $reason];
$stone = ['input' => $input, 'failure' => $reason];
if ($reason instanceof PastequeException) {
$stone['failure'] = $reason->toStruct();
}
......
......@@ -58,7 +58,7 @@ class TicketAPI extends APIHelper implements API
$fiscalTicket->setNumber(1);
}
$fiscalTicket->setDate(new \DateTime());
$stone = ['input' => $data, 'failure' => $reason];
$stone = ['input' => $input, 'failure' => $reason];
if ($reason instanceof PastequeException) {
$stone['failure'] = $reason->toStruct();
}
......
......@@ -549,8 +549,11 @@ class HttpCashSessionTest extends TestCase
$this->assertEquals(2, count($ftkts));
$ftkt = $ftkts[0];
$fail = json_decode($ftkt->getContent(), true);
$this->assertNotNull($fail);
$inputFisc = $fail['input'];
$this->assertEquals($structSess['sequence'], $inputFisc['sequence']);
$this->assertEquals('NaN', $inputFisc['openCash']);
$errFisc = $fail['failure'];
$this->assertNotNull($errFisc);
$this->assertEquals('InvalidField', $errFisc['error']);
$this->assertEquals(InvalidFieldException::CSTR_FLOAT,
$errFisc['constraint']);
......
......@@ -509,8 +509,12 @@ class HttpTicketTest extends TestCase
$this->assertEquals(2, count($ftkts));
$ftkt = $ftkts[0];
$fail = json_decode($ftkt->getContent(), true);
$this->assertNotNull($fail);
$inputFisc = $fail['input'];
$this->assertEquals($tkt['sequence'], $inputFisc['sequence']);
$this->assertEquals($tkt['number'], $inputFisc['number']);
$this->assertEquals(null, $inputFisc['payments'][0]['paymentMode']);
$errFisc = $fail['failure'];
$this->assertNotNull($errFisc);
$this->assertEquals('InvalidField', $errFisc['error']);
$this->assertEquals(InvalidFieldException::CSTR_NOT_NULL,
$errFisc['constraint']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment