' multi-currency: You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment. ' verify: The payment is pending because you are not yet verified. You must verify your account before you can accept this payment. ' 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"]; $resArray['payerid'] = fulfill_order(array_merge($res, $resArray)); // MIKE } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); echo "DoExpressCheckoutDetails API call failed. "; echo "Detailed Error Message: " . $ErrorLongMsg; echo "Short Error Message: " . $ErrorShortMsg; echo "Error Code: " . $ErrorCode; echo "Error Severity Code: " . $ErrorSeverityCode; ?> <html> <script>
function process() { do_query("SET div_precision_increment = 8"); // find and cancel any active orders from users with negative BTC or FIAT balances // this should never happen unless someone is trying to double-spend their balance $query = "\n SELECT orderid, orderbook.amount as amount, orderbook.type, orderbook.uid as uid\n FROM orderbook\n JOIN purses\n ON orderbook.uid = purses.uid\n WHERE\n status != 'CLOSED' AND\n status != 'CANCEL' AND\n purses.amount < 0\n GROUP BY orderid\n "; $result = b_query($query); while ($row = mysql_fetch_array($result)) { $orderid = $row['orderid']; $amount = $row['amount']; $type = $row['type']; $uid = $row['uid']; try { echo "cancelling order {$orderid} (spend ", internal_to_numstr($amount), " {$type} for user {$uid}) due to negative balance\n"; wait_for_lock($uid); $query = "\n UPDATE orderbook\n SET status = 'CANCEL'\n WHERE orderid = '{$orderid}'\n "; b_query($query); add_funds($uid, $amount, $type); // these records indicate returned funds. create_record($orderid, $amount, 0, 0, -1, 0); release_lock($uid); } catch (Error $e) { if ($e->getTitle() == 'Lock Error') { echo "can't get lock for {$uid}\n"; } else { throw $e; } } } $query = "\n SELECT orderid\n FROM orderbook\n WHERE processed=FALSE\n ORDER BY timest ASC\n "; $result = b_query($query); while ($row = mysql_fetch_array($result)) { $orderid = $row['orderid']; echo "Processing {$orderid}...\n"; fulfill_order($orderid); echo "Completed.\n\n"; $query = "\n UPDATE orderbook\n SET processed=TRUE\n WHERE orderid='{$orderid}'\n "; b_query($query); } }