src/Twisto/Invoice.php
public function returnItems($items, $discounts = null)
    {
        $data = array(
            'items' => array_map(function(ItemReturn $item) {
                return $item->serialize();
            }, $items)
        );

        if ($discounts !== null) {
            $data['discounts'] = array_map(function(ItemDiscountReturn $item) {
                return $item->serialize();
            }, $discounts);
        }

        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/', $data);
        $this->deserialize($data);
    }
public function returnItems($items, $discounts = null)
    {
        $data = array(
            'items' => array_map(function(ItemReturn $item) {
                return $item->serialize();
            }, $items)
        );

        if ($discounts !== null) {
            $data['discounts'] = array_map(function(ItemDiscountReturn $item) {
                return $item->serialize();
            }, $discounts);
        }

        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/return/', $data);
        $this->deserialize($data);
    }
public function returnItems ( $ items , $ discounts = null ) { $ data = array ( 'items' => array_map ( function ( ItemReturn $ item ) { return $ item -> serialize ( ) ; } , $ items ) ) ; if ( $ discounts !== null ) { $ data [ 'discounts' ] = array_map ( function ( ItemDiscountReturn $ item ) { return $ item -> serialize ( ) ; } , $ discounts ) ; } $ data = $ this -> twisto -> requestJson ( 'POST' , 'invoice/' . urlencode ( $ this -> invoice_id ) . '/return/' , $ data ) ; $ this -> deserialize ( $ data ) ; }
Perform invoice return API request
@param ItemReturn[] $items
@param ItemDiscountReturn[] $discounts
Perform invoice return API request