Delete bank transaction
Creates a provisional bank transaction and deletes it. This changes data in Twinfield.
Twinfield documentation: Bank transactions.
delete($dayBook, $number, $reason) needs a reason, which Twinfield keeps. Only provisional transactions can be deleted: for a final transaction Twinfield refuses, which is thrown as ProcessXmlException. Correct a final transaction with a new transaction instead.
$twinfield = Example::twinfield();
$bank = $twinfield->bankTransactions();
$transaction = $bank->create( BankTransactionInput::forBankBook(Example::bankBook($twinfield), new DateTimeImmutable()) ->pay(Example::profitAndLossAccount($twinfield), '1.00', description: 'Entered twice'),);
// Only provisional transactions can be deleted; Twinfield wants a reason.$bank->delete($transaction->dayBook(), $transaction->number(), 'Entered twice');
echo 'Deleted ', $transaction->dayBook(), ' ', $transaction->number(), PHP_EOL;echo 'Still there: ', $bank->find($transaction->dayBook(), $transaction->number()) === null ? 'no' : 'yes', PHP_EOL;php examples/bank-transactions/delete-bank-transaction/example.phpDeleted ING 202600048Still there: noWhat the SDK sends to Twinfield and what Twinfield sends back, for a call like the one in this example. The responses come from the tests, with example data.
Delete
Section titled “Delete”Twinfield documentation: Bank transactions: Delete.
$twinfield->bankTransactions()->delete('BNK', 202600046, 'Imported twice');The SDK sends this XML as xmlRequest of ProcessXmlString to processxml.asmx:
<transaction action="delete" reason="Imported twice"> <office>1000</office> <code>BNK</code> <number>202600046</number></transaction>Twinfield answers with this XML in ProcessXmlStringResult:
<transaction action="delete" reason="Imported twice" result="1"> <office>1000</office> <code>BNK</code> <number>202600046</number></transaction>Source
Section titled “Source”View examples/bank-transactions/delete-bank-transaction/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.