public static function EGOP_transaction_callback() { // /* for debug Core::write_log("/tmp/callback_EGOP.txt", __FUNCTION__ . ' : First POST : ' . print_r($_POST, true)); reset($_POST); // */ $amount = Core::validate($_POST['fAmount']); $currency_name = Core::validate($_POST['sCurrency']); $at_id = Core::validate($_POST['cf_1']); $currency = new Currency(); if (!$currency->findBy(array('Name' => $currency_name))) { exit; } $at = new AtEgop(); $exist = $at->findBy(array('id' => $at_id, 'amount' => $amount, 'currency_id' => $currency->getId(), 'type' => 1, 'status' => 0)); if (!$exist) { exit; } $wallet = new WalletsEgop(); $wallet->findById($at->getOurWalletId()); try { $oEgopay = new EgoPaySciCallback(array('store_id' => $wallet->getStoreId(), 'store_password' => $wallet->getStorePassword(), 'checksum_key' => $wallet->getChecksumKey(), 'verify_peer' => false)); $aResponse = $oEgopay->getResponse($_POST); $status = $aResponse['sStatus']; if ($status == 'Completed') { $limits = self::transactionLimits($currency->getId(), 'EGOP', 0); if ($amount < $limits['min'] || $limits['max'] != null && $amount > $limits['max']) { Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' Error : Incorrect amount (limits are not complied) : ' . $amount); return; } $feeVolume = $amount * $limits['fee']; $feeVolume = Core::round_up($feeVolume, 2); $purseList = Purse::findBy(array('UID' => $at->getUID(), 'CurId' => $currency->getId())); $purse = new Purse(); $purse->findById($purseList[0]['id']); $purse->addValue($amount - $feeVolume); $purse->save(); $profit = $feeVolume * $wallet->getShare(); $wallet->setProfit($wallet->getProfit() + $profit); $wallet->save(); $at->setStatus(1); $at->setTransactionId($aResponse['sId']); $at->setClientAccount($aResponse['sEmail']); $at->save(); } else { if ($status == 'Cancelled') { $at->delete(); } else { if ($status == 'TEST SUCCESS') { Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' : TEST SUCCESS POST : ' . print_r($_POST, true)); } } } } catch (EgoPayException $e) { Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' Exception : ' . $e->getCode() . " : " . $e->getMessage()); } }
<?php ### Copyright 2012 SABRINA MARKON PearlsOfWealth.com Sunshinehosting.net EGOPAY CALLBACK SYSTEM. Copying without license from Sabrina Markon (50.00 one time per cpanel account fully installed) ### is prohibited. ### Theft of my work will result in your host and their data center warehouse receiving a DHMC takedown notice for any content and/or a careless remote removal of stolen material (I do not need cpanel ### access to messily delete and hack my own work someone has stolen, obviously) include "db.php"; require 'EgoPaySci.php'; $oEgopay = new EgoPaySciCallback(array('store_id' => $store_id, 'store_password' => $store_password)); $aResponse = $oEgopay->getResponse($_POST); $sId = $aResponse["sId"]; $sDate = $aResponse["sDate"]; $fAmount = $aResponse["fAmount"]; $sCurrency = $aResponse["sCurrency"]; $fFee = $aResponse["fFee"]; $sType = $aResponse["sType"]; $iTypeId = $aResponse["iTypeId"]; $sEmail = $aResponse["sEmail"]; $sDetails = $aResponse["sDetails"]; $sStatus = $aResponse["sStatus"]; $cf_1 = $aResponse["cf_1"]; $cf_2 = $aResponse["cf_2"]; $cf_3 = $aResponse["cf_3"]; $cf_4 = $aResponse["cf_4"]; if ($sStatus == "Completed" or $sStatus == "TEST SUCCESS") { $userid = $cf_1; $item = $cf_2; $amount = $fAmount; $txn_id = $sId; $query = "select * from members where userid='" . $userid . "'"; $result = mysql_query($query) or die(mysql_error());