Skip to content

Commit d691e3c

Browse files
committed
Adds support for overpayment document type in payment pairing
Extends the `sparujPlatbu` method to include an optional `overpayTo` parameter, allowing specification of the document type for overpayment during payment pairing. Improves flexibility in handling overpayments via REST API integration.
1 parent cddea58 commit d691e3c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/AbraFlexi/FakturaVydana.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,22 @@ class FakturaVydana extends RW implements \AbraFlexi\Document
4747
*
4848
* @see https://demo.flexibee.eu/devdoc/parovani-plateb Párování plateb
4949
*
50-
* @param $doklad Banka|PokladniPohyb|InterniDoklad S jakým dokladem spárovat ?
51-
* @param $zbytek string ne|zauctovat|ignorovat|castecnaUhrada|castecnaUhradaNeboZauctovat|castecnaUhradaNeboIgnorovat
50+
* @param $doklad Banka|PokladniPohyb|InterniDoklad S jakým dokladem spárovat ?
51+
* @param $zbytek string ne|zauctovat|ignorovat|castecnaUhrada|castecnaUhradaNeboZauctovat|castecnaUhradaNeboIgnorovat
52+
* @param $overpayTo string code of document type for overpayment - https://podpora.flexibee.eu/cs/articles/6091847-vytvoreni-preplatku-pomoci-rest-api
5253
*
5354
* @return bool success
5455
*/
55-
public function sparujPlatbu($doklad, $zbytek = 'ignorovat')
56+
public function sparujPlatbu($doklad, $zbytek = 'ignorovat', string $overpayTo = '')
5657
{
5758
$sparovani = ['uhrazovanaFak' => $this];
5859
$sparovani['uhrazovanaFak@type'] = $this->evidence;
5960
$sparovani['zbytek'] = $zbytek;
61+
62+
if ($overpayTo){
63+
$sparovani['preplatek']['typDokl'] = $overpayTo;
64+
}
65+
6066
$doklad->insertToAbraFlexi(['id' => $doklad, 'sparovani' => $sparovani]);
6167

6268
return $doklad->lastResponseCode === 201;

0 commit comments

Comments
 (0)