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