<?php if (!MM_PaymentServiceResponse::isError($p)) { ?> <!--successfully got bitcoin payment info from coinbase--> <script>window.jQuery || document.write('\x3Cscript src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">\x3C\/script>');</script> <script> jQuery(function(){ jQuery('title').text('Send Bitcoin payment'); jQuery('#mm-bitcoin-address').click(function(){jQuery(this).focus().select();}); }); </script> <style type="text/css"> @media(max-width:650px){ #mm-bitcoin { width:100% !important; margin-left:0 !important; top:0 !important; left:0 !important; bottom: 0; border-radius:0 !important; height: 100% !important; } #mm-bitcoin > div { text-align: center !important; } #mm-bitcoin h3 { padding-top: 0 !important; clear: both; }
* * This script processes payment notifications/callbacks from payment service providers, and routes these messages to the appropriate services * A url parameter "service" is expected, with the value containing the token identifier for the service the message is intended for * For example, a PayPal IPN notification is expected to be received at http://<sitename>/wp-content/plugins/membermouse/x.php?service=paypal * * The placement and name of this script are intended to keep the url as small as possible, under the circumstances * */ require_once "../../../wp-load.php"; require_once "includes/mm-constants.php"; require_once "includes/init.php"; $request = isset($_POST) ? $_POST : array(); if (isset($_GET['service']) || isset($_POST['service'])) { $serviceToken = isset($_GET['service']) ? strtoupper($_GET['service']) : strtoupper($_POST['service']); $service = MM_PaymentServiceFactory::getPaymentService($serviceToken); $response = !is_null($service) ? $service->processNotification($request) : new MM_PaymentServiceResponse("Improper notification format received", MM_PaymentServiceResponse::$ERROR); } else { //unspecified service (which means improper remote setup), see if there is a default payment service that can/will handle it $serviceArray = MM_PaymentServiceFactory::getPaymentServicesArray(); if (count($serviceArray) == 1) { $service = array_pop($serviceArray); $response = $service->processNotification($request); } else { $response = new MM_PaymentServiceResponse("Improper notification format received", MM_PaymentServiceResponse::$ERROR); } } //echo the response to caller $responseMsg = $response->getMessage(); if (!empty($responseMsg)) { echo $responseMsg; }
returnStatus('error', 'Authentication Failed'); exit; } } else { MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "System does not support sha256 hmac... proceeding to process schedules without auth"); } $eventId = $request['reference_id']; $eventType = $wpdb->get_var("SELECT event_type from " . MM_TABLE_SCHEDULED_EVENTS . " where id='{$eventId}'"); switch ($eventType) { case MM_ScheduledEvent::$PAYMENT_SERVICE_EVENT: $paymentEvent = new MM_ScheduledPaymentEvent($eventId); $billingStatus = $request['status']; $paymentEvent->setBillingStatus($billingStatus); if ($paymentEvent->getStatus() == MM_ScheduledEvent::$EVENT_PROCESSED) { returnStatus("ok", "Event {$eventId} already processed"); } $paymentService = MM_PaymentServiceFactory::getPaymentServiceById($paymentEvent->getPaymentServiceId()); if (is_null($paymentService)) { returnStatus("error", "Improper event configuration: Payment service with id {$paymentService->getPaymentServiceId()} not found"); } $response = $paymentService->processScheduledPaymentEvent($paymentEvent); if (MM_PaymentServiceResponse::isError($response) || MM_PaymentServiceResponse::isFailed($response)) { returnStatus("error", $response->message); } returnStatus("ok", ""); break; default: //TODO: logging returnStatus('error', 'Invalid Event Type'); break; }