Пример #1
0
    $more_details = array('transaction_id' => $pgtxnno, 'status' => $status, 'comments' => $comments, 'payment_date' => $payment_date, 'postal_code' => $pincode);
    $SM = new SubscriptionManager();
    $package = $SM->getPackageDetails($details['package_id']);
    if (!empty($package)) {
        /*
         * 03-11-15 :: vj calculate ext payment date using last payment details
         * 18-11-15 :: vj : Purchase, Updgrade and Re-purchase has been handled 
         */
        $last_payment = $SM->getLastPaymentDetails($details['app_key'], 'Paid');
        if (empty($last_payment)) {
            //18-11-15 :: vj : if no last payment then set next_payment_date to now
            $last_payment['next_payment_date'] = 'now';
        }
        if ($details['type'] != 'Upgrade') {
            //03-11-15 :: set next payment date if not upgrading
            $more_details['next_payment_date'] = $SM->calculateNextPaymentDate($package['payment_cycle'], $last_payment['next_payment_date']);
        }
        $end = $Payment->endTransaction($txnid, $more_details);
        $do = session_regenerate_id();
        //03-11-15 :: vj : reset session id to invalidate last session id - 19-11-15 : any how
        if ($end && $status == 'Paid') {
            header('Location:' . RESOURCE_PATH_DIY . $details['app_key'] . '/' . PUBLISH_PAGE);
        } else {
            echo 'Unable to finish your payment.<br/>Redirecting back to payment...<script>window.location=\'' . RESOURCE_PATH_DIY . 'payment?app_key=' . $details['app_key'] . '&msg=Payment Failed : ' . $comments . '\'</script>';
        }
    } else {
        echo 'Unable to verify your subscription details.<br/>Redirecting back to payment...<script>window.location=\'' . RESOURCE_PATH_DIY . 'payment?app_key=' . $details['app_key'] . '&msg=Payment Failed : ' . $comments . '\'</script>';
    }
} elseif (!empty($details) && $flag == "false") {
    echo 'Unable to complete payment.' . $_POST['TxMsg'] . '<br/><br/>Redirecting back to payment...<script>window.location=\'' . RESOURCE_PATH_DIY . 'payment?app_key=' . $details['app_key'] . '&msg=Payment Failed : ' . $comments . '\'</script>';
} else {