Exemplo n.º 1
0
	public function validateRequest($params, $urlEndpoint=null, $method=null)
	{
		$utils = new Amazon_FPS_SignatureUtilsForOutbound($this->_awsAccessKeyId, $this->_awsSecretAccessKey);

		try {
			return $utils->validateRequest($params, $urlEndpoint, $method);
		}
		catch (Amazon_FPS_SignatureException $e) {
			return false;
		}
	}
Exemplo n.º 2
0
If you have existing subscriptions using the old pre 3.0 Supporter Paypal gateway, then it is important to
overwrite the supporter-amazon.php file in your webroot with this one to prevent a lapse in subscription
payments being applied.
*/
if (!isset($_POST['signature'])) {
    // Did not find expected POST variables. Possible access attempt from a non Amazon site.
    writeToLog('Invalid visit to the IPN script from IP ' . $_SERVER['REMOTE_ADDR'] . "\n" . var_export($_POST, true));
    header('Status: 404 Not Found');
    exit;
} else {
    define('ABSPATH', dirname(__FILE__) . '/');
    require_once ABSPATH . 'wp-load.php';
    global $wpdb, $psts;
    $secret_key = get_site_option("supporter_amazon_secretkey");
    $access_key = get_site_option("supporter_amazon_accesskey");
    $utils = new Amazon_FPS_SignatureUtilsForOutbound($aws_access_key, $aws_secret_key);
    $self_address = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    $valid = $utils->validateRequest($_POST, $self_address, "POST");
    if (!$valid) {
        header('Status: 401 Unauthorized');
        exit;
    }
    list($blog_id, $period, $amount, $type, $stamp) = explode('_', $_POST['referenceId']);
    // process Amazon response
    switch ($_POST['status']) {
        case 'PI':
            // case: in-progress
            $note = 'Amazon payment has been initiated. It will take between five seconds and 48 hours to complete, based on the availability of external payment networks and the riskiness of the transaction.';
            $psts->log_action($blog_id, $note);
            break;
        case 'PendingUserAction':