Skip to content

Commit

Permalink
Release 1.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrowanwallee committed Aug 18, 2022
1 parent 2d2531f commit 89a6694
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This repository contains the Magento 1 extension that enables to process payment

## Documentation

* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html)
* [Documentation](https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html)

## Support

Expand All @@ -34,4 +34,4 @@ For Magento 1.6.x you need to install the [Magento compatibility module](https:/

## License

Please see the [license file](https://github.com/wallee-payment/magento-1/blob/1.1.6/LICENSE) for more information.
Please see the [license file](https://github.com/wallee-payment/magento-1/blob/1.1.7/LICENSE) for more information.
63 changes: 49 additions & 14 deletions app/code/community/Wallee/Payment/Model/Service/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
*/
class Wallee_Payment_Model_Service_LineItem extends Wallee_Payment_Model_Service_Abstract
{
/**
* Defines the maximum length that the name of the product can have.
* This limit is defined by the SDK.
*/
const MAX_PRODUCT_NAME_LENGTH = 150;

/**
* Returns the line items for the given invoice, with reduced amounts to match the expected sum.
Expand Down Expand Up @@ -89,11 +94,15 @@ protected function getInvoiceShippingLineItem(Mage_Sales_Model_Order_Invoice $in
if (Mage::getStoreConfig('wallee_payment/line_item/overwrite_shipping_description',
$invoice->getStore())) {
$lineItem->setName(
Mage::getStoreConfig('wallee_payment/line_item/custom_shipping_description',
$invoice->getStore()));
$this->processLineItemName(
Mage::getStoreConfig('wallee_payment/line_item/custom_shipping_description',
$invoice->getStore())
)
);
} else {
$lineItem->setName($invoice->getOrder()
->getShippingDescription());
$lineItem->setName(
$this->processLineItemName($invoice->getOrder()->getShippingDescription())
);
}

$lineItem->setQuantity(1);
Expand Down Expand Up @@ -198,7 +207,7 @@ protected function getProductLineItem($productItem, $currency)
{
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
$lineItem->setAmountIncludingTax($this->roundAmount($productItem->getRowTotalInclTax(), $currency));
$lineItem->setName($productItem->getName());
$lineItem->setName($this->processLineItemName($productItem->getName()));
$lineItem->setQuantity($productItem->getQty() ? $productItem->getQty() : $productItem->getQtyOrdered());
$lineItem->setShippingRequired(! $productItem->getIsVirtual());
$lineItem->setSku($productItem->getSku());
Expand Down Expand Up @@ -350,10 +359,13 @@ protected function getShippingLineItem($entity)
if (Mage::getStoreConfig('wallee_payment/line_item/overwrite_shipping_description',
$entity->getStore())) {
$lineItem->setName(
Mage::getStoreConfig('wallee_payment/line_item/custom_shipping_description',
$entity->getStore()));
$this->processLineItemName(
Mage::getStoreConfig('wallee_payment/line_item/custom_shipping_description',
$entity->getStore())
)
);
} else {
$lineItem->setName($shippingInfo->getShippingDescription());
$lineItem->setName($this->processLineItemName($shippingInfo->getShippingDescription()));
}

$lineItem->setQuantity(1);
Expand Down Expand Up @@ -423,7 +435,7 @@ protected function getFoomanSurchargeLineItem($entity)
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
$lineItem->setAmountIncludingTax(
$this->roundAmount($entity->getFoomanSurchargeAmount(), $this->getCurrencyCode($entity)));
$lineItem->setName($entity->getFoomanSurchargeDescription());
$lineItem->setName($this->processLineItemName($entity->getFoomanSurchargeDescription()));
$lineItem->setQuantity(1);
$lineItem->setSku('surcharge');
$tax = $this->getSurchargeTax($entity);
Expand Down Expand Up @@ -482,8 +494,7 @@ protected function getMX2GiftCardLineItem($entity)
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
$lineItem->setAmountIncludingTax(
$this->roundAmount(- 1 * $entity->getGiftCardsAmount(), $this->getCurrencyCode($entity)));
$lineItem->setName($this->getHelper()
->__('Giftcard'));
$lineItem->setName($this->processLineItemName($this->getHelper()->__('Giftcard')));
$lineItem->setQuantity(1);
$lineItem->setSku('giftcard');
$lineItem->setType(\Wallee\Sdk\Model\LineItemType::DISCOUNT);
Expand Down Expand Up @@ -515,8 +526,9 @@ protected function getAWGiftCardLineItems($entity)
$lineItem = new \Wallee\Sdk\Model\LineItemCreate();
$lineItem->setAmountIncludingTax(
$this->roundAmount(- 1 * $giftcard->getGiftcardAmount(), $this->getCurrencyCode($entity)));
$lineItem->setName($this->getHelper()
->__('Giftcard (%s)', $giftcardModel->getCode()));
$lineItem->setName($this->processLineItemName(
$this->getHelper()->__('Giftcard (%s)', $giftcardModel->getCode())
));
$lineItem->setQuantity(1);
$lineItem->setSku('giftcard_' . $giftcard->getGiftcardId());
$lineItem->setType(\Wallee\Sdk\Model\LineItemType::DISCOUNT);
Expand Down Expand Up @@ -556,7 +568,9 @@ protected function getTax($item)
protected function cleanLineItem(\Wallee\Sdk\Model\LineItemCreate $lineItem)
{
$lineItem->setSku($this->fixLength($this->removeLinebreaks($lineItem->getSku()), 200));
$lineItem->setName($this->fixLength($this->removeLinebreaks($lineItem->getName()), 150));
$lineItem->setName($this->processLineItemName(
$this->fixLength($this->removeLinebreaks($lineItem->getName()), self::MAX_PRODUCT_NAME_LENGTH)
));
return $lineItem;
}

Expand Down Expand Up @@ -584,4 +598,25 @@ protected function getLineItemHelper()
{
return Mage::helper('wallee_payment/lineItem');
}

/**
* Checks that the name meets the SDK's expected length
* This is an auxiliar method.
*
* As the SDK defines a maximum limit for the length of the product name,
* this function shortens this name.
*
* @see \Wallee\Sdk\Model\LineItemCreate::setName()
*
* @param string $name
* The name to be processed.
* @return string
* Returns the name shorten if needed.
*/
protected function processLineItemName($name) {
if (strlen($name) > self::MAX_PRODUCT_NAME_LENGTH) {
$name = substr($name, 0, self::MAX_PRODUCT_NAME_LENGTH);
}
return $name;
}
}
4 changes: 2 additions & 2 deletions app/code/community/Wallee/Payment/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<config>
<modules>
<Wallee_Payment>
<version>1.1.6</version>
<version>1.1.7</version>
</Wallee_Payment>
</modules>
<global>
Expand Down Expand Up @@ -357,7 +357,7 @@
<default>
<wallee_payment>
<information>
<version>1.1.6</version>
<version>1.1.7</version>
<sdk_version>2.1.5</sdk_version>
</information>
<general>
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Wallee/Payment/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<comment><![CDATA[If you need help setting up the wallee extension, check out the <a href="https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<fields>
<version translate="label">
<label>Module Version</label>
Expand Down
2 changes: 1 addition & 1 deletion app/locale/de_DE/Wallee_Payment.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Giftcard (%s)","Geschenkkarte (%s)"
"Giftcard","Geschenkkarte"
"Hold Delivery","Lieferung halten"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der wallee-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"Inactive","Inaktiv"
"Information","Informationen"
"Line Items","Positionen"
Expand Down
2 changes: 1 addition & 1 deletion app/locale/en_US/Wallee_Payment.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Giftcard (%s)","Giftcard (%s)"
"Giftcard","Giftcard"
"Hold Delivery","Hold Delivery"
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.6/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the wallee extension, check out the <a href=""https://plugin-documentation.wallee.com/wallee-payment/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"Inactive","Inactive"
"Information","Information"
"Line Items","Line Items"
Expand Down
4 changes: 2 additions & 2 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/magento-1/releases/tag/1.1.6/">
<a href="https://github.com/wallee-payment/magento-1/releases/tag/1.1.7/">
Source
</a>
</li>
Expand Down Expand Up @@ -51,7 +51,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/wallee-payment/magento-1/releases/tag/1.1.6/">Download</a> the extension.</p>
<p><a href="https://github.com/wallee-payment/magento-1/releases/tag/1.1.7/">Download</a> the extension.</p>
</li>
<li>
<p>Extract the files and upload them to the root directory of your store using FTP/SSH.</p>
Expand Down

0 comments on commit 89a6694

Please sign in to comment.