You are here

public function PayPalPaymentNVPAPIPaymentMethodControllerBase::NVPAPIServerURL in PayPal for Payment 7

Returns the API server URL.

Parameters

int $server: One of the self::NVP_API_SERVER_* constants.

Return value

string

Throws

InvalidArgumentException

1 call to PayPalPaymentNVPAPIPaymentMethodControllerBase::NVPAPIServerURL()
PayPalPaymentNVPAPIPaymentMethodControllerBase::NVPAPIRequest in paypal_payment/includes/PayPalPaymentNVPAPIPaymentMethodControllerBase.inc
Executes an API request.

File

paypal_payment/includes/PayPalPaymentNVPAPIPaymentMethodControllerBase.inc, line 57

Class

PayPalPaymentNVPAPIPaymentMethodControllerBase
A base class for payment method controllers that talk to PayPal's NVP API.

Code

public function NVPAPIServerURL($server) {
  $urls = array(
    $this::NVP_API_SERVER_PRODUCTION => $this::NVP_API_URL_SERVER_PRODUCTION,
    $this::NVP_API_SERVER_SANDBOX => $this::NVP_API_URL_SERVER_SANDBOX,
  );
  if (array_key_exists($server, $urls)) {
    return url($urls[$server], array(
      'external' => TRUE,
    ));
  }
  else {
    throw new InvalidArgumentException(t('Server type does not exist.'));
  }
}