Beispiel #1
0
    /**
     * 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();
    }
Beispiel #2
0
/**
 *   Author: Reynald Jay Cueto
 *   Author URI: http://www.myminipin.com/
 *   Description: For public/non-admin requests
 */
include_once dirname(__FILE__) . '/../../../wp-load.php';
header('Content-Type: application/json');
status_header(200);
$idata = json_decode(file_get_contents('php://input'));
$odata = array('response' => 'failed');
if (!empty($idata->q)) {
    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()) {
Beispiel #3
0
            $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;
            $txn->tax_amount = $taxAmt;
            $txn->exchange_rate = $exchangeRate;
            $txn->save();
            //send an email to the client
            try {
                $item = new RJDGSHOP($txn->shop_id);
                if ($txn->isComplete($item)) {
                    $email_sent = RJDGPP::sendEmail($txn, $item);
                }
                unset($item);
            } catch (Exception $e) {
                rjdump($e);
            }
        }
        //loadBy
        ?>
<html>
<script>
alert("Payment Successful");
// add relevant message above or remove the line if not required
window.onload = function(){
	/*
Beispiel #4
0
 *   		  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();
        }
    }
    //loadBy