diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 36260b43..e35e43c8 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -743,10 +743,24 @@ class Index extends CI_Controller { $webhook_memo = json_decode($item->pn_memo); $res_links = null; $res_links = $webhook_memo->resource->links; - $res_links = json_encode($res_links, JSON_UNESCAPED_SLASHES); + // $res_links = json_encode($res_links, JSON_UNESCAPED_SLASHES); + + $default_payee = new stdClass; + $default_payee->email_address = "pays@chinahighlights.com"; + $default_payee->merchant_id = "JE4VX9SSVGTVN"; + $payee = isset($webhook_memo->resource->payee) ? $webhook_memo->resource->payee : $default_payee; + + $API = new stdClass; + $API->payee = $payee; + $API->res_links = $res_links; + + $API_str = json_encode($API, JSON_UNESCAPED_SLASHES); $pn_txn_id = $item->pn_txn_id; $orderid_info = $this->analysis_orderid($item->pn_invoice); + + $this->Note_model->update_send($item->pn_txn_id, 'sendfail', $item->pn_sn); + if (!empty($orderid_info)) { $orderid_info = json_decode($orderid_info); if ($orderid_info->ordertype === 'TP' || $orderid_info->ordertype === 'A') { @@ -756,19 +770,19 @@ class Index extends CI_Controller { if ($orderid_info->ordertype === 'T') { $data_gai = $this->Paypal_model->get_money_t($pn_txn_id); if ( ! empty($data_gai)) { - $this->Paypal_model->update_money_api_t($pn_txn_id, $res_links); + $this->Paypal_model->update_money_api_t($pn_txn_id, $API_str); $this->Note_model->update_send($item->pn_txn_id, 'send-wh-API', $item->pn_sn); } } elseif ($orderid_info->ordertype === 'B') { $data_gai = $this->Paypal_model->get_money_b($pn_txn_id, false); if ( ! empty($data_gai)) { - $this->Paypal_model->update_money_api_b($pn_txn_id, $res_links); + $this->Paypal_model->update_money_api_b($pn_txn_id, $API_str); $this->Note_model->update_send($item->pn_txn_id, 'send-wh-API', $item->pn_sn); } } } - return $res_links; + return $API_str; } public function handle_webhook_batch() {