<?php include "../init.php"; include " 2co-subscribe.inc.php"; if (!defined('2CO_RETURN')) { exit; } // get the custom value $raw = explode('&', urldecode($_POST['custom'])); $val_product_id = $raw[0]; $val_email = $raw[1]; $val_username = $raw[2]; $val_password = $raw[3]; $val_firstname = $raw[4]; $val_lastname = $raw[5]; $val_coupon_code = $raw[6]; $val_date_order = $raw[7]; $payment_gateway = "2CO Subscribe"; $log = "payment " . $_POST['item_name'] . " at 2CO"; $gateway_data = $pay_class->GetPaymentGatewayDetail("2co_subscrice"); $co_account = $gateway_data['payment_gateway_account']; $list_co_account = explode("&", $co_account); $co_sid = $list_co_account[0]; $co_secret = $list_co_account[1]; $payment_date = time(); ProcessIPN($co_sid, $_POST['sid'], $_POST['total'], $val_product_id, $val_username, $val_password, $val_firstname, $val_lastname, $val_email, $log, $payment_date, $payment_gateway, $_POST['invoice_id'], $val_coupon_code, $val_date_order);
} else { $fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30); } if ($fp) { fputs($fp, $header . $req); while (!feof($fp)) { $res = fgets($fp, 1024); if (strcmp($res, "VERIFIED") == 0) { // get the custom value $raw = explode('&', $_POST['custom']); $val_product_id = $raw[0]; $val_email = $raw[1]; $val_username = $raw[2]; $val_password = $raw[3]; $val_firstname = $raw[4]; $val_lastname = $raw[5]; $val_coupon_code = $raw[6]; $log = implode("\n", $_POST); $payment_gateway = "Paypal Payment"; $gateway_data = $pay_class->GetPaymentGatewayDetail("paypal_payments"); $paypal_email = $gateway_data['payment_gateway_account']; $payment_date = time(); ProcessIPN($paypal_email, $_POST['business'], $_POST['mc_gross'], $val_product_id, $val_username, $val_password, $val_firstname, $val_lastname, $val_email, $log, $payment_date, $payment_gateway, $_POST['invoice'], $val_coupon_code); } else { if (strcmp($res, "INVALID") == 0) { // log for manual investigation } } } fclose($fp); }
if ($ap_Status == "Success") { // The is not a free trial and ap_TrialAmount contains some amount and the // ap_ReferenceNumber contains a valid transaction reference number. $raw = explode('&', urldecode($_POST['apc_1'])); $val_product_id = $raw[0]; $val_email = $raw[1]; $val_username = $raw[2]; $val_password = $raw[3]; $val_firstname = $raw[4]; $val_lastname = $raw[5]; $val_coupon_code = $raw[6]; $val_date_order = $raw[7]; $log = implode("\n", $_POST); $invoice_id = getInvoiceId(); $payment_date = time(); ProcessIPN($payalert_email, $_POST['ap_merchant'], $_POST['ap_amount'], $val_product_id, $val_username, $val_password, $val_firstname, $val_lastname, $val_email, $log, $payment_date, $payment_gateway, $invoice_id, $val_coupon_code, $val_date_order); } else { echo "Transaction cancelled means seller explicitely cancelled the subscription or AlertPay "; echo "cancelled or it was cancelled since buyer didnt have enough money after resheduling after two times."; echo "Take Action appropriately"; if ($ap_PurchaseType == "Subscription") { setSubscriptionVariables(); } else { } } } } function setSubscriptionVariables() { $ap_SubscriptionReferenceNumber = $_POST['ap_subscriptionreferencenumber']; $ap_TimeUnit = $_POST['ap_timeunit'];
while (list(, $host) = @each($referers)) { if (eregi($host, $_SERVER['HTTP_REFERER'])) { $valid_referer = TRUE; } } } else { $valid_referer = TRUE; } if (!$valid_referer) { exit; } // if (md5($_POST['merchant_id'].$_POST['transaction_id'].strtoupper(md5('abcde')))) // { if ($_POST['status'] == 2) { $raw = explode('&', urldecode($_POST['custom'])); $val_product_id = $raw[0]; $val_email = $raw[1]; $val_username = $raw[2]; $val_password = $raw[3]; $val_firstname = $raw[4]; $val_lastname = $raw[5]; $val_coupon_code = $raw[6]; $val_date_order = $raw[7]; $log = implode("\n", $_POST); $payment_gateway = "Moneybookers"; $gateway_data = $pay_class->GetPaymentGatewayDetail("moneybookers"); $moneybookers_email = $gateway_data['payment_gateway_account']; $payment_date = time(); ProcessIPN($moneybookers_email, $_POST['pay_to_email'], $_POST['amount'], $val_product_id, $val_username, $val_password, $val_firstname, $val_lastname, $val_email, $log, $payment_date, $payment_gateway, $_POST['transaction_id'], $val_coupon_code, $val_date_order); } //}