本文整理汇总了PHP中PayPal::isAcceptedCurrencyCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::isAcceptedCurrencyCode方法的具体用法?PHP PayPal::isAcceptedCurrencyCode怎么用?PHP PayPal::isAcceptedCurrencyCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::isAcceptedCurrencyCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCountriesRelatedPaymentIdArray
/**
* Returns the countries related payment ID array.
*
* If PayPal is the selected payment method, any Currencies not supported
* will be removed from the Currency array.
* Returns the Payment IDs allowed for the given Country ID.
* Note that the Payment IDs are used for both the keys and values
* of the array returned, like:
* array(
* payment_id => payment_id,
* [...]
* )
* @global ADONewConnection $objDatabase Database connection object
* @param integer $countryId The country ID
* @param array $arrCurrencies The currencies array, by reference
* @return array Array of Payment IDs
*/
static function getCountriesRelatedPaymentIdArray($countryId, $arrCurrencies)
{
global $objDatabase;
if (is_null(self::$arrPayments)) {
self::init();
}
if (isset($_SESSION['shop']['paymentId'])) {
$payment_id = $_SESSION['shop']['paymentId'];
$processor_id = self::getPaymentProcessorId($payment_id);
if ($processor_id == 2) {
foreach ($arrCurrencies as $index => $arrCurrency) {
if (!\PayPal::isAcceptedCurrencyCode($arrCurrency['code'])) {
unset($arrCurrencies[$index]);
}
}
}
}
$arrPaymentId = array();
$query = "\n SELECT DISTINCT `payment`.`id`\n FROM `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_rel_countries` AS `country`\n INNER JOIN `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_zones` AS `zone`\n ON `country`.`zone_id`=`zone`.`id`\n INNER JOIN `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_rel_payment` AS `rel_payment`\n ON `zone`.`id`=`rel_payment`.`zone_id`\n INNER JOIN `" . DBPREFIX . "module_shop" . MODULE_INDEX . "_payment` AS `payment`\n ON `payment`.`id`=`rel_payment`.`payment_id`\n WHERE `country`.`country_id`=" . intval($countryId) . "\n AND `payment`.`active`=1\n AND `zone`.`active`=1";
$objResult = $objDatabase->Execute($query);
while ($objResult && !$objResult->EOF) {
if (isset(self::$arrPayments[$objResult->fields['id']]) && (self::$arrPayments[$objResult->fields['id']]['processor_id'] != 2 || count($arrCurrencies))) {
$paymentId = $objResult->fields['id'];
// the processor with the id 3 is postfinance and 11 is postfinance mobile
// if it is one of them, it should only be able to order when it is Switzerland
if (in_array(self::$arrPayments[$paymentId]['processor_id'], array(3, 11)) && \Cx\Core\Country\Controller\Country::getAlpha2ById($countryId) != 'CH') {
$objResult->MoveNext();
continue;
}
$arrPaymentId[$paymentId] = $paymentId;
}
$objResult->MoveNext();
}
return $arrPaymentId;
}