Update PaymentMethod.php

updated to not use token id integer but decrypt it

Signed-off-by: Kendall Arneaud <kendall.arneaud@gmail.com>
This commit is contained in:
Kendall Arneaud 2024-07-27 11:42:24 -04:00 committed by GitHub
parent 8e1706cd7b
commit 608718eae3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,14 +145,13 @@ class PaymentMethod implements MethodInterface
$request->validate([ $request->validate([
'source' => ['required','string','exists:client_gateway_tokens,token'], 'source' => ['required','string','exists:client_gateway_tokens,token'],
'amount' => ['required','numeric'], 'amount' => ['required','numeric'],
'token_id' => ['required','integer','exists:client_gateway_tokens,id'],
'process_date'=> ['required','date','after_or_equal:today'], 'process_date'=> ['required','date','after_or_equal:today'],
]); ]);
$customer = ClientGatewayToken::query() $customer = ClientGatewayToken::query()
->where('company_gateway_id', $this->rotessa->company_gateway->id) ->where('company_gateway_id', $this->rotessa->company_gateway->id)
->where('client_id', $this->rotessa->client->id) ->where('client_id', $this->rotessa->client->id)
->where('id', (int) $request->input('token_id'))
->where('token', $request->input('source')) ->where('token', $request->input('source'))
->where('id', $this->decodePrimaryKey($request->input('source')))
->first(); ->first();
if(!$customer) throw new \Exception('Client gateway token not found!', 605); if(!$customer) throw new \Exception('Client gateway token not found!', 605);