Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
NafezlyDotCom committed Aug 7, 2023
1 parent c306f66 commit 646d5dd
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/Classes/PerfectMoneyPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,18 @@ public function pay($amount = null, $user_id = null, $user_first_name = null, $u
*/
public function verify(Request $request)
{


$paymentId = $request['PAYMENT_ID'];
$payeeAccount = $request['PAYEE_ACCOUNT'];
$paymentAmount = $request['PAYMENT_AMOUNT'];
$paymentUnits = $request['PAYMENT_UNITS'];
$paymentBatchNum = $request['PAYMENT_BATCH_NUM'];
$payerAccount = $request['PAYER_ACCOUNT'];
$passphrase = $this->perfect_money_passphrase; // Replace with your Perfect Money account passphrase

$hash = strtoupper(md5($paymentId . ':' . $payeeAccount . ':' . $paymentAmount . ':' . $paymentUnits . ':' . $paymentBatchNum . ':' . $payerAccount . ':' . strtoupper(md5($passphrase))));

$receivedHash = $request['V2_HASH'];

if ($receivedHash === $hash) {
$signature = (isset($request['PAYMENT_ID']) ? $request['PAYMENT_ID'] : null) . ':'
. (isset($request['PAYEE_ACCOUNT']) ? $request['PAYEE_ACCOUNT'] : null) . ':'
. (isset($request['PAYMENT_AMOUNT']) ? $request['PAYMENT_AMOUNT'] : null) . ':'
. (isset($request['PAYMENT_UNITS']) ? $request['PAYMENT_UNITS'] : null) . ':'
. (isset($request['PAYMENT_BATCH_NUM']) ? $request['PAYMENT_BATCH_NUM'] : null) . ':'
. (isset($request['PAYER_ACCOUNT']) ? $request['PAYER_ACCOUNT'] : null) . ':'
. strtoupper(md5($this->perfect_money_passphrase)) . ':'
. (isset($request['TIMESTAMPGMT']) ? $request['TIMESTAMPGMT'] : null);

$v2_hash = strtoupper(md5($signature));

if ($v2_hash === $request['V2_HASH'] ) {
return [
'success' => true,
'payment_id'=>$paymentId,
Expand Down

0 comments on commit 646d5dd

Please sign in to comment.