本文整理汇总了PHP中PayPal::getShopDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::getShopDomain方法的具体用法?PHP PayPal::getShopDomain怎么用?PHP PayPal::getShopDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::getShopDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Handle_GetPaymentMethod
public function Handle_GetPaymentMethod($order)
{
$method = array();
$method['Title'] = 'PayPal';
$method['Description'] = 'Pay with your PayPal account';
$method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/icon.png';
// config the handling module in the mobile engine
$method['Module'] = 'WebPaymentActivity';
$params = array();
// new paypal module (3.4.5)
if (defined('WPS') && defined('HSS') && defined('ECS')) {
$paypal_method = (int) Configuration::get('PAYPAL_PAYMENT_METHOD');
if ($paypal_method == WPS || $paypal_method == ECS) {
$cancel_url = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/express_checkout/cancel.php';
$params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/express_checkout/payment.php?express_checkout=payment_cart¤t_shop_url=' . urlencode($cancel_url) . '&';
$params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
$params['CancelTrigger'] = $cancel_url;
}
}
// old paypal module (2.8.6)
if (defined('_PAYPAL_INTEGRAL_EVOLUTION_') && defined('_PAYPAL_INTEGRAL_EVOLUTION_') && defined('_PAYPAL_INTEGRAL_EVOLUTION_')) {
if (Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_INTEGRAL_EVOLUTION_) {
// integral_evolution/paypal.tpl
$params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/integral_evolution/redirect.php';
$params['CompleteTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__ . 'order-confirmation.php';
$params['CancelTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__;
} elseif (Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_INTEGRAL_ or Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_OPTION_PLUS_) {
if ($this->_isPayPalAPIAvailable()) {
// payment/payment.tpl
$params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/payment/submit.php';
$params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order-confirmation.php';
$params['CancelTrigger'] = PayPal::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'order';
// either order.php or order-opc.php
$params['RedirectTrigger'] = array('Trigger' => CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/payment/submit.php', 'Redirect' => CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/payment/error.php');
} else {
// standard/paypal.tpl
$params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/standard/redirect.php';
$params['CompleteTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__ . 'order-confirmation.php';
$params['CancelTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__;
}
}
}
// very old paypal (2.0 and below)
if (empty($params)) {
$params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/old/hookpayment.php';
$params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order-confirmation.php';
$params['CancelTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
}
$method['ModuleParameters'] = $params;
return $method;
}
示例2: Paypal
$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, PayPal::BOTH_WITHOUT_SHIPPING), 'customer' => $customer, 'total' => (double) $cart->getOrderTotal(true, PayPal::BOTH), 'shipping' => Tools::ps_round((double) $cart->getOrderShippingCost() + (double) $cart->getOrderTotal(true, PayPal::ONLY_WRAPPING), 2), 'discount' => $cart->getOrderTotal(true, PayPal::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' => PayPal::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');
}
示例3: 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, PayPal::BOTH_WITHOUT_SHIPPING), 'customer' => $customer, 'total' => (double) $cart->getOrderTotal(true, PayPal::BOTH), 'shipping' => Tools::ps_round((double) $cart->getOrderShippingCost() + (double) $cart->getOrderTotal(true, PayPal::ONLY_WRAPPING), 2), 'discount' => $cart->getOrderTotal(true, PayPal::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' => PayPal::getShopDomain(true, true) . __PS_BASE_URI__, 'paymentaction' => Configuration::get('PAYPAL_CAPTURE') ? 'authorization' : 'sale'));
if (substr(_PS_VERSION_, 0, 3) == '1.3') {
$smarty->assign('jquery', 'jquery-1.2.6.pack.js');
} else {
$smarty->assign('jquery', 'jquery-1.4.4.min.js');
}
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');
}