static function reconcileAllPaymentUids() { $txn = new paypal_transaction(); $extraWhere = "bp_biobounce_uid ='0'"; while ($txn->loadNext($extraWhere)) { $found = false; $email = $txn->get_variable('bp_paypal_email'); $paypalid = $txn->get_variable('bp_paypal_payer_id'); $txnFind = new paypal_transaction(); $extraWhere2 = "bp_biobounce_uid<>'0' AND bp_paypal_payer_id='" . $paypalid . "'"; if ($txnFind->load($extraWhere2)) { $bioId = $txnFind->get_variable('bp_biobounce_uid'); $found = true; //echo "\n\nFOUND THE USER ID BASED ON PREVIOUSLY BEING SET:PAYPALID=" . $paypalid; } else { $usr = new user(); $usr->set_variable('users_email', $email); if ($usr->load()) { $bioId = $usr->get_variable('users_id'); $found = true; //echo "\nFOUND THE USER ID BASED ON SAME EMAIL ADDRESS:ADDRESS=" . $email; } } if ($found) { $txnId = $txn->get_variable('bp_id'); //echo "\nUPDATING TRANSACTION NUMBER=" . $txnId . " to use UID=" . $bioId; $txn->set_variable('bp_biobounce_uid', $bioId); $txn->update(); } } }
public static function getPaypalEmail($uid) { $paypalFind = new paypal_transaction(); $paypalFind->set_variable('bp_biobounce_uid', $uid); if (!$paypalFind->load()) { return ""; } return $paypalFind->get_variable("bp_paypal_email"); }
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); if (!($res = curl_exec($ch))) { curl_close($ch); exit; } curl_close($ch); $debugString = "\nRECEIVED: " . print_r($raw_post_array, true); // if (strcmp ($res, "VERIFIED") == 0) { // Assign payment notification values to local variables $paypalTxn = new paypal_transaction(); $recordTxn = false; // check to make sure we didn't already record this transaction if (!empty($_POST['txn_id'])) { $paypalTxn->set_variable('bp_paypal_txn_id', $_POST['txn_id']); if ($paypalTxn->load()) { $recordTxn = false; $debugString .= "\nTransaction already recorded\n"; } else { $recordTxn = true; } } if ($recordTxn) { $paypalTxn->set_variable('bp_biobounce_uid', $_POST['custom']); $paypalTxn->set_variable('bp_paypal_payer_id', $_POST['payer_id']); $paypalTxn->set_variable('bp_paypal_txn_id', $_POST['txn_id']);
$date = $referrals->get_variable("referral_date"); $isPaid = $referrals->get_variable("referral_paid"); $expireInfo = user::getUserExpirationDate($uid); $newExpireInfo = user::getUserExpirationDate($newUid); $user = new user(); $user->set_variable("users_id", $uid); if (!$user->load()) { continue; } $newUser = new user(); $newUser->set_variable("users_id", $newUid); if (!$newUser->load()) { continue; } $userPaypalId = paypal_transaction::getPaypalEmail($uid); $newUserPaypalId = paypal_transaction::getPaypalEmail($newUid); $listInfo['rid'] = $rid; $listInfo['rb_uid'] = $uid; $listInfo['rb_username'] = $user->get_variable("users_username"); $listInfo['rb_useremail'] = $user->get_variable("users_email"); $listInfo['rb_userpaypal'] = $userPaypalId; $listInfo['rb_userstatus'] = getStatusString($expireInfo['type']); $listInfo['r_uid'] = $newUid; $listInfo['r_username'] = $newUser->get_variable("users_username"); $listInfo['r_useremail'] = $newUser->get_variable("users_email"); $listInfo['r_userpaypal'] = $newUserPaypalId; $listInfo['r_userstatus'] = getStatusString($newExpireInfo['type']); if ($isPaid) { array_push($isPaidList, $listInfo); } else { array_push($isNotPaidList, $listInfo);