コード例 #1
0
ファイル: x.php プロジェクト: huynp/Critical
 * 
 * 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;
}
コード例 #2
0
ファイル: payment_methods.php プロジェクト: huynp/Critical
<?php

$availablePaymentServices = MM_PaymentServiceFactory::getPaymentServicesArray(false);
$onsiteServices = array();
$offsiteServices = array();
$onsiteSelected = false;
$testService = null;
if (isset($availablePaymentServices[MM_PaymentService::$TEST_SERVICE_TOKEN])) {
    $testService = $availablePaymentServices[MM_PaymentService::$TEST_SERVICE_TOKEN];
    unset($availablePaymentServices[MM_PaymentService::$TEST_SERVICE_TOKEN]);
}
foreach ($availablePaymentServices as $currentoken => $aService) {
    if ($aService->supportsFeature(MM_PaymentServiceFeatures::OFFSITE_SERVICE)) {
        $offsiteServices[$currentoken] = $aService;
    } else {
        //assume services that fail the feature check are onsite, ie. only one onsite at a time can be active
        $onsiteServices[$currentoken] = $aService;
        if (!$onsiteSelected && $aService->isActive()) {
            $onsiteSelected = true;
            //if no onsite services are selected, this will indicate to check the 'none' option
        }
    }
}
$currentCurrency = MM_CurrencyUtil::getActiveCurrency();
$unsupportedCurrencyWarning = "<div style='background-color: #ff0000; color: #ffffff;'>" . "This payment service does not support the configured currency. " . "To change the configured currency click " . "<a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_CHECKOUT_OTHER_SETTINGS) . "'>here</a></div>";
?>
<style>
.mm-payment-service-box {
  margin-bottom: 5px;
}
</style>