Automattic\WooCommerce\Internal\ReceiptRendering

ReceiptRenderingRestController::get_response_for_fileprivateWC 1.0

Formats the response for both the GET and POST endpoints.

Method of the class: ReceiptRenderingRestController{}

No Hooks.

Returns

Array. The data for the actual response to be returned.

Usage

// private - for code of main (parent) class only
$result = $this->get_response_for_file( $filename ): array;
$filename(string) (required)
The filename to return the information for.

ReceiptRenderingRestController::get_response_for_file() code WC 10.3.3

private function get_response_for_file( string $filename ): array {
	$expiration_date = TransientFilesEngine::get_expiration_date( $filename );
	$public_url      = wc_get_container()->get( TransientFilesEngine::class )->get_public_url( $filename );

	return array(
		'receipt_url'     => $public_url,
		'expiration_date' => $expiration_date,
	);
}