<?php
require __DIR__ . '/common.php';
$params = new \Yurun\PaySDK\Weixin\Params\PublicParams();
$params->appID = $GLOBALS['PAY_CONFIG']['appid'];
$params->mch_id = $GLOBALS['PAY_CONFIG']['mch_id'];
$params->key = $GLOBALS['PAY_CONFIG']['key'];
$sdk = new \Yurun\PaySDK\Weixin\SDK($params);
class pay_notify extends \Yurun\PaySDK\Weixin\Notify\Pay
{
protected function __exec()
{
file_put_contents(__DIR__ . '/notify_result.txt', date('Y-m-d H:i:s') . ':' . var_export($this->data, true));
$this->reply(true, 'OK');
}
}
$payNotify = new PayNotify();
try
{
$sdk->notify($payNotify);
}
catch (Exception $e)
{
file_put_contents(__DIR__ . '/notify_result.txt', $e->getMessage() . ':' . var_export($payNotify->data, true));
}