Beispiel #1
0
<?php

// Include the Companies House module...
require_once '../../../GovTalk.php';
require_once '../VAT.php';
// Include the Companies House configuration
require_once 'config.php';
if (isset($_GET['endpoint']) && isset($_GET['correlation'])) {
    $hmrcVat = new HmrcVat($hmrcUserId, $hmrcPassword);
    if ($pollResponse = $hmrcVat->declarationResponsePoll($_GET['correlation'], $_GET['endpoint'])) {
        if (isset($pollResponse['endpoint'])) {
            echo 'Response pending.  Please wait ' . $pollResponse['interval'] . ' seconds and then refresh this page to try again.';
        } else {
            echo 'Response received, delete command sent.  See below:';
            var_dump($pollResponse);
            exit;
            if ($hmrcVat->sendDeleteRequest()) {
                echo 'Delete request successful. Resource no longer exists on Gateway.';
            } else {
                echo 'Delete request failed. Resource may still exist on Gateway.';
            }
        }
    } else {
        echo 'Government Gateway returned errors in response to poll request:';
        var_dump($hmrcVat->getResponseErrors());
    }
} else {
    echo 'Unable to poll Government Gateway: missing arguments.';
}
Beispiel #2
0
<?php

// Include the Companies House module...
require_once '../../../GovTalk.php';
require_once '../VAT.php';
// Include the Companies House configuration
require_once 'config.php';
if (isset($_GET['formdata'])) {
    $hmrcVat = new HmrcVat($hmrcUserId, $hmrcPassword, 'vsips');
    if ($pollRequest = $hmrcVat->declarationRequest($_GET['vatnumber'], $_GET['periodid'], $_GET['capacity'], $_GET['formdata'][1], $_GET['formdata'][2], $_GET['formdata'][4], $_GET['formdata'][6], $_GET['formdata'][7], $_GET['formdata'][8], $_GET['formdata'][9])) {
        echo 'Return successfully submitted.<br /><br />';
        echo 'Endpoint: ' . $pollRequest['endpoint'] . '<br />';
        echo 'Interval: ' . $pollRequest['interval'] . ' seconds<br />';
        echo 'Correlation: ' . $pollRequest['correlationid'] . '<br />';
        echo '<br /><a href="submit-poll.php?endpoint=' . urlencode($pollRequest['endpoint']) . '&correlation=' . urlencode($pollRequest['correlationid']) . '">Poll for HMRC response.</a><br />';
    } else {
        echo 'Return was rejected by the Government Gateway: ';
        var_dump($hmrcVat->getResponseErrors());
    }
} else {
    ?>

<form action="" method="get">
	VAT number: <input name="vatnumber" type="text" value="999900001" /><br />
	Period ID: <input name="periodid" type="text" value="2009-01" /><br />
	Capacity:
	<select name="capacity">
		<option>Individual</option>
		<option>Company</option>
		<option>Agent</option>
		<option>Bureau</option>