Service.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Created by PhpStorm.
* User: Ziy
* Date: 14/9/2
* Time: 下午2:19
*/
class YOHOPay_Package_Alipay_Service extends YOHOPay_Package_Abstract
{
public function notify(array $notifyData)
{
$alipay_config = array();
require_once(__DIR__ . "/Sdk/alipay.config.php");
require_once(__DIR__ . "/Sdk/lib/alipay_notify.class.php");
//计算得出通知验证结果
$config = new YOHOPay_Package_Alipay_Config();
$alipay_config['partner'] = $config->partnerID;
$alipayNotify = new AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyNotify();
if ($verify_result) {
if ($_POST['trade_status'] == 'TRADE_FINISHED') {
} else if ($_POST['trade_status'] == 'TRADE_SUCCESS') {
if (empty($notifyData['out_trade_no']) || empty($notifyData['total_fee'])) {
return 'fail';
}
$response = $this->makeResponseParameters($notifyData);
$this->orderNotify($response);
}
return "success";
} else {
return "fail";
}
}
}