本文整理汇总了PHP中Paypal::getL方法的典型用法代码示例。如果您正苦于以下问题:PHP Paypal::getL方法的具体用法?PHP Paypal::getL怎么用?PHP Paypal::getL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paypal
的用法示例。
在下文中一共展示了Paypal::getL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
include dirname(__FILE__) . '/../paypal.php';
$paypal = new Paypal();
$cart = new Cart((int) $cookie->id_cart);
$address = new Address((int) $cart->id_address_delivery);
$country = new Country((int) $address->id_country);
$state = NULL;
if ($address->id_state) {
$state = new State((int) $address->id_state);
}
$customer = new Customer((int) $cart->id_customer);
$business = Configuration::get('PAYPAL_BUSINESS');
$header = Configuration::get('PAYPAL_HEADER');
$currency_order = new Currency((int) $cart->id_currency);
$currency_module = $paypal->getCurrency((int) $cart->id_currency);
if (empty($business) or !Validate::isEmail($business)) {
die($paypal->getL('Paypal error: (invalid or undefined business account email)'));
}
if (!Validate::isLoadedObject($address) or !Validate::isLoadedObject($customer) or !Validate::isLoadedObject($currency_module)) {
die($paypal->getL('Paypal error: (invalid address or customer)'));
}
// check currency of payment
if ($currency_order->id != $currency_module->id) {
$cookie->id_currency = $currency_module->id;
$cart->id_currency = $currency_module->id;
$cart->update();
}
$smarty->assign(array('redirect_text' => $paypal->getL('Please wait, redirecting to Paypal... Thanks.'), 'cancel_text' => $paypal->getL('Cancel'), 'cart_text' => $paypal->getL('My cart'), 'return_text' => $paypal->getL('Return to shop'), 'paypal_url' => $paypal->getPaypalStandardUrl(), 'address' => $address, 'country' => $country, 'state' => $state, 'amount' => (double) $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), 'customer' => $customer, 'total' => (double) $cart->getOrderTotal(true, Cart::BOTH), 'shipping' => Tools::ps_round((double) $cart->getOrderShippingCost() + (double) $cart->getOrderTotal(true, Cart::ONLY_WRAPPING), 2), 'discount' => $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS), 'business' => $business, 'currency_module' => $currency_module, 'cart_id' => (int) $cart->id . '_' . pSQL($cart->secure_key), 'products' => $cart->getProducts(), 'paypal_id' => (int) $paypal->id, 'header' => $header, 'url' => Tools::getShopDomain(true, true) . __PS_BASE_URI__));
if (is_file(_PS_THEME_DIR_ . 'modules/paypal/standard/redirect.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/' . $paypal->name . '/standard/redirect.tpl');
} else {
$smarty->display(_PS_MODULE_DIR_ . $paypal->name . '/standard/redirect.tpl');
示例2: Address
$shippingState = $billingState;
} else {
$shippingAddress = new Address((int) $cart->id_address_delivery);
$shippingCountry = new Country((int) $shippingAddress->id_country);
$shippingState = NULL;
if ($shippingAddress->id_state) {
$shippingState = new State((int) $shippingAddress->id_state);
}
}
$customer = new Customer((int) $cart->id_customer);
$business = Configuration::get('PAYPAL_BUSINESS');
$header = Configuration::get('PAYPAL_HEADER');
$currency_order = new Currency((int) $cart->id_currency);
$currency_module = $paypal->getCurrency((int) $cart->id_currency);
if (empty($business) or !Validate::isEmail($business)) {
die($paypal->getL('Paypal error: (invalid or undefined business account email)'));
}
if (!Validate::isLoadedObject($billingAddress) or !Validate::isLoadedObject($shippingAddress) or !Validate::isLoadedObject($customer) or !Validate::isLoadedObject($currency_module)) {
die($paypal->getL('Paypal error: (invalid address or customer)'));
}
// check currency of payment
if ($currency_order->id != $currency_module->id) {
$cookie->id_currency = $currency_module->id;
$cart->id_currency = $currency_module->id;
$cart->update();
}
$smarty->assign(array('redirect_text' => $paypal->getL('Please wait, redirecting to Paypal... Thanks.'), 'cancel_text' => $paypal->getL('Cancel'), 'cart_text' => $paypal->getL('My cart'), 'return_text' => $paypal->getL('Return to shop'), 'paypal_url' => $paypal->getPaypalIntegralEvolutionUrl(), 'billing_address' => $billingAddress, 'billing_country' => $billingCountry, 'billing_state' => $billingState, 'shipping_address' => $shippingAddress, 'shipping_country' => $shippingCountry, 'shipping_state' => $shippingState, 'amount' => (double) $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), 'customer' => $customer, 'total' => (double) $cart->getOrderTotal(true, Cart::BOTH), 'shipping' => Tools::ps_round((double) $cart->getOrderShippingCost() + (double) $cart->getOrderTotal(true, Cart::ONLY_WRAPPING), 2), 'discount' => $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS), 'business' => $business, 'currency_module' => $currency_module, 'cart_id' => (int) $cart->id . '_' . pSQL($cart->secure_key), 'products' => $cart->getProducts(), 'paypal_id' => (int) $paypal->id, 'header' => $header, 'template' => 'Template' . Configuration::get('PAYPAL_TEMPLATE'), 'url' => Tools::getShopDomain(true, true) . __PS_BASE_URI__, 'paymentaction' => Configuration::get('PAYPAL_CAPTURE') ? 'authorization' : 'sale'));
if (is_file(_PS_THEME_DIR_ . 'modules/paypal/integral_evolution/redirect.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/' . $paypal->name . '/integral_evolution/redirect.tpl');
} else {
$smarty->display(_PS_MODULE_DIR_ . $paypal->name . '/integral_evolution/redirect.tpl');
示例3: urlencode
$params = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$params .= '&' . $key . '=' . urlencode(stripslashes($value));
}
// PayPal Server
$paypalServer = 'www.' . (Configuration::get('PAYPAL_SANDBOX') ? 'sandbox.' : '') . 'paypal.com';
// Getting PayPal data...
if (function_exists('curl_exec')) {
// curl ready
$ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr');
// If the above fails, then try the url with a trailing slash (fixes problems on some servers)
if (!$ch) {
$ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr/');
}
if (!$ch) {
$errors .= $paypal->getL('connect') . ' ' . $paypal->getL('curlmethodfailed');
} else {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
if ($result != 'VERIFIED') {
$errors .= $paypal->getL('curlmethod') . $result . ' cURL error:' . curl_error($ch);
}
curl_close($ch);
}
} elseif (($fp = @fsockopen('ssl://' . $paypalServer, 443, $errno, $errstr, 30)) || ($fp = @fsockopen($paypalServer, 80, $errno, $errstr, 30))) {
// fsockopen ready
示例4: urlencode
$params = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$params .= '&' . $key . '=' . urlencode(stripslashes($value));
}
// PayPal Server
$paypalServer = 'www.' . (Configuration::get('PAYPAL_SANDBOX') ? 'sandbox.' : '') . 'paypal.com';
// Getting PayPal data...
if (function_exists('curl_exec')) {
// curl ready
$ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr');
// If the above fails, then try the url with a trailing slash (fixes problems on some servers)
if (!$ch) {
$ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr/');
}
if (!$ch) {
$errors .= $paypal->getL('connect') . ' ' . $paypal->getL('curlmethodfailed');
} else {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
if (strtoupper($result) != 'VERIFIED') {
$errors .= $paypal->getL('curlmethod') . $result . ' cURL error:' . curl_error($ch);
}
curl_close($ch);
}
} elseif (($fp = @fsockopen('ssl://' . $paypalServer, 443, $errno, $errstr, 30)) || ($fp = @fsockopen($paypalServer, 80, $errno, $errstr, 30))) {
// fsockopen ready
示例5: dirname
include dirname(__FILE__) . '/paypal.php';
$paypal = new Paypal();
$cart = new Cart(intval($cookie->id_cart));
$address = new Address(intval($cart->id_address_invoice));
$country = new Country(intval($address->id_country));
$state = NULL;
if ($address->id_state) {
$state = new State(intval($address->id_state));
}
$customer = new Customer(intval($cart->id_customer));
$business = Configuration::get('PAYPAL_BUSINESS');
$header = Configuration::get('PAYPAL_HEADER');
$currency_order = new Currency(intval($cart->id_currency));
$currency_module = $paypal->getCurrency();
if (!Validate::isEmail($business)) {
die($paypal->getL('Paypal error: (invalid or undefined business account email)'));
}
if (!Validate::isLoadedObject($address) or !Validate::isLoadedObject($customer) or !Validate::isLoadedObject($currency_module)) {
die($paypal->getL('Paypal error: (invalid address or customer)'));
}
// check currency of payment
if ($currency_order->id != $currency_module->id) {
$cookie->id_currency = $currency_module->id;
$cart->id_currency = $currency_module->id;
$cart->update();
}
$smarty->assign(array('redirect_text' => $paypal->getL('Please wait, redirecting to Paypal... Thanks.'), 'cancel_text' => $paypal->getL('Cancel'), 'cart_text' => $paypal->getL('My cart'), 'return_text' => $paypal->getL('Return to shop'), 'paypal_url' => $paypal->getPaypalUrl(), 'address' => $address, 'country' => $country, 'state' => $state, 'amount' => floatval($cart->getOrderTotal(true, 4)), 'customer' => $customer, 'total' => floatval($cart->getOrderTotal(true, 3)), 'shipping' => Tools::ps_round(floatval($cart->getOrderShippingCost()) + floatval($cart->getOrderTotal(true, 6)), 2), 'discount' => $cart->getOrderTotal(true, 2), 'business' => $business, 'currency_module' => $currency_module, 'cart_id' => intval($cart->id), 'products' => $cart->getProducts(), 'paypal_id' => intval($paypal->id), 'header' => $header, 'url' => Tools::getHttpHost(true, true) . __PS_BASE_URI__));
if (is_file(_PS_THEME_DIR_ . 'modules/paypal/redirect.tpl')) {
$smarty->display(_PS_THEME_DIR_ . 'modules/' . $paypal->name . '/redirect.tpl');
} else {
$smarty->display(_PS_MODULE_DIR_ . $paypal->name . '/redirect.tpl');