Beispiel #1
0
 *  International Registered Trademark & Property of PrestaShop SA
 */
/**
 * This is the Notify URL file, called by Alipay system
 *
 * First, we need to verify the genuineness of the notification by calling the Alipay "notify_verify" service
 * Then we performs some tests with local values
 * Finally, after we made the proper actions, we need to answer to Alipay with the word "success" or "fail"
 * @see AlipayNotify
 */
require_once '../../config/config.inc.php';
require_once dirname(__FILE__) . '/alipay.php';
require_once dirname(__FILE__) . '/api/loader.php';
$alipay_notify = new AlipayNotify();
$alipay_notify->getPostData();
switch ($alipay_notify->getNotifyType()) {
    case "trade_status_sync":
        $default_config = array('secrete_key' => false);
        $service = Configuration::get('ALIPAY_SERVICE_NOTIFY_VERIFY');
        $credentials = AlipayTools::getCredentials($service, $default_config);
        $alipayapi = new AlipayApi($credentials);
        $alipay_notify->setParamList('notify_verify');
        $alipayapi->prepareRequest($alipay_notify, false);
        $url = $alipayapi->createUrl();
        $alipay_notify->setParamList('compare_sign');
        $params = $alipayapi->getProtocolParams();
        unset($params['partner']);
        unset($params['service']);
        $alipayapi->setProtocolParams($params);
        $alipayapi->setSecreteKey(Configuration::get('ALIPAY_SECRETE_KEY'));
        $alipayapi->prepareRequest($alipay_notify);