get_meta( EFacture_FR_Invoice_Manager::META_NUMBER ); if ( '' === $number ) { return $response; } $credit_notes = array(); foreach ( $order->get_refunds() as $refund ) { $cn = (string) $refund->get_meta( EFacture_FR_Invoice_Manager::META_CREDIT_NUMBER ); if ( '' !== $cn ) { $credit_notes[] = array( 'number' => $cn, 'date' => (string) $refund->get_meta( EFacture_FR_Invoice_Manager::META_CREDIT_DATE ), ); } } $data = $response->get_data(); $data['efacture_fr_invoice'] = array( 'number' => $number, 'date' => (string) $order->get_meta( EFacture_FR_Invoice_Manager::META_DATE ), 'type' => (string) $order->get_meta( EFacture_FR_Invoice_Manager::META_TYPE ), 'profile' => 'EN16931', // File name only — never the absolute server path. 'pdf_file' => (string) $order->get_meta( EFacture_FR_Facturx::META_PDF ), 'credit_notes' => $credit_notes, ); $response->set_data( $data ); return $response; } }