fix: add aggregator while payIn

This commit is contained in:
Djery-Tom 2023-08-01 07:15:48 +01:00
parent 03940b4a85
commit 94cb623d4f
2 changed files with 11 additions and 8 deletions

View File

@ -79,7 +79,7 @@ class CinetpayController extends Controller
public function pay(Request $request) public function pay(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'aggregator_id' => 'required|integer', // 'aggregator_id' => 'required|integer',
'amount' => 'required|numeric|min:5', 'amount' => 'required|numeric|min:5',
'currency' => 'required|string|size:3', 'currency' => 'required|string|size:3',
// 'payment_method' => 'nullable|string|in:ALL,MOBILE_MONEY,CREDIT_CARD,WALLET', // 'payment_method' => 'nullable|string|in:ALL,MOBILE_MONEY,CREDIT_CARD,WALLET',
@ -96,6 +96,8 @@ class CinetpayController extends Controller
'reason' => 'required|string' 'reason' => 'required|string'
]); ]);
$aggregator = PaymentAggregator::where('name','like','%cinetpay%')->firstOrFail();
$transaction_id = $this->getTransactionID(); $transaction_id = $this->getTransactionID();
$payment_method = 'ALL'; $payment_method = 'ALL';
$amount = $request->input('amount'); $amount = $request->input('amount');
@ -140,7 +142,7 @@ class CinetpayController extends Controller
if ($responseCode == 200) { if ($responseCode == 200) {
PaymentTransaction::create([ PaymentTransaction::create([
'aggregator_id' => $request->input('aggregator_id'), 'aggregator_id' => $aggregator->id,
"currency" => $request->input('currency'), "currency" => $request->input('currency'),
"transaction_id" => $transaction_id, "transaction_id" => $transaction_id,
"amount" => $amount, "amount" => $amount,

View File

@ -45,15 +45,16 @@ class PaymentController extends Controller
if($payment_method == PaymentMethod::CARD){ if($payment_method == PaymentMethod::CARD){
$aggregator = PaymentAggregator::where('name','like','%stripe%')->firstOrFail(); $aggregator = PaymentAggregator::where('name','like','%stripe%')->firstOrFail();
}else{
$aggregator = PaymentAggregator::where('status',1)->firstOrFail();
}
$data = $request->all(); $data = $request->all();
$request = new Request(); $request = new Request();
$request->merge(array_merge($data,[ $request->merge(array_merge($data,[
'payment_method' => PaymentMethod::CARD,
'aggregator_id' => $aggregator->id 'aggregator_id' => $aggregator->id
])); ]));
}else{
$aggregator = PaymentAggregator::where('status',1)->firstOrFail();
}
switch (strtolower($aggregator->name)) { switch (strtolower($aggregator->name)) {
case 'yoomee': case 'yoomee':