Exemple #1
0
     if ($card_id != $getCard->id) {
         error_log("Found New Card :: [" . $card_id . "] for Token :: [" . $token . "] ");
         ##We have to add new card
         #$cu->sources->create(array("source" => $token ));
         $customer_data->sources->create(array("source" => "{$token}"));
     }
     ## Try to authorize $1 for this card If it fails Then we will not process further.
     $isAuthorized = 0;
     $isAuthorized = letsAuthorizeTheCard($token, $card_id, $customerId, $_SESSION['FBID']);
     error_log("isAuthorized :: [" . $isAuthorized . "]");
     //error_log( print_r( $retrieve_token, true), 0);
     //exit;
     if ($isAuthorized) {
         saveTransactionDetails($card_id);
         sendMailToDonor($fullName, $email, $trailfor, $trailto);
         sendMailToEntrepreneur($fullName, $email, $trailfor, $trailto);
         header("Location: ../funding-confirm?u={$trailto}&pmode={$pmode}&sid=" . $sid);
     } else {
         header("Location: ../funding-confirm?u={$trailto}&pmode={$pmode}&status=declined&sid=" . $sid);
         // The card was failed to authorized. Lets show something that we have failed to authroize the card
     }
 }
 /*
                 // Charge the Customer instead of the card
                 Stripe_Charge::create(array(
                   "amount" => $trailforcent, # amount in cents, again
                   "currency" => "usd",
                   "customer" => $customer->id)
                 );
 */
 /*
Exemple #2
0
        $eID = $row1['element_id'];
        $todate = date("Y-m-d H:i:s");
        $daydiff = $default_milestone + 1 - floor((strtotime($todate) - strtotime($funding_milestones_datetime)) / (3600 * 24));
        list($campaignAmount, $campaignRaised) = getCampaignAmount($eID, $aID);
        if ($campaignRaised < $campaignAmount && $daydiff <= 0) {
            ## Campaign Failed
            $result2 = mysql_query("select funding_details_id, account_funder_id, fund_amount from funding_details where element_id='{$eID}' AND account_id = '{$aID}'") or die("mysql error @ ___");
            while ($row2 = mysql_fetch_array($result2)) {
                $funding_details_id = $row2['funding_details_id'];
                $account_funder_id = $row2['account_funder_id'];
                $fund_amount = $row2['fund_amount'];
                #$funding_details_datetime= $row2['funding_details_datetime'];
                list($fullName, $email) = getDonorFullName($account_funder_id);
                sendMailToDonor($fullName, $email, $fund_amount / 100, $aID, getCampaignName($eID));
            }
            sendMailToEntrepreneur('', $email, $campaignRaised, $aID, getCampaignName($eID));
            $result = mysql_query("UPDATE funding_milestones SET funding_failure_emailed = '1' WHERE funding_milestones_id = '{$funding_milestones_id}' ") or die("mysql error updating funding_milestones_mailed");
        } else {
            ##Successful Campaign
            continue;
        }
    }
}
function sendMailToDonor($fullName, $email, $amount, $userid, $campaign_name)
{
    $from_address = FROM_EMAIL_ADDRESS;
    $bcc_address = SIVI_ADMIN_EMAIL;
    $to = $email;
    global $funding_for;
    $server = 'https://' . $_SERVER['HTTP_HOST'];
    list($first_name, $last_name, $username, $account_email) = getAccountDetails($userid);