fix: add payment transaction id verification to avoid redundant transaction with same ID
This commit is contained in:
parent
653d3ce9e0
commit
ca4c931d10
|
@ -232,8 +232,18 @@ class iLinkTransactionController extends Controller
|
|||
|
||||
|
||||
$data = $request->all();
|
||||
if (isset($request->cvv) && !is_numeric($request->cvv))
|
||||
if (isset($request->cvv) && !is_numeric($request->cvv)){
|
||||
return $this->errorResponse('errors.invalid_cvv');
|
||||
}
|
||||
|
||||
// Verify transaction id
|
||||
$transaction_id = $request->input('payment_transaction_id');
|
||||
if (!empty($transaction_id)) {
|
||||
if ( WalletIlinkTransaction::where('payment_transaction_id', $transaction_id)->exists()) {
|
||||
return $this->errorResponse(trans('errors.payment_invalid'), 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$transaction->fill($data);
|
||||
|
||||
|
|
|
@ -88,5 +88,6 @@ Paying network : :network :country',
|
|||
"amount_not_allowed" => "This amount is not allowed. It must be between :min and :max",
|
||||
"transaction_already_completed" => "This transaction has already been completed",
|
||||
'paying_network_api_failed' => "Request to API paying network failed",
|
||||
'transaction_not_supported' => "This transaction is not supported"
|
||||
'transaction_not_supported' => "This transaction is not supported",
|
||||
'payment_invalid' => "Invalid payment"
|
||||
];
|
||||
|
|
|
@ -88,5 +88,6 @@ Réseau payeur : :network :country',
|
|||
"amount_not_allowed" => "Ce montant n'est pas autorisé. Il doit être compris entre :min et :max",
|
||||
"transaction_already_completed" => "Cette transaction a déjà été éffectuée",
|
||||
'paying_network_api_failed' => "La requête vers l'API du réseau payeur a échouée",
|
||||
'transaction_not_supported' => "Cette transaction n'est pas supportée"
|
||||
'transaction_not_supported' => "Cette transaction n'est pas supportée",
|
||||
'payment_invalid' => "Paiement invalide"
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue