Showing
3 changed files
with
11 additions
and
9 deletions
| ... | @@ -44,17 +44,14 @@ class PayController extends Controller | ... | @@ -44,17 +44,14 @@ class PayController extends Controller |
| 44 | $pay_type = $request->post('pay_type'); | 44 | $pay_type = $request->post('pay_type'); |
| 45 | $token = $request->post('token'); | 45 | $token = $request->post('token'); |
| 46 | 46 | ||
| 47 | - Log::debug("========苹果客户端支付验证========"); | 47 | + $order = Order::query()->where('order_sn', $order_sn)->first(); |
| 48 | - Log::debug(print_r($request->all(),true)); | 48 | + |
| 49 | + if ($order->status != Order::UNPAID) return Response::fail('订单错误!'); | ||
| 49 | 50 | ||
| 50 | -// $order = Order::query()->where('order_sn', $order_sn)->first(); | 51 | + $payment = $factory->init($pay_type)->verify($order, $token); |
| 51 | -// | ||
| 52 | -// if ($order->status != Order::UNPAID) return Response::fail('订单错误!'); | ||
| 53 | 52 | ||
| 54 | -// $payment = $factory->init($pay_type)->notify($order_sn, $token); | 53 | + if ($payment) return Response::success(['order_sn' => $order_sn], '支付成功'); |
| 55 | -// | 54 | + else return Response::fail('订单错误!'); |
| 56 | -// if ($payment) return Response::success(['order_sn' => $order_sn], '支付成功'); | ||
| 57 | -// else return Response::fail('订单错误!'); | ||
| 58 | } | 55 | } |
| 59 | 56 | ||
| 60 | /** | 57 | /** | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -52,6 +52,11 @@ class GooglePayment implements PaymentInterface | ... | @@ -52,6 +52,11 @@ class GooglePayment implements PaymentInterface |
| 52 | // 查询订单对应的产品id | 52 | // 查询订单对应的产品id |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | + public function verify(Order $order, $token) | ||
| 56 | + { | ||
| 57 | + return true; | ||
| 58 | + } | ||
| 59 | + | ||
| 55 | private function getGoogleClient() | 60 | private function getGoogleClient() |
| 56 | { | 61 | { |
| 57 | $credentials_file = public_path().'/pc-api-7482901338487549764-603-566eccf76b91.json'; | 62 | $credentials_file = public_path().'/pc-api-7482901338487549764-603-566eccf76b91.json'; | ... | ... |
-
Please register or login to post a comment