Esempio n. 1
0
                        }
                        JBPLUG_do_callback('pay_trn_verification_reversed', $invoice_id, $product_type);
                        JB_credit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal', $product_type);
                        pp_log_entry('refunded reason: ' . $reason_code);
                        break;
                    case "Reversed":
                        if ($product_type == 'P') {
                            JB_reverse_package_invoice($invoice_id, $reason_code);
                            // reason_code : 'buyer_complaint', 'chargeback', 'guarantee', 'refund', 'other'
                        } elseif ($product_type == 'S') {
                            JB_reverse_subscription_invoice($invoice_id, $reason_code);
                        } elseif ($product_type == 'M') {
                            JB_reverse_membership_invoice($invoice_id, $reason_code);
                        }
                        JBPLUG_do_callback('pay_trn_verification_reversed', $invoice_id, $product_type);
                        JB_credit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal', $product_type);
                        break;
                    default:
                        break;
                }
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }
}
############################################################################
###########################################################################
# Payment Object
class PayPal
{
Esempio n. 2
0
    $result = JB_mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    if ($row['status'] != 'Completed') {
        // check that there's no other refund...
        $sql = "SELECT * FROM jb_txn where txn_id='" . jb_escape_sql($row['txn_id']) . "' AND type='CREDIT' ";
        $r = JB_mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($r) == 0) {
            // do the refund
            if ($row['product_type'] == 'P') {
                JB_reverse_package_invoice($row['invoice_id'], 'refund');
            } elseif ($row['product_type'] == 'S') {
                JB_reverse_subscription_invoice($row['invoice_id'], 'refund');
            } elseif ($row['product_type'] == 'M') {
                JB_reverse_membership_invoice($row['invoice_id'], 'refund');
            }
            JB_credit_transaction($row['invoice_id'], $row['amount'], $row['currency'], $row['txn_id'], 'Refund', 'Admin', $row['product_type']);
            $JBMarkup->ok_msg('Refund completed.');
        } else {
            echo "<b>Error: A refund was already found on this system for this order..</b><br>";
        }
    } else {
        //echo $row['status'];
        echo "<b>Error: The system can only refund orders that are completed, please cancel the order first</b><br>";
    }
    // can only refund completed orders..
}
// calculate the balance
$sql = "SELECT SUM(amount) as mysum, type, currency from jb_txn group by type, currency";
$result = JB_mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    if ($row['type'] == 'CREDIT') {
Esempio n. 3
0
            JB_reverse_subscription_invoice($invoice_id, $reason_code);
        } elseif ($product_type == 'M') {
            JB_reverse_membership_invoice($invoice_id, $reason_code);
        }
        JB_credit_transaction($invoice_id, $amount, $currency, $txn_id, $reason_code, 'GoogleCheckout', $product_type);
        jb_googc_log_entry("(" . $product_type . $invoice_id . ") - Jamit sent 'notification-history-request', Google replied with a '{$notification}' notification ");
    } elseif ($notification == 'refund-amount-notification') {
        $reason_code = 'refund';
        if ($product_type == 'P') {
            JB_reverse_package_invoice($invoice_id, $reason_code);
        } elseif ($product_type == 'S') {
            JB_reverse_subscription_invoice($invoice_id, $reason_code);
        } elseif ($product_type == 'M') {
            JB_reverse_membership_invoice($invoice_id, $reason_code);
        }
        JB_credit_transaction($invoice_id, $amount, $currency, $txn_id, $reason_code, 'GoogleCheckout', $product_type);
        jb_googc_log_entry("(" . $product_type . $invoice_id . ") - Jamit sent 'notification-history-request', Google replied with a '{$notification}' notification ");
    } elseif ($notification == 'risk-information-notification') {
        jb_googc_log_entry("(" . $product_type . $invoice_id . ") - Jamit sent 'notification-history-request', Google replied with a '{$notification}' ");
    } else {
        jb_googc_log_entry("(" . $product_type . $invoice_id . ") - Jamit sent 'notification-history-request', Google replied with a '{$notification}' notification which is unknown to Jamit. serial-number={$serial}, google-order-number={$txn_id}, fulfillment_state={$fulfillment_state}, financial_state={$financial_state}, order-total={$amount}, currency={$currency}, merchant-item-id={$invoice_id}, product_type={$product_type}.");
    }
    // respond with a 'notification-acknowledgement'
    $args = array('serial-number' => $serial);
    jb_GoogleCheckout_respond('notification-acknowledgement', $args);
}
function jb_GoogleCheckout_respond($response_type, $args)
{
    switch ($response_type) {
        case 'notification-acknowledgement':
            $str = '<?xml version="1.0" encoding="UTF-8"?>