| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Http\logic\api\AegPayCashierLogic;
- use App\Http\logic\api\AegPayLogic;
- use App\Http\logic\api\NicePayCashierLogic;
- use App\Http\logic\api\NicePayLogic;
- use App\Inter\PayMentInterFace;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Log;
- class AegPayController implements PayMentInterFace
- {
- public function pay_order($userId, $payAmt, $userName, $userEmail, $userPhone, $GiftsID, $buyIp, $AdId, $eventType, $pay_method = '')
- {
- $logic = new AegPayLogic();
- $res = $logic->pay_order($userId, $payAmt, $userPhone, $userEmail, $userName, $GiftsID, $buyIp, $AdId, $eventType);
- if ($res === false) {
- return apiReturnFail($logic->getError());
- }
- //{"status":200,"response":
- //{"orderId":"bd03a92f-7c77-4c76-9bac-842c84127e39",
- //"redirectUrl":"https://www.aegpay.tech/checkout/sfp/bd03a92f-7c77-4c76-9bac-842c84127e39/enter-cpf"}}
- if (!empty($res)) {
- $data = [
- 'content' => urldecode($res['code']),
- 'money' => $payAmt,
- 'url'=>$res['payUrl'],
- 'prdOrdNo' => $res['orderNo'],
- ];
- return apiReturnSuc($data);
- }else{
- return 'Erro de pagamento.';
- }
- }
- // 支付异步回调
- public function notify(Request $request)
- {
- $post = $request->all();
- if (!is_array($post)) {
- $post = \GuzzleHttp\json_decode($post, true);
- }
- Log::channel('aegPay')->info('aegPay支付异步回调'.json_encode($post));
- $logic = new AegPayLogic();
- return $logic->notify($post['response']);
- }
-
- // 提现异步回调
- public function cash_notify(Request $request)
- {
- $post = $request->all();
- if (!is_array($post)) {
- $post = \GuzzleHttp\json_decode($post, true);
- }
- Log::channel('aegPay')->info('aegPay提现异步回调'.json_encode($post));
- $logic = new AegPayCashierLogic();
- return $logic->notify($post['response']);
- }
- }
|