Add paymentResult redirection after capture payment
This commit is contained in:
parent
6540a42d0d
commit
3bcdcc5c61
|
@ -215,12 +215,16 @@ class CinetpayController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if($transaction->state == PaymentTransactionState::ACCEPTED){
|
if($transaction->state == PaymentTransactionState::ACCEPTED){
|
||||||
return $this->successResponse([
|
return redirect()->route('paymentResult',[
|
||||||
'transaction_id' => $transaction->transaction_id,
|
'transaction_id' => $transaction->transaction_id,
|
||||||
'token' => $transaction->payment_token
|
'token' => $transaction->payment_token,
|
||||||
|
'status' => 1
|
||||||
]);
|
]);
|
||||||
}else{
|
}else{
|
||||||
return $this->errorResponse("Payment failed");
|
return redirect()->route('paymentResult',[
|
||||||
|
'message' => "Payment failed",
|
||||||
|
'status' => 0
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,4 +59,13 @@ class PaymentController extends Controller
|
||||||
return $this->errorResponse(__('errors.unexpected_error'));
|
return $this->errorResponse(__('errors.unexpected_error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentResult(Request $request)
|
||||||
|
{
|
||||||
|
if($request->has('token')){
|
||||||
|
return $this->successResponse($request->all());
|
||||||
|
}else{
|
||||||
|
return $this->errorResponse($request->all());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
$router->addRoute(['GET','POST'],'/yoomee/v2/webhook', ['as' => 'yoomee.v2.webhook' , 'uses' => 'YoomeeV2Controller@capturePaymentResult']);
|
$router->addRoute(['GET','POST'],'/yoomee/v2/webhook', ['as' => 'yoomee.v2.webhook' , 'uses' => 'YoomeeV2Controller@capturePaymentResult']);
|
||||||
$router->addRoute(['GET','POST'],'/cinetpay/webhook', ['as' => 'cinetpay.webhook' , 'uses' => 'CinetpayController@capturePaymentResult']);
|
$router->addRoute(['GET','POST'],'/cinetpay/webhook', ['as' => 'cinetpay.webhook' , 'uses' => 'CinetpayController@capturePaymentResult']);
|
||||||
|
|
||||||
|
$router->addRoute(['GET','POST'],'/paymentResult', ['as' => 'paymentResult' , 'uses' => 'PaymentController@paymentResult']);
|
||||||
|
|
||||||
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue