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);
*/ $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; $txn->tax_amount = $taxAmt;
* 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(); } }