|
|
|
|
@ -54,18 +54,18 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
$save_column['OPN_orderId'] = $xml_arr['out_trade_no'];
|
|
|
|
|
$save_column['OPN_rawOrderId'] = $xml_arr['out_trade_no'];
|
|
|
|
|
$save_column['OPN_invoiceId'] = $xml_arr['out_trade_no'];
|
|
|
|
|
$save_column['OPN_subject'] = $xml_arr['attach'] ? $xml_arr['attach'] : '';
|
|
|
|
|
$save_column['OPN_subject'] = isset($xml_arr['attach']) ? $xml_arr['attach'] : '';
|
|
|
|
|
$save_column['OPN_currency'] = $xml_arr['fee_type'];
|
|
|
|
|
$save_column['OPN_orderAmount'] = $xml_arr['total_fee'];
|
|
|
|
|
$save_column['OPN_payAmount'] = $xml_arr['total_fee'];
|
|
|
|
|
$save_column['OPN_transactionResult'] = 'completed';
|
|
|
|
|
$save_column['OPN_resultCode'] = $xml_arr['result_code'];
|
|
|
|
|
$save_column['OPN_resultMsg'] = isset($xml_arr['return_msg']) ? $xml_arr['return_msg'] : $xml_arr['result_code'];
|
|
|
|
|
$save_column['OPN_resultMsg'] = isset($xml_arr['trade_type']) ? $xml_arr['trade_type'] : $xml_arr['result_code'];
|
|
|
|
|
$save_column['OPN_errCode'] = isset($xml_arr['err_code']) ? $xml_arr['err_code'] : NULL;
|
|
|
|
|
$save_column['OPN_errMsg'] = isset($xml_arr['err_code_des']) ? $xml_arr['err_code_des'] : NULL;
|
|
|
|
|
$save_column['OPN_acquiringTime'] = date('Y-m-d H:i:s',strtotime($xml_arr['time_end']));
|
|
|
|
|
$save_column['OPN_completeTime'] = date('Y-m-d H:i:s',strtotime($xml_arr['time_end']));
|
|
|
|
|
$save_column['OPN_remark'] = $xml_arr['attach'] ? $xml_arr['attach'] : '';
|
|
|
|
|
$save_column['OPN_remark'] = isset($xml_arr['attach']) ? $xml_arr['attach'] : '';
|
|
|
|
|
$save_column['OPN_payerLogId'] = $xml_arr['openid'];
|
|
|
|
|
$save_column['OPN_payerStatus'] = $xml_arr['is_subscribe']==='Y' ? "subscribed" : NULL;
|
|
|
|
|
$save_column['OPN_fundSource'] = $site;
|
|
|
|
|
@ -97,7 +97,7 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
async_curl('https://www.mycht.cn/webht.php/apps/pay/alipaytradeservice/get_billfile');
|
|
|
|
|
// async_curl('https://www.mycht.cn/download_statement/download_files.php', 30); // iPaylinks日账单
|
|
|
|
|
// 检查PayPal的额度
|
|
|
|
|
async_get('https://www.mycht.cn/webht.php/apps/pay/paymentservice/check_paypal_limit');
|
|
|
|
|
async_curl('https://www.mycht.cn/webht.php/apps/pay/paymentservice/check_paypal_limit');
|
|
|
|
|
/**
|
|
|
|
|
* 每月20号发送退款给财务
|
|
|
|
|
*/
|
|
|
|
|
@ -108,7 +108,7 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
* 每月2号: 检查PayPal的费率
|
|
|
|
|
*/
|
|
|
|
|
if (date('d')==='2') {
|
|
|
|
|
async_get('https://www.mycht.cn/webht.php/apps/pay/paymentservice/check_paypal_rate');
|
|
|
|
|
async_curl('https://www.mycht.cn/webht.php/apps/pay/paymentservice/check_paypal_rate');
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -134,17 +134,20 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
$save_column['OPN_accountMethod'] = $this->config->item('method_code', 'wxpay');
|
|
|
|
|
if ($row['refund_id'] != '0') {
|
|
|
|
|
// 退款
|
|
|
|
|
$ssje = $this->account_model->get_ssje($row['settlement_refund_fee'], str_replace("CNY", "RMB", strtoupper($row['currency_type'])), $save_column['OPN_accountMethod']);
|
|
|
|
|
$save_column['OPN_transactionId'] = $row['refund_id'];
|
|
|
|
|
$save_column['OPN_orderAmount'] = "-" . $row['settlement_refund_fee'];
|
|
|
|
|
$save_column['OPN_payAmount'] = "-" . $row['settlement_refund_fee'];
|
|
|
|
|
// $save_column['OPN_payFee'] = bcsub(0, $row['wxpay_fee']);
|
|
|
|
|
// $save_column['OPN_netAmount'] = "-" . bcadd($row['call_refund_fee'], $row['wxpay_fee']);
|
|
|
|
|
$save_column['OPN_payFee'] = bcsub(0, $row['wxpay_fee']);
|
|
|
|
|
$save_column['OPN_netAmount'] = "-" . bcadd(($row['call_refund_fee']), $row['wxpay_fee']);
|
|
|
|
|
$save_column['OPN_resultCode'] = $row['refund_status'];
|
|
|
|
|
$save_column['OPN_resultMsg'] = $row['refund_status'];
|
|
|
|
|
$save_column['OPN_entryAmountCNY'] = floatval("-" . $ssje);
|
|
|
|
|
$save_column['OPN_resultMsg'] = $row['trade_type'];
|
|
|
|
|
|
|
|
|
|
$ssje = $this->account_model->get_ssje_exclude_fee($save_column['OPN_netAmount'], str_replace("CNY", "RMB", strtoupper($row['currency_type'])));
|
|
|
|
|
$save_column['OPN_entryAmountCNY'] = floatval($ssje); // $save_column['OPN_netAmount'];
|
|
|
|
|
|
|
|
|
|
$save_column['OPN_noticeType'] = 'refund';
|
|
|
|
|
$save_column['OPN_relatedId'] = $row['transaction_id'];
|
|
|
|
|
$save_column['OPN_transactionResult'] = $row['refund_status'] === 'SUCCESS' ? 'completed' : strtolower($row['refund_status']);
|
|
|
|
|
} else {
|
|
|
|
|
// 收款
|
|
|
|
|
$save_column['OPN_payFee'] = bcsub(0, $row['wxpay_fee']);
|
|
|
|
|
@ -156,14 +159,14 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
$save_column['OPN_orderAmount'] = $row['settlement_total_fee'];
|
|
|
|
|
$save_column['OPN_payAmount'] = $row['settlement_total_fee'];
|
|
|
|
|
$save_column['OPN_resultCode'] = $row['trade_state'];
|
|
|
|
|
$save_column['OPN_resultMsg'] = $row['trade_state'];
|
|
|
|
|
$save_column['OPN_resultMsg'] = $row['trade_type'];
|
|
|
|
|
$save_column['OPN_entryAmountCNY'] = floatval($ssje);
|
|
|
|
|
$save_column['OPN_noticeType'] = 'pay';
|
|
|
|
|
$save_column['OPN_relatedId'] = '';
|
|
|
|
|
$save_column['OPN_paymentSource'] = $row['bank_type'];
|
|
|
|
|
$save_column['OPN_transactionResult'] = 'completed';
|
|
|
|
|
}
|
|
|
|
|
$save_column['OPN_noticeSendStatus'] = 'unsend';
|
|
|
|
|
$save_column['OPN_transactionResult'] = 'completed';
|
|
|
|
|
$save_column['OPN_orderId'] = $row['out_trade_no'];
|
|
|
|
|
$save_column['OPN_rawOrderId'] = $row['out_trade_no'];
|
|
|
|
|
$save_column['OPN_invoiceId'] = $row['out_trade_no'];
|
|
|
|
|
@ -177,7 +180,7 @@ class WxpayService extends CI_Controller {
|
|
|
|
|
$save_column['OPN_rawContent'] = json_encode($row);
|
|
|
|
|
$save_column['OPN_noticeTime'] = date('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
|
|
$this->note_model->insert_note($save_column);
|
|
|
|
|
$this->note_model->insert_note($save_column, true);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|