コード例 #1
0
 function rjdgpp_install()
 {
     RJDGSHOP::install();
     RJDGPPTXN::install();
 }
コード例 #2
0
ファイル: class.dgpp.php プロジェクト: ith3rm17/rjdgpp-ppl-wp
    /**
     * array(
     * 	"item_id"	=>$i->id,
     * 	"price"		=>$i->price,
     * 	"item_name"	=>$i->name,
     * 	's'			=>session_id()
     * )
     * 
     * @param $i
     * @return String Display the paypal button or the download button
     */
    public static function getButton(&$i = null)
    {
        //if(empty($urlparam) || (is_array($urlparam) && count($urlparam) < 1) ) return false;
        if (!is_a($i, 'RJDGSHOP')) {
            return false;
        }
        //change the button with link if status is: complete,price,session_id
        if ($i->isLoaded()) {
            $txn = new RJDGPPTXN();
            if ($txn->loadByShopObj($i)) {
                if ($txn->isComplete($i)) {
                    return '<span><a href="' . self::getDownloadLink($i) . '" target="_blank">Download</a></span>';
                }
                unset($i);
                unset($txn);
            }
        }
        //continue if not yet complete
        $urlparam = self::getUrlParam(array("item_id" => $i->id, "price" => $i->price, "item_name" => $i->name, 's' => session_id()));
        //any object beyond this point is considered default and unpaid
        if (empty($urlparam)) {
            return false;
        }
        ob_start();
        ?>
<form action="<?php 
        echo self::getURI('/paypal/index.php?' . $urlparam);
        ?>
" method="POST">
	<input type='image' class="rj_paypal_dg_button" name='paypal_submit0' id='paypal_submit0'  src='https://www.paypal.com/en_US/i/btn/btn_dg_pay_w_paypal.gif' border='0' align='top' alt='Pay with PayPal'/>
</form><?php 
        return ob_get_clean();
    }
コード例 #3
0
ファイル: index.php プロジェクト: ith3rm17/rjdgpp-ppl-wp
/**
 * paypal startflow
 * assignments must be made on this page
 */
require_once dirname(__FILE__) . '/../../../../wp-load.php';
require_once 'paypalfunctions.php';
$url = RJDGPP::getURI('/paypal');
?>
<html><body><?php 
$paymentAmount = $_REQUEST['price'];
$item_name = $_REQUEST['item_name'];
$item_id = $_REQUEST['item_id'];
$s = $_REQUEST['s'];
//prepare txn
$txn = new RJDGPPTXN();
$txn->shop_id = $item_id;
$txn->name = $item_name;
$txn->session_id = $s;
$PaymentOption = "PayPal";
if ($PaymentOption == "PayPal" && !empty($paymentAmount) && !empty($item_name)) {
    $currencyCodeType = "USD";
    $paymentType = "Sale";
    $returnURL = $url . "/return.php";
    $cancelURL = $url . "/cancel.php";
    $items = array();
    $items[] = array('name' => $item_name, 'amt' => $paymentAmount, 'qty' => 1, 'item_id' => $item_id);
    $resArray = SetExpressCheckoutDG($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $items);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $token = urldecode($resArray["TOKEN"]);
コード例 #4
0
ファイル: return.php プロジェクト: ith3rm17/rjdgpp-ppl-wp
 '  other: The payment is pending for a reason other than those listed above. For more information, contact PayPal customer service.
 */
 $pendingReason = $resArray["PAYMENTINFO_0_PENDINGREASON"];
 /*
 'The reason for a reversal if TransactionType is reversal:
 '  none: No reason code
 '  chargeback: A reversal has occurred on this transaction due to a chargeback by your customer.
 '  guarantee: A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.
 '  buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer.
 '  refund: A reversal has occurred on this transaction because you have given the customer a refund.
 '  other: A reversal has occurred on this transaction due to a reason not listed above.
 */
 $reasonCode = $resArray["PAYMENTINFO_0_REASONCODE"];
 // Add javascript to close Digital Goods frame. You may want to add more javascript code to
 // display some info message indicating status of purchase in the parent window
 $txn = new RJDGPPTXN();
 if ($txn->loadBy('token', $token)) {
     $txn->payer_id = $payerID;
     $txn->transaction_id = $transactionId;
     $txn->transaction_type = $transactionType;
     $txn->price = $amt;
     $txn->payment_type = $paymentType;
     $txn->payment_status = $paymentStatus;
     $txn->currency_code = $currencyCode;
     $txn->order_time = $orderTime;
     $txn->server_order_time = date('Y-m-d H:i:s');
     $txn->session_expire = RJSES::expireDateTime();
     //			$txn->session_id=session_id();
     $txn->pending_reason = $pendingReason;
     $txn->reason_code = $reasonCode;
     $txn->fee_amount = $feeAmt;
コード例 #5
0
ファイル: JSON.php プロジェクト: ith3rm17/rjdgpp-ppl-wp
    switch ($idata->q) {
        case 'status':
            $t = new RJDGPPTXN();
            if ($t->loadBy('session_id', session_id())) {
                if ($t->isComplete()) {
                    $i = new RJDGSHOP($t->shop_id);
                    if ($i->id) {
                        $url = $i->getDownloadLink();
                        $odata['data']['link'] = $url;
                    }
                }
            }
            break;
        case 'helper':
            if ($idata->txn_id) {
                $txn = new RJDGPPTXN();
                $txn->loadBy('transaction_id', $idata->txn_id);
                if ($txn->isLoaded()) {
                    $file = new RJDGSHOP($txn->shop_id);
                    if ($file->isLoaded() && $txn->isValid()) {
                        $odata['data'] = array('name' => $file->name, 'link' => RJDGPP::getDownloadLink($file) . '&txn_id=' . $txn->transaction_id, 'txn_price' => $txn->price, 'item_price' => $file->price, 'txn_stat' => $txn->payment_status, 'txn_id' => $txn->transaction_id);
                        $odata['response'] = 'success';
                    }
                }
            }
            break;
        default:
    }
}
//idata->q
echo json_encode($odata);
コード例 #6
0
ファイル: index.php プロジェクト: ith3rm17/rjdgpp-ppl-wp
 *   an exclusive file for downloads
 *   
 *   depends: RJSES
 *   		  RJDL
 *   		  RJSHOP
 *   	      RJDGTXN
 */
include dirname(__FILE__) . '/../../../../wp-load.php';
$ar = wp_parse_args($_REQUEST);
$dl = false;
if (empty($ar['i']) || !is_numeric($ar['i'])) {
    //	session_id()
} else {
    RJSES::start();
    $i = new RJDGSHOP($ar['i']);
    $txn = new RJDGPPTXN();
    //$txn->loadByShopObj($i);
    if ($txn->loadBy('transaction_id', $ar['txn_id']) && $i->isLoaded()) {
        if ($txn->isComplete($i)) {
            status_header(200);
            //show pdf
            if (RJDL::http($i->pathname)) {
                $dl = true;
            }
        } else {
            status_header(404);
            $a = $txn->getStatus($i);
            array_walk($a, create_function('&$i,$k', '$i="<li>$i</li>";'));
            get_header();
            echo '<h3>failed with the following erros</h3><ul>' . join('', $a) . '</ul>';
            get_footer();