避免重复支付,带上商户订单号out_trade_no

Signed-off-by: hitsword <mail@huayizhiyun.com>
master
hitsword 2019-05-20 18:52:05 +08:00
parent 569ed8b46f
commit da22451623
2 changed files with 4 additions and 2 deletions

View File

@ -143,7 +143,7 @@ class WC_Huayi_Score extends WC_Payment_Gateway {
}
if ($balanceResult['data']['score'] >= $order->order_total ) {//积分够扣
$payResult = $huayiScoreSdk->pay($huayi_uid,$order->order_total,get_bloginfo('name').'订单号:'.$order_id);//执行扣款
$payResult = $huayiScoreSdk->pay($huayi_uid, $order_id, $order->order_total,get_bloginfo('name').'订单号:'.$order_id);//执行扣款
if (!$payResult) {
wc_add_notice( __('结算失败:', 'huayi_score') . $huayiScoreSdk->getError(), 'error' );
return;

View File

@ -55,16 +55,18 @@ class HuayiScoreSdk
* PASS
* 支出积分
* @param $huayi_uid
* @param $order_id
* @param $amount
* @param $note
* @return bool
*/
public function pay($huayi_uid, $amount, $note)
public function pay($huayi_uid, $order_id, $amount, $note)
{
$url = $this->apiurl.$this->pay_url;
$data = [
'uid'=>$huayi_uid,
'out_trade_no'=>$order_id,
'amount'=>$amount,
'note'=>$note,
'timestamp'=>time()