feat: PayPal处理webhook推送, IPN未收到结果

feature/pay
lyt 6 years ago
parent 2f112ac48b
commit ecaa281214

@ -626,7 +626,7 @@ class Index extends CI_Controller {
return;
}
$post_data = json_decode($raw_post);
if ($post_data->event_type != 'PAYMENT.SALE.COMPLETED') {
if ($post_data->event_type != 'PAYMENT.SALE.COMPLETED' && $post_data->event_type != 'PAYMENT.SALE.REFUNDED') {
log_message('error',"paypal_webhook" . var_export($raw_post, 1));
return;
}
@ -650,10 +650,15 @@ class Index extends CI_Controller {
$pn_mc_currency = $post_data->resource->amount->currency;
$pn_payment_status = $post_data->resource->state;
if ($post_data->event_type == 'PAYMENT.SALE.REFUNDED') {
$pn_payment_status = 'Refunded';
$pn_mc_gross = '-' . $post_data->resource->amount->total;
$post_data->parent_txn_id = $post_data->resource->sale_id;
}
$pn_payment_date = $post_data->resource->update_time;
// $pn_payer = $post_data->resource->amount->currency;
// $pn_payer_email = $post_data->resource->amount->currency;
$pn_memo = $raw_post;
$pn_memo = json_encode($post_data); // $raw_post;
if (!empty($pn_txn_id)) {
//把PDT时间转成GMT时间
$pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date));
@ -823,7 +828,7 @@ class Index extends CI_Controller {
if (isset($webhook_memo->id) && substr($webhook_memo->id, 0, 2)==="WH") {
$is_webhook = true;
}
if (true === $is_webhook) {
if (empty($pn_txn_id) && true === $is_webhook) {
$this->Note_model->update_send($item->pn_txn_id, 'send', $item->pn_sn);
continue;
}

Loading…
Cancel
Save