Browse Source

调整退款接口

master
lanzu_qinsheng 6 years ago
parent
commit
1c411c3a8e
  1. 19
      app/JsonRpc/OrderService.php
  2. 8
      app/Service/v3/Implementations/PaymentService.php

19
app/JsonRpc/OrderService.php

@ -78,33 +78,22 @@ class OrderService implements OrderServiceInterface
*/ */
public function onlineRefund($global_order_id, $user_id) public function onlineRefund($global_order_id, $user_id)
{ {
Db::beginTransaction();
try { try {
$result = $this->orderOnlineService->doRefund($global_order_id, $user_id);
Db::commit();
if ($result['return_code'] == 'SUCCESS' && isset($result['result_code']) && $result['result_code'] == "SUCCESS") {
$this->orderOnlineService->doRefund($global_order_id, $user_id);
return [ return [
"status" => 200, "status" => 200,
"code" => 0, "code" => 0,
"result" => [], "result" => [],
"message" => '处理成功' "message" => '处理成功'
]; ];
} else {
} catch (\Exception $e) {
return [ return [
"status" => 200, "status" => 200,
"code" => -1,
"code" => $e->getCode(),
"result" => [], "result" => [],
"message" => $result['err_code_des']
"message" => $e->getMessage()
]; ];
} }
} catch (\Exception $e) {
Db::rollBack();
$this->log->event(LogLabel::ORDER_REFUND_LOG, ['jsonrpc_order_service_exception_onlineRefund' => $e->getMessage(), 'params' => json([$global_order_id, $user_id])]);
throw new ErrorCodeException(ErrorCode::ORDER_REFUND_FAIL);
}
} }

8
app/Service/v3/Implementations/PaymentService.php

@ -127,6 +127,14 @@ class PaymentService implements PaymentServiceInterface
'notify_url' => config('wechat.notify_url.refund'), 'notify_url' => config('wechat.notify_url.refund'),
] ]
); );
if ($result['return_code'] == 'SUCCESS' && isset($result['result_code']) && $result['result_code'] == "SUCCESS") {
return true;
} else {
throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL);
}
return $result; return $result;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]); $this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]);

Loading…
Cancel
Save