Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
Update module to version 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lmbrtz committed Sep 27, 2016
1 parent a440610 commit cd8789e
Show file tree
Hide file tree
Showing 134 changed files with 4,818 additions and 4,939 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* @package Iways_PayPalPlus
* @author robert
*/
class Iways_PayPalPlus_Block_Adminhtml_System_Config_Fieldset_Payment extends Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
class Iways_PayPalPlus_Block_Adminhtml_System_Config_Fieldset_Payment
extends Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
{
/**
* Get collapsed state on-load
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
* @package Iways_PayPalPlus
* @author robert
*/
class Iways_PayPalPlus_Block_Adminhtml_System_Config_Fieldset_Payment_Thirdparty_Info extends
Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
class Iways_PayPalPlus_Block_Adminhtml_System_Config_Thirdpartyinfo
extends Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
{
/**
* @var
Expand Down Expand Up @@ -56,8 +56,6 @@ public function render(Varien_Data_Form_Element_Abstract $element)

$payments = Mage::getSingleton('payment/config')->getActiveMethods();

$methods = array(array('value' => '', 'label' => Mage::helper('adminhtml')->__('--Please Select--')));

foreach ($payments as $paymentCode => $paymentModel) {
if (in_array($paymentCode, $thirdPartyMethods)) {
$html .= $this->_getFieldHtml($element, $paymentModel);
Expand Down Expand Up @@ -124,15 +122,18 @@ protected function _getFieldHtml($fieldset, $paymentModel)

$e = $this->_getDummyElement();

$field = $fieldset->addField($paymentModel->getCode(), 'text',
$field = $fieldset->addField(
$paymentModel->getCode(),
'text',
array(
'name' => 'groups[third_party_modul_info][fields][text_' . $paymentModel->getCode() . '][value]',
'label' => $paymentModel->getTitle(),
'value' => $data,
'inherit' => $inherit,
'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
))->setRenderer($this->_getFieldRenderer());
)
)->setRenderer($this->_getFieldRenderer());

return $field->toHtml();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,54 @@
class Iways_PayPalPlus_Block_Onepage_Payment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods
{
/**
* Default PayPal Plus method template
* Builds third party methods array
*
* @return array
*/
const DEFAULT_TEMPLATE = 'paypalplus/methods.phtml';
/**
* Magestore PayPal Plus method template
*/
const MAGESTORE_TEMPLATE = 'paypalplus/magestore/onestepcheckout/payment_method.phtml';
public function getThirdPartyMethods()
{
$thirdPartyMethods = Mage::getStoreConfig('payment/iways_paypalplus_payment/third_party_moduls');

if (!empty($thirdPartyMethods)) {
$thirdPartyMethods = explode(',', $thirdPartyMethods);
} else {
$thirdPartyMethods = array();
}
$thirdPartyMethods = array_merge(
$thirdPartyMethods,
array(
'paypaluk_direct',
'paypaluk_express',
'paypal_standard',
'paypal_direct',
'paypal_express_bml',
'paypal_express'
)
);
$thirdPartyPayPalMethods = array();
foreach ($thirdPartyMethods as $thirdPartyMethod) {
$thirdPartyPayPalMethods[$thirdPartyMethod] = true;
}
return $thirdPartyPayPalMethods;
}


/**
* Override template file for different checkouts
* @return string
* Checks if iways_paypalplus_payment is active and a payment experience could be retrieved from PayPal
*
* @return bool
*/
public function getTemplate()
public function isPPPActive()
{
if (Mage::getStoreConfig('payment/iways_paypalplus_payment/active')) {
if (Mage::helper('iways_paypalplus')->isFirecheckout()) {
return self::DEFAULT_TEMPLATE;
}
if (Mage::helper('iways_paypalplus')->isMagestoreOsc()) {
return self::MAGESTORE_TEMPLATE;
$paymentExperience = Mage::helper('iways_paypalplus')->getPaymentExperience();

if ($paymentExperience) {
foreach ($this->getMethods() as $_method) {
if ($_method->getCode() == Iways_PayPalPlus_Model_Payment::METHOD_CODE) {
return true;
}
}
}
return parent::getTemplate();
return false;
}
}
15 changes: 0 additions & 15 deletions app/code/community/Iways/PayPalPlus/Block/Onepage/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,5 @@
*/
class Iways_PayPalPlus_Block_Onepage_Review extends Mage_Checkout_Block_Onepage_Review
{
/**
* Default PayPal Plus OnePage Review template for firecheckout
*/
const FIRECHECKOUT_TEMPLATE = 'paypalplus/firecheckout/checkout/review.phtml';

/**
* Override template file
* @return string
*/
public function getTemplate()
{
if (Mage::getStoreConfig('payment/iways_paypalplus_payment/active') && Mage::helper('core')->isModuleEnabled('TM_FireCheckout') && Mage::getStoreConfig('firecheckout/general/enabled')) {
return self::FIRECHECKOUT_TEMPLATE;
}
return parent::getTemplate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,12 @@
*/

/**
* Iways PayPalPlus Magestore Onestepcheckout
* Iways PayPalPlus Onepage Payment Methods Block
*
* @category Iways
* @package Iways_PayPalPlus
* @author robert
*/
class Iways_PayPalPlus_Block_Magestore_Onestepcheckout extends Magestore_Onestepcheckout_Block_Onestepcheckout
class Iways_PayPalPlus_Block_Onepage_Review_Button extends Mage_Core_Block_Template
{
/**
* Original template path
*/
const ORIGINAL_TEMPLATE = 'onestepcheckout/onestepcheckout.phtml';

/**
* Override template path
*/
const OVERRIDE_TEMPLATE = 'paypalplus/magestore/onestepcheckout.phtml';

/**
* Force overridden template for onestepcheckout but only for special template file
*
* @return string
*/
public function getTemplate()
{
return parent::getTemplate() == self::ORIGINAL_TEMPLATE ? self::OVERRIDE_TEMPLATE : parent::getTemplate();
}
}
61 changes: 55 additions & 6 deletions app/code/community/Iways/PayPalPlus/Block/Onepage/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
*/
class Iways_PayPalPlus_Block_Onepage_Success extends Mage_Checkout_Block_Onepage_Review
{
/**
* Store name config path
*/
const STORE_NAME_PATH = 'general/store_information/name';

/**
* Current order to work with.
*
* @var Mage_Sales_Model_Order
*/
protected $_order;

/**
* Payment Code
*/
const IWAYS_PAYPALPLUS_PAYMENT = 'iways_paypalplus_payment';
/**
* Caches given order.
*
Expand All @@ -54,10 +55,58 @@ public function _construct()
* Check if last order is PayPalPlus
* @return bool
*/
public function isPPP() {
if($this->_order->getPayment()->getMethodInstance()->getCode() == self::IWAYS_PAYPALPLUS_PAYMENT) {
public function isPPP()
{
if ($this->_order->getPayment()->getMethodInstance()->getCode() == Iways_PayPalPlus_Model_Payment::METHOD_CODE) {
return true;
}
return false;
}

/**
* Checks if order is PayPal Plus and PuI
*
* @return bool
*/
public function isPUI()
{
return (
$this->isPPP()
&& (
$this->_order->getPayment()->getData('ppp_pui_instruction_type')
== Iways_PayPalPlus_Model_Payment::PPP_PUI_INSTRUCTION_TYPE
)
) ? true : false;
}

/**
* Checks if order is PayPal Plus and has payment instructions
*
* @return bool
*/
public function hasPaymentInstruction()
{
return ($this->isPPP() && $this->_order->getPayment()->getData('ppp_pui_instruction_type')) ? true : false;
}

/**
* Wrapper for $payment->getData($key)
*
* @param $key
* @return array|mixed|null
*/
public function getAdditionalInformation($key)
{
return $this->_order->getPayment()->getData($key);
}

/**
* Get store name from config
*
* @return string|null
*/
public function getStoreName()
{
return Mage::getStoreConfig(self::STORE_NAME_PATH);
}
}
Loading

0 comments on commit cd8789e

Please sign in to comment.