|
|
|
@ -37,11 +37,18 @@ class PaymentService extends AbstractService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['payType'] = $data['payType'] ?? 'CARD';
|
|
|
|
|
[$order, $orderSplitInfos] = $this->createOrder($app, $data, $user, 'paymentSplit');
|
|
|
|
|
$payMethod = $data['payMethod'] ?? 'paymentSplit';
|
|
|
|
|
[$order, $orderSplitInfos] = $this->createOrder($app, $data, $user, $payMethod);
|
|
|
|
|
|
|
|
|
|
$splitInfoList = $this->buildSplitInfoList($orderSplitInfos);
|
|
|
|
|
|
|
|
|
|
if ($payMethod == 'paymentSplit') {
|
|
|
|
|
return $this->paymentSplit($order, $user, $splitInfoList, $token);
|
|
|
|
|
} elseif($payMethod == 'unionPay') {
|
|
|
|
|
return $this->unionPay($order, $user, $splitInfoList, $token);
|
|
|
|
|
} else {
|
|
|
|
|
throw new BusinessException('payMethod不支持');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function transferPay(array $data, App $app, string $token)
|
|
|
|
@ -254,17 +261,17 @@ class PaymentService extends AbstractService
|
|
|
|
|
return [$order, $orderSplitInfos];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateOrder($params) {
|
|
|
|
|
$order = Order::where('order_no', $params['order_no'])->where('status', 'APPLY_SUCCESS')->first();
|
|
|
|
|
public function updateOrder($params, $status = 'APPLY_SUCCESS') {
|
|
|
|
|
$order = Order::where('order_no', $params['order_no'])->where('status', $status)->first();
|
|
|
|
|
if (empty($order)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
$order->third_order_no = $params['third_order_no'];
|
|
|
|
|
$order->status = $params['status'];
|
|
|
|
|
$order->finished_at = date('Y-m-d H:i:s', strtotime($params['finished_at']));
|
|
|
|
|
$order->error_message = $params['error_message'];
|
|
|
|
|
$order->transaction_id = $params['transaction_id'];
|
|
|
|
|
$order->out_transaction_id = $params['out_transaction_id'];
|
|
|
|
|
$order->error_message = $params['error_message'] ?? '';
|
|
|
|
|
$order->transaction_id = $params['transaction_id'] ?? '';
|
|
|
|
|
$order->out_transaction_id = $params['out_transaction_id'] ?? '';
|
|
|
|
|
$order->save();
|
|
|
|
|
return $order;
|
|
|
|
|
}
|
|
|
|
@ -452,7 +459,6 @@ class PaymentService extends AbstractService
|
|
|
|
|
'assureConfirmSplitInfoList' => $confirmSplitInfoList,
|
|
|
|
|
'outOrderNo' => StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_CONFIRM_PAY),
|
|
|
|
|
'amount' => $data['amount'],
|
|
|
|
|
'notifyUrl' => $data['notifyUrl'],
|
|
|
|
|
], $token);
|
|
|
|
|
$order->status = 'CONFIRM_SUCCESS';
|
|
|
|
|
$order->save();
|
|
|
|
|