添加支付费率扣除
This commit is contained in:
@@ -148,6 +148,7 @@ class OrderService
|
||||
'promoter_id' => PromotionService::getPromoterId(intval($userId)),
|
||||
];
|
||||
$orderData['parent_order_no'] = $orderData['order_no'];
|
||||
VirtualPayService::rememberPayPlatform($orderData['order_no'], $requestData['payPlatform'] ?? '');
|
||||
$existed = OrderService::getOne(['order_no' => $orderData['order_no']]);
|
||||
if (!$existed) {
|
||||
//创建订单及订单商品
|
||||
@@ -290,6 +291,7 @@ class OrderService
|
||||
throw new \Exception('该订单不存在');
|
||||
}
|
||||
$orderData = $orderInfo->toArray();
|
||||
VirtualPayService::rememberPayPlatform($orderNo, $requestData['payPlatform'] ?? '');
|
||||
Log::info('微信下单[发起支付] ' . json_encode([
|
||||
'order_no' => $orderNo,
|
||||
'user_id' => $userId,
|
||||
@@ -516,14 +518,22 @@ class OrderService
|
||||
* @param string $payWay
|
||||
* @param int $paidTime
|
||||
* @param string $traceId
|
||||
* @param string $payPlatform android|ios,空则用下单时记下的终端
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function finishPaid($orderNo, $amountFen, $transactionId, $payWay, $paidTime, $traceId = '')
|
||||
public static function finishPaid($orderNo, $amountFen, $transactionId, $payWay, $paidTime, $traceId = '', $payPlatform = '')
|
||||
{
|
||||
$payPlatform = VirtualPayService::normalizePayPlatform($payPlatform);
|
||||
if ($payPlatform === '') {
|
||||
$payPlatform = VirtualPayService::payPlatformOf($orderNo);
|
||||
}
|
||||
if ($payPlatform === '') {
|
||||
$payPlatform = 'android';
|
||||
}
|
||||
$prefix = '订单支付入账 trace=' . $traceId . ' ';
|
||||
try {
|
||||
Db::transaction(function () use ($orderNo, $amountFen, $transactionId, $payWay, $paidTime, $prefix) {
|
||||
Db::transaction(function () use ($orderNo, $amountFen, $transactionId, $payWay, $paidTime, $prefix, $payPlatform) {
|
||||
$orderInfo = self::where('order_no', $orderNo)->lock(true)->find();
|
||||
if (!$orderInfo) {
|
||||
Log::error($prefix . '订单不存在: ' . $orderNo);
|
||||
@@ -551,6 +561,7 @@ class OrderService
|
||||
'currency' => 'CNY',
|
||||
'pay_type' => '1',
|
||||
'pay_way' => $payWay ?: 'XPAY',
|
||||
'pay_platform' => $payPlatform,
|
||||
'trace_no' => $transactionId,
|
||||
'pay_time' => time(),
|
||||
'pay_success_time' => $paidTime > 0 ? $paidTime : time(),
|
||||
@@ -615,8 +626,9 @@ class OrderService
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function confirmVirtualPay($orderNo, $userId)
|
||||
public static function confirmVirtualPay($orderNo, $userId, $payPlatform = '')
|
||||
{
|
||||
VirtualPayService::rememberPayPlatform($orderNo, $payPlatform);
|
||||
$order = self::getOne(['order_no' => $orderNo, 'user_id' => $userId]);
|
||||
if (!$order) {
|
||||
throw new \Exception('订单不存在');
|
||||
|
||||
Reference in New Issue
Block a user