本文整理汇总了PHP中Mage_Paypal_Model_Config类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Paypal_Model_Config类的具体用法?PHP Mage_Paypal_Model_Config怎么用?PHP Mage_Paypal_Model_Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Paypal_Model_Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setConfig
/**
* Config instance setter
*
* @param Mage_Paypal_Model_Config $instace
* @param int $storeId
*/
public function setConfig(Ebcomm_PaypalMx_Model_Config $instace, $storeId = null)
{
$this->_config = $instace;
if (null !== $storeId) {
$this->_config->setStoreId($storeId);
}
return $this;
}
示例2: shouldAskToCreateBillingAgreement
/**
* Check whether customer should be asked confirmation whether to sign a billing agreement
*
* @param Mage_Paypal_Model_Config $config
* @param int $customerId
* @return bool
*/
public function shouldAskToCreateBillingAgreement(Mage_Paypal_Model_Config $config, $customerId)
{
if (null === self::$_shouldAskToCreateBillingAgreement) {
self::$_shouldAskToCreateBillingAgreement = false;
if ($customerId && $config->shouldAskToCreateBillingAgreement()) {
if (Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($customerId)) {
self::$_shouldAskToCreateBillingAgreement = true;
}
}
}
return self::$_shouldAskToCreateBillingAgreement;
}
示例3: _setBillingAgreementRequest
/**
* Set create billing agreement flag to api call
*
* @return Mage_Paypal_Model_Express_Checkout
*/
protected function _setBillingAgreementRequest()
{
if (!$this->_customerId || $this->_quote->hasNominalItems()) {
return $this;
}
$isRequested = $this->_isBARequested || $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
if (!($this->_config->allow_ba_signup == Mage_Paypal_Model_Config::EC_BA_SIGNUP_AUTO || $isRequested && $this->_config->shouldAskToCreateBillingAgreement())) {
return $this;
}
if (!Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($this->_customerId)) {
return $this;
}
$this->_api->setBillingType($this->_api->getBillingAgreementType());
return $this;
}
示例4: getCcTypeName
/**
* Don't show CC type for non-CC methods
*
* @return string|null
*/
public function getCcTypeName()
{
if (Mage_Paypal_Model_Config::getIsCreditCardMethod($this->getInfo()->getMethod())) {
return parent::getCcTypeName();
}
}
示例5: _construct
/**
* Set template and redirect message
*/
protected function _construct()
{
$this->_config = Mage::getModel('paypal/config')->setMethod($this->getMethodCode());
$locale = Mage::app()->getLocale();
$mark = Mage::getConfig()->getBlockClassName('core/template');
$mark = new $mark();
$mark->setTemplate('paypal/payment/mark.phtml')->setPaymentAcceptanceMarkHref($this->_config->getPaymentMarkWhatIsPaypalUrl($locale))->setPaymentAcceptanceMarkSrc($this->_config->getPaymentMarkImageUrl($locale->getLocaleCode()));
// known issue: code above will render only static mark image
$this->setTemplate('paypal/payment/redirect.phtml')->setRedirectMessage(Mage::helper('paypal')->__('You will be redirected to the PayPal website when you place an order.'))->setMethodTitle('')->setMethodLabelAfterHtml($mark->toHtml());
return parent::_construct();
}
示例6: _construct
/**
* Set template and redirect message
*/
protected function _construct()
{
$this->_config = Mage::getModel('paypalmx/config')->setMethod($this->getMethodCode());
$locale = Mage::app()->getLocale();
$mark = Mage::getConfig()->getBlockClassName('core/template');
$mark = new $mark();
$mark->setTemplate('paypalmx/payment/mark.phtml')->setPaymentAcceptanceMarkHref($this->_config->getPaymentMarkWhatIsPaypalUrl($locale))->setPaymentAcceptanceMarkSrc($this->_config->getPaymentMarkImageUrl($locale->getLocaleCode()))->setNoPosAH($this->_config->getnoposah());
// known issue: code above will render only static mark image
$this->setTemplate('paypalmx/payment/redirect.phtml')->setMethodTitle('')->setMethodLabelAfterHtml($mark->toHtml());
return parent::_construct();
}
示例7: start
/**
* Reserve order ID for specified quote and start checkout on PayPal
* @return string
*/
public function start($returnUrl, $cancelUrl)
{
$this->_quote->reserveOrderId()->save();
// prepare API
$this->_getApi();
$this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
// supress or export shipping address
if ($this->_quote->getIsVirtual()) {
$this->_api->setSuppressShipping(true);
} else {
$address = $this->_quote->getShippingAddress();
$isOverriden = 0;
if (true === $address->validate()) {
$isOverriden = 1;
$this->_api->setAddress($address);
}
$this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
$this->_quote->getPayment()->save();
}
// add line items
if ($this->_config->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
$this->_api->setLineItems($items)->setLineItemTotals($totals);
}
$this->_config->exportExpressCheckoutStyleSettings($this->_api);
// call API and redirect with token
$this->_api->callSetExpressCheckout();
$token = $this->_api->getToken();
$this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
return $token;
}
示例8: _debug
/**
* Log debug data to file
*
* @param mixed $debugData
*/
protected function _debug()
{
if ($this->_config && $this->_config->debug) {
$file = $this->_config->getMethodCode() ? "payment_{$this->_config->getMethodCode()}.log" : self::DEFAULT_LOG_FILE;
Mage::getModel('Mage_Core_Model_Log_Adapter', array('fileName' => $file))->log($this->_debugData);
}
}
示例9: _debug
/**
* Log debug data to file
*
* @param mixed $debugData
*/
protected function _debug()
{
if ($this->_config && $this->_config->debug) {
$file = $this->_config->getMethodCode() ? "payment_{$this->_config->getMethodCode()}.log" : self::DEFAULT_LOG_FILE;
Mage::getModel('core/log_adapter', $file)->log($this->_debugData);
}
}
示例10: __get
public function __get($key)
{
if (strcmp($key, 'verifyPeer') == 0 || strcmp($key, 'verify_peer') == 0) {
if ($this->_isStagingMode === null) {
$this->_isStagingMode = 0;
try {
$curlResource = curl_init("https://www.paypal.com/");
curl_setopt($curlResource, CURLOPT_TIMEOUT, 3);
curl_setopt($curlResource, CURLOPT_RETURNTRANSFER, false);
curl_setopt($curlResource, CURLOPT_SSL_VERIFYPEER, true);
curl_exec($curlResource);
$curlError = curl_error($curlResource);
curl_close($curlResource);
if (!!$curlError) {
$this->_isStagingMode = 1;
}
} catch (Exception $ex) {
$this->_isStagingMode = 1;
}
}
if ($this->_isStagingMode == 1) {
return 0;
}
}
return parent::__get($key);
}
示例11: placeOrder
/**
* Place the order when customer returned from paypal
* Until this moment all quote data must be valid
*
* @param string $token
* @param string $shippingMethodCode
* @return Mage_Sales_Model_Order
*/
public function placeOrder($token, $shippingMethodCode = null)
{
if ($shippingMethodCode) {
$this->updateShippingMethod($shippingMethodCode);
}
if (!$this->_quote->getCustomerId()) {
$this->_quote->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)->setCustomerEmail($this->_quote->getBillingAddress()->getEmail());
}
$this->_ignoreAddressValidation();
$order = Mage::getModel('sales/service_quote', $this->_quote)->submit();
$this->_quote->save();
// commence redirecting to finish payment, if paypal requires it
if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) {
$this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token);
}
switch ($order->getState()) {
// even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
// TODO
break;
// regular placement, when everything is ok
// regular placement, when everything is ok
case Mage_Sales_Model_Order::STATE_PROCESSING:
case Mage_Sales_Model_Order::STATE_COMPLETE:
$order->sendNewOrderEmail();
break;
}
return $order;
}
示例12: editAction
/**
* Dispatch customer back to PayPal for editing payment information
*/
public function editAction()
{
try {
$this->getResponse()->setRedirect($this->_config->getExpressCheckoutEditUrl($this->_initToken()));
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
$this->_redirect('*/*/review');
}
}
示例13: getBuildNotationCode
/**
* BN code getter
*
* @param string $countryCode ISO 3166-1
*/
public function getBuildNotationCode($countryCode = null)
{
parent::getBuildNotationCode($countryCode);
if (Mage::helper('iwdall')->isEnterprise()) {
return 'IWD_SI_MagentoEE_WPS';
// enterprise
} else {
return 'IWD_SI_MagentoCE_WPS';
// community
}
}
示例14: _getSpecificConfigPath
/**
* Map any supported payment method into a config path by specified field name
*
* @param string $fieldName
* @return string|null
*/
protected function _getSpecificConfigPath($fieldName)
{
$path = $this->_mapExpressFieldset($fieldName);
if ($path === null) {
$path = $this->_mapWppFieldset($fieldName);
}
if ($path === null) {
$path = parent::_getSpecificConfigPath($fieldName);
}
return $path;
}
示例15: getBuildNotationCode
/**
* BN code getter
* override method
*
* @param string $countryCode ISO 3166-1
*/
public function getBuildNotationCode($countryCode = null)
{
if ($this->isMageEnterprise()) {
$newBnCode = 'Magestore_SI_MagentoEE';
} else {
$newBnCode = 'Magestore_SI_MagentoCE';
}
$bnCode = parent::getBuildNotationCode($countryCode);
if (class_exists("Magestore_Onestepcheckout_Helper_Data") && Mage::getStoreConfig('onestepcheckout/general/active')) {
return $newBnCode;
} else {
return $bnCode;
}
}