RybonsCoupon - Version 1.0.0

Version Notes

Release version

Download this release

Release Info

Developer Panthelope Tech
Extension RybonsCoupon
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (34) hide show
  1. app/code/community/PanthelopeTechnologies/.DS_Store +0 -0
  2. app/code/community/PanthelopeTechnologies/RybonsCoupon/.DS_Store +0 -0
  3. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/.DS_Store +0 -0
  4. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Discount.php +15 -0
  5. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/.DS_Store +0 -0
  6. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/.DS_Store +0 -0
  7. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/Totals/.DS_Store +0 -0
  8. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/Totals/Discount.php +29 -0
  9. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/.DS_Store +0 -0
  10. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/Totals/.DS_Store +0 -0
  11. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/Totals/Discount.php +29 -0
  12. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/.DS_Store +0 -0
  13. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/Totals/.DS_Store +0 -0
  14. app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/Totals/Discount.php +28 -0
  15. app/code/community/PanthelopeTechnologies/RybonsCoupon/Helper/Data.php +51 -0
  16. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/.DS_Store +0 -0
  17. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Creditmemo/Total.php +42 -0
  18. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Invoice/Total/RybonsCoupon.php +47 -0
  19. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Invoice/Total/Tax.php +76 -0
  20. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Observer.php +108 -0
  21. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Quote/Total/RybonsCoupon.php +115 -0
  22. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Quote/Total/Tax.php +86 -0
  23. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/RybonsCoupon.php +15 -0
  24. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Source/Discount.php +41 -0
  25. app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Status.php +21 -0
  26. app/code/community/PanthelopeTechnologies/RybonsCoupon/controllers/Adminhtml/ExtendoController.php +16 -0
  27. app/code/community/PanthelopeTechnologies/RybonsCoupon/controllers/IndexController.php +107 -0
  28. app/code/community/PanthelopeTechnologies/RybonsCoupon/etc/config.xml +216 -0
  29. app/code/community/PanthelopeTechnologies/RybonsCoupon/etc/system.xml +98 -0
  30. app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-install-0.1.0.php +7 -0
  31. app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.2-0.4.3.php +7 -0
  32. app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.3-0.4.4.php +8 -0
  33. app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.4-0.4.5.php +28 -0
  34. package.xml +18 -0
app/code/community/PanthelopeTechnologies/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Discount.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * PanthelopeTechnologies API Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Block_Discount extends Mage_Core_Block_Template {
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+ }
14
+
15
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/Totals/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Creditmemo/Totals/Discount.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Suregits Giftcard API Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Sodiq<damilolasodiq@gmail.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Block_Sales_Creditmemo_Totals_Discount extends Mage_Core_Block_Abstract {
10
+
11
+ public function initTotals() {
12
+ $parent = $this->getParentBlock();
13
+ $this->_creditmemo = Mage_Adminhtml_Block_Sales_Items_Abstract::getCreditmemo();
14
+ $couponDiscountAmount = $this->_creditmemo->getRybonsCouponDiscount();
15
+ $giftcardDiscountTaxAmount = $this->_creditmemo->getRybonsCouponDiscountTax();
16
+
17
+ if ($couponDiscountAmount > 0) {
18
+
19
+ $couponDiscountTotal = new Varien_Object(array(
20
+ 'code' => 'RybonsCoupon_discount',
21
+ 'label' => $this->__('Rybons Coupon Discount'),
22
+ 'value' => -$couponDiscountAmount,
23
+ ));
24
+ $parent->addTotalBefore($couponDiscountTotal, 'tax');
25
+ }
26
+ return $this;
27
+ }
28
+
29
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/Totals/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Invoice/Totals/Discount.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Giftcard API Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Block_Sales_Invoice_Totals_Discount extends Mage_Core_Block_Abstract {
10
+
11
+ public function initTotals() {
12
+ $parent = $this->getParentBlock();
13
+ $this->_invoice = Mage_Adminhtml_Block_Sales_Items_Abstract::getInvoice();
14
+ $couponDiscountAmount = $this->_invoice->getRybonsCouponDiscount();
15
+ $giftcardDiscounttTaxAmount = $this->_invoice->getRybonsCouponDiscountTax();
16
+
17
+ if ($couponDiscountAmount > 0) {
18
+
19
+ $giftcardDiscountTotal = new Varien_Object(array(
20
+ 'code' => 'RybonsCoupon_discount',
21
+ 'label' => $this->__('Rybons Coupon Discount'),
22
+ 'value' => -$couponDiscountAmount,
23
+ ));
24
+ $parent->addTotalBefore($giftcardDiscountTotal, 'tax');
25
+ }
26
+ return $this;
27
+ }
28
+
29
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/Totals/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Block/Sales/Order/Totals/Discount.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Giftcard API Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Block_Sales_Order_Totals_Discount extends Mage_Core_Block_Abstract {
10
+
11
+ public function initTotals() {
12
+ $_order = $this->getParentBlock()->getOrder();
13
+ $couponDiscountAmount = $this->getParentBlock()->getSource()->getRybonsCouponDiscount();
14
+ $couponDiscountTaxAmount = $this->getParentBlock()->getSource()->getRybonsCouponDiscountTax();
15
+
16
+ if ($couponDiscountAmount > 0) {
17
+
18
+ $giftcardDiscountTotal = new Varien_Object(array(
19
+ 'code' => 'RybonsCoupon_discount',
20
+ 'label' => $this->__('Rybons Coupon Discount'),
21
+ 'value' => -$couponDiscountAmount,
22
+ ));
23
+ $this->getParentBlock()->addTotalBefore($giftcardDiscountTotal, 'grand_total');
24
+ }
25
+ return $this;
26
+ }
27
+
28
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Helper/Data.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Helper_Data extends Mage_Core_Helper_Abstract {
10
+
11
+ protected $_couponDiscountIncludesTax;
12
+ protected $_creditPriceIncludesTax;
13
+
14
+ public function isEnabled() {
15
+ return true;
16
+ }
17
+
18
+ public function couponDiscountIncludesTax($store = null) {
19
+ $storeId = Mage::app()->getStore($store)->getId();
20
+ if (!isset($this->_couponDiscountIncludesTax[$storeId])) {
21
+ $this->_creditPriceIncludesTax[$storeId] = (int) Mage::getStoreConfig(
22
+ PanthelopeTechnologies_RybonsCoupon_Model_Quote_Total_Tax::CONFIG_XML_PATH_GIFTDISCOUNT_INCLUDES_TAX, $storeId
23
+ );
24
+ }
25
+ return $this->_couponDiscountIncludesTax[$storeId];
26
+ }
27
+
28
+ public function getRybonsCouponDiscountTax($price, $includingTax = null, $shippingAddress = null, $ctc = null, $store = null) {
29
+ $billingAddress = false;
30
+ if ($shippingAddress && $shippingAddress->getQuote() && $shippingAddress->getQuote()->getBillingAddress()) {
31
+ $billingAddress = $shippingAddress->getQuote()->getBillingAddress();
32
+ }
33
+
34
+ $calc = Mage::getSingleton('tax/calculation');
35
+ $taxRequest = $calc->getRateRequest(
36
+ $shippingAddress, $billingAddress, $shippingAddress->getQuote()->getCustomerTaxClassId(), $store
37
+ );
38
+
39
+ $taxRequest->setProductClassId($this->getRybonsCouponDiscountTaxClass($store));
40
+ $rate = $calc->getRate($taxRequest);
41
+ $tax = $calc->calcTaxAmount($price, $rate, $this->couponDiscountIncludesTax($store), true);
42
+ return $tax;
43
+ }
44
+
45
+ public function getRybonsCouponDiscountTaxClass($store) {
46
+ return (int) Mage::getStoreConfig(
47
+ PanthelopeTechnologies_RybonsCoupon_Model_Quote_Total_Tax::CONFIG_XML_PATH_GIFTDISCOUNT_TAX_CLASS, $store
48
+ );
49
+ }
50
+
51
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/.DS_Store ADDED
Binary file
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Creditmemo/Total.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Creditmemo_Total extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
10
+
11
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
12
+
13
+ $order = $creditmemo->getOrder();
14
+
15
+ $baseCreditmemoTotal = $creditmemo->getBaseGrandTotal();
16
+ $creditmemoTotal = $creditmemo->getGrandTotal();
17
+ $baseRybonsCouponDiscountInvoiced = $order->getBaseRybonsCouponDiscountInvoiced();
18
+ $RybonsCouponDiscountInvoiced = $order->getRybonsCouponDiscountInvoiced();
19
+
20
+ if ($creditmemo->getInvoice()) {
21
+ $invoice = $creditmemo->getInvoice();
22
+ $baseRybonsCouponDiscountToCredit = $invoice->getBaseRybonsCouponDiscount();
23
+ $RybonsCouponDiscountToCredit = $invoice->getRybonsCouponDiscount();
24
+ } else {
25
+ $baseRybonsCouponDiscountToCredit = $baseRybonsCouponDiscountInvoiced;
26
+ $RybonsCouponDiscountToCredit = $RybonsCouponDiscountInvoiced;
27
+ }
28
+
29
+ if (!$baseRybonsCouponDiscountToCredit > 0) {
30
+ return $this;
31
+ }
32
+
33
+ $creditmemo->setBaseGrandTotal($baseCreditmemoTotal - $baseRybonsCouponDiscountToCredit);
34
+ $creditmemo->setGrandTotal($creditmemoTotal - $RybonsCouponDiscountToCredit);
35
+
36
+ $creditmemo->setBaseRybonsCouponDiscount($baseRybonsCouponDiscountToCredit);
37
+ $creditmemo->setRybonsCouponDiscount($RybonsCouponDiscountToCredit);
38
+
39
+ return $this;
40
+ }
41
+
42
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Invoice/Total/RybonsCoupon.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Invoice_Total_RybonsCoupon extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
10
+
11
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
12
+
13
+ $order = $invoice->getOrder();
14
+
15
+ if (!$order->getBaseRybonsCouponDiscount() || $order->getBaseRybonsCouponDiscount() == $order->getBaseRybonsCouponDiscountInvoiced()) {
16
+ return $this;
17
+ }
18
+
19
+ $baseRybonsCouponDiscount = $order->getBaseRybonsCouponDiscount();
20
+ $baseRybonsCouponDiscountInvoiced = floatval($order->getBaseRybonsCouponDiscountInvoiced());
21
+ $baseInvoiceTotal = $invoice->getBaseGrandTotal();
22
+ $giftcardDiscount = $order->getRybonsCouponDiscount();
23
+ $giftcardDiscountInvoiced = floatval($order->getRybonsCouponDiscountInvoiced());
24
+ $invoiceTotal = $invoice->getGrandTotal();
25
+
26
+ if (!$baseRybonsCouponDiscount || $baseRybonsCouponDiscountInvoiced == $baseRybonsCouponDiscount) {
27
+ return $this;
28
+ }
29
+
30
+ $baseRybonsCouponDiscountToInvoice = $baseRybonsCouponDiscount - $baseRybonsCouponDiscountInvoiced;
31
+ $giftcardDiscountToInvoice = $giftcardDiscount - $giftcardDiscountInvoiced;
32
+ $giftcardDiscountTax = $invoice->getOrder()->getRybonsCouponDiscountTax();
33
+ $baseRybonsCouponDiscountTax = $invoice->getOrder()->getBaseRybonsCouponDiscountTax();
34
+ $baseInvoiceTotal = $baseInvoiceTotal - $baseRybonsCouponDiscountToInvoice;
35
+ $invoiceTotal = $invoiceTotal - $giftcardDiscountToInvoice;
36
+ $invoice->setBaseGrandTotal($baseInvoiceTotal);
37
+ $invoice->setGrandTotal($invoiceTotal);
38
+ $invoice->setBaseRybonsCouponDiscount($baseRybonsCouponDiscountToInvoice);
39
+ $invoice->setRybonsCouponDiscount($giftcardDiscountToInvoice);
40
+
41
+ $order->setBaseRybonsCouponDiscountInvoiced($baseRybonsCouponDiscountInvoiced + $baseRybonsCouponDiscountToInvoice);
42
+ $order->setRybonsCouponDiscountInvoiced($giftcardDiscountInvoiced + $giftcardDiscountToInvoice);
43
+
44
+ return $this;
45
+ }
46
+
47
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Invoice/Total/Tax.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * RybonsCoupon Extension
5
+ *
6
+ * PHP versions 4 and 5
7
+ *
8
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
9
+ * that is available through the world-wide-web at the following URI:
10
+ * http://www.store.onlinebizsoft.com/license.txt. If you did not receive a copy of
11
+ * the PHP License and are unable to obtain it through the web, please
12
+ * send a note to admin@onlinebizsoft.com so we can mail you a copy immediately.
13
+ *
14
+ * @category Magento Extensions
15
+ * @package PanthelopeTechnologies_RybonsCoupon
16
+ * @author OnlineBiz <sales@onlinebizsoft.com>
17
+ * @copyright 2007-2011 OnlineBiz
18
+ * @license http://www.store.onlinebizsoft.com/license.txt
19
+ * @version 1.0.1
20
+ * @link http://www.store.onlinebizsoft.com
21
+ */
22
+ class PanthelopeTechnologies_RybonsCoupon_Model_Invoice_Total_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
23
+
24
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
25
+ $memberDiscountTax = 0;
26
+ $baseMemberDiscountTax = 0;
27
+ $order = $invoice->getOrder();
28
+ if (!$order->getBaseRybonsCouponDiscountTax() || $order->getBaseRybonsCouponDiscountTax() == $order->getBaseRybonsCouponDiscountTaxInvoiced()) {
29
+ return $this;
30
+ }
31
+ $includeTax = true;
32
+ /**
33
+ * Check Member Discount amount in previus invoices
34
+ */
35
+ foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
36
+ if ($previusInvoice->getRybonsCouponDiscountTax() && !$previusInvoice->isCanceled()) {
37
+ $includeTax = false;
38
+ }
39
+ }
40
+
41
+ $rate = $order->getBaseRybonsCouponDiscountTax() / $order->getBaseRybonsCouponDiscountTax();
42
+
43
+ $memberDiscountTax = floatval($invoice->getRybonsCouponDiscount() * $rate);
44
+ $baseMemberDiscountTax = floatval($invoice->getBaseRybonsCouponDiscount() * $rate);
45
+
46
+ if ($includeTax) {
47
+ $invoice->setRybonsCouponDiscountTax($invoice->getOrder()->getRybonsCouponDiscountTax());
48
+ $invoice->setBaseRybonsCouponDiscountTax($invoice->getOrder()->getBaseRybonsCouponDiscountTax());
49
+ $order->setRybonsCouponDiscountTaxInvoiced(floatval($order->getRybonsCouponDiscountTaxInvoiced()) + $memberDiscountTax);
50
+ $order->setBaseRybonsCouponDiscountTaxInvoiced(floatval($order->getBaseRybonsCouponDiscountTaxInvoiced()) + $baseMemberDiscountTax);
51
+ }
52
+
53
+
54
+ /**
55
+ * Not isLast() invoice case handling
56
+ * totalTax adjustment
57
+ * check Mage_Sales_Model_Order_Invoice_Total_Tax::collect()
58
+ */
59
+ $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced();
60
+ $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();
61
+ $totalTax = $invoice->getTaxAmount();
62
+
63
+ $baseTotalTax = $invoice->getBaseTaxAmount();
64
+ $invoice->setTaxAmount($invoice->getTaxAmount() - $memberDiscountTax);
65
+ $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() - $baseMemberDiscountTax);
66
+ if ($invoice->isLast()) {
67
+ $invoice->setBaseSubtotalInclTax($invoice->getBaseSubtotalInclTax() + $invoice->getOrder()->getBaseRybonsCouponDiscountTax());
68
+ $invoice->setSubtotalInclTax($invoice->getSubtotalInclTax() + $invoice->getOrder()->getRybonsCouponDiscountTax());
69
+ }
70
+ //$order->setBaseRybonsCouponDiscountInvoiced(floatval($order->getBaseRybonsCouponDiscountInvoiced()) + floatval($invoice->getBaseRybonsCouponDiscount()));
71
+ //$order->setRybonsCouponDiscountInvoiced(floatval($order->getRybonsCouponDiscountInvoiced()) + floatval($invoice->getRybonsCouponDiscount()));
72
+
73
+ return $this;
74
+ }
75
+
76
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Observer.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Observer {
10
+
11
+ public function salesOrderSaveBefore($observer) {
12
+ $order = $observer->getEvent()->getOrder();
13
+ $coupon = Mage::getSingleton('checkout/session')->getAppliedRybonsCouponCode();
14
+ $order->setRybonsCouponCode($coupon);
15
+ //Mage::log("salesOrderSaveBefore | {$coupon}", null, 'rybons.log');
16
+ }
17
+
18
+ public function salesOrderSaveAfter($observer) {
19
+ $order = $observer->getEvent()->getOrder();
20
+ $coupon_code = $order->getRybonsCouponCode();
21
+ //Mage::log("salesOrderSaveAfter | $coupon_code", null, 'rybons.log');
22
+ if ($coupon_code) {
23
+ $array_config = Mage::getStoreConfig('RybonsCoupon/PanthelopeTechnologies_group', Mage::app()->getStore());
24
+ $merchantKey = $array_config['PanthelopeTechnologies_merchantKey'];
25
+ $mode = $array_config['PanthelopeTechnologies_connectionMode'];
26
+
27
+ $order_id = $order->getIncrementId();
28
+ //Mage::log("Mkey: {$merchantKey} | Mode: {$mode} | Coupon: {$coupon_code} | SubTotal: {$order->getSubtotal()} | OrderID: {$order_id}", null, 'rybons.log');
29
+
30
+ $details = array();
31
+ $details["customer"] = array(
32
+ "fname" => $order->getBillingAddress()->getFirstname(),
33
+ "lname" => $order->getBillingAddress()->getLastname(),
34
+ "email" => $order->getCustomerEmail(),
35
+ "phone" => $order->getCustomerTelephone(),
36
+ );
37
+
38
+ $details['order_id'] = $order_id;
39
+ $details['purchase_amount'] = $order->getSubtotal();
40
+
41
+ $url = "http://rybons.com.ng/webservice/coupons/apply.json";
42
+ if ($mode == "1") {
43
+ $url = "http://rybons.com.ng/webservice/coupons/apply.json";
44
+ }
45
+
46
+ $curl = curl_init();
47
+ curl_setopt_array($curl, array(
48
+ CURLOPT_RETURNTRANSFER => 1,
49
+ CURLOPT_URL => $url,
50
+ CURLOPT_USERAGENT => 'RYBONS Magento Extension',
51
+ CURLOPT_POST => 1,
52
+ CURLOPT_POSTFIELDS => array(
53
+ "coupon_code" => $coupon_code,
54
+ "merchant_key" => $merchantKey,
55
+ "buyer_details" => json_encode($details)
56
+ )
57
+ ));
58
+ $result = curl_exec($curl);
59
+ curl_close($curl);
60
+
61
+ if ($result != false) {
62
+ $response = json_decode($result, true);
63
+ if (isset($response["PayLoad"]["status"]) && $response["PayLoad"]["status"]) {
64
+ //$this->RybonsCoupon_destroySession();
65
+ } else {
66
+ $controllerAction = $observer->getEvent()->getControllerAction();
67
+ $result = array();
68
+ $result['error'] = '-1';
69
+ $result['message'] = $response["PayLoad"]["data"] != null ? $response["PayLoad"]["data"] : "Unable to apply your Rybons Coupon, it may have been used or expired.";
70
+ $controllerAction->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
71
+ exit;
72
+ }
73
+ } else {
74
+ $controllerAction = $observer->getEvent()->getControllerAction();
75
+ $result = array();
76
+ $result['error'] = '-1';
77
+ $result['message'] = "Unable to apply your Rybons Coupon";
78
+ $controllerAction->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
79
+ exit;
80
+ }
81
+
82
+ Mage::getSingleton('checkout/session')->setAppliedRybonsCouponCode("");
83
+ Mage::getSingleton('checkout/session')->getQuote()->setRybonsCouponCode('')->save();
84
+ Mage::getSingleton('checkout/session')->setUseRybonsCouponDiscount(false);
85
+ Mage::getSingleton('checkout/session')->setRybonsCouponDiscountAmount(0);
86
+ }
87
+ }
88
+
89
+ public function salesInvoiceCreateAfter($observer) {
90
+
91
+ }
92
+
93
+ public function getProductFinalPrice($observer) {
94
+
95
+ }
96
+
97
+ public function insertBlock($observer) {
98
+ $_block = $observer->getBlock();
99
+ $_type = $_block->getType();
100
+ if ($_type == 'checkout/cart_coupon') {
101
+ $_child = clone $_block;
102
+ $_child->setType('RybonsCoupon/discount');
103
+ $_block->setChild('child', $_child);
104
+ $_block->setTemplate('RybonsCoupon/discount.phtml');
105
+ }
106
+ }
107
+
108
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Quote/Total/RybonsCoupon.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Quote_Total_RybonsCoupon extends Mage_Sales_Model_Quote_Address_Total_Abstract {
10
+
11
+ public function __construct() {
12
+ $this->setCode('RybonsCoupon');
13
+ }
14
+
15
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
16
+ if (Mage::app()->getStore()->isAdmin()) {
17
+ $allItems = Mage::getSingleton('adminhtml/sales_order_create')->getQuote()->getAllItems();
18
+ $productIds = array();
19
+ foreach ($allItems as $item) {
20
+ $productIds[] = $item->getProductId();
21
+ }
22
+ } else {
23
+ $productIds = Mage::getSingleton('checkout/cart')->getProductIds();
24
+ }
25
+
26
+ if (count($productIds) == 0)
27
+ return $this;
28
+
29
+ $addressType = Mage_Sales_Model_Quote_Address::TYPE_BILLING;
30
+ foreach ($productIds as $productId) {
31
+ $productTypeId = Mage::getModel('catalog/product')->load($productId)->getTypeId();
32
+ if ($productTypeId != 'downloadable' && $productTypeId != 'virtual') {
33
+ $addressType = Mage_Sales_Model_Quote_Address::TYPE_SHIPPING;
34
+ break;
35
+ }
36
+ }
37
+
38
+ //shipping or billing
39
+ if ($addressType != $address->getAddressType())
40
+ return $this;
41
+ $discountAmount = 0;
42
+ $address->setRybonsCouponDiscount(0);
43
+ $address->setBaseRybonsCouponDiscount(0);
44
+ $address->setRybonsCouponDiscountTax(0);
45
+ $address->setBaseRybonsCouponDiscountTax(0);
46
+ $session = Mage::getSingleton('checkout/session');
47
+ if (!$session->getUseRybonsCouponDiscount())
48
+ return $this;
49
+ $orderData = Mage::app()->getRequest()->getPost('order');
50
+ if (Mage::getModel('checkout/cart')->getQuote()->getData('items_qty') == 0 && !Mage::getSingleton('adminhtml/session_quote')->getCustomerId()) {
51
+ return $this;
52
+ }
53
+
54
+ $quote = $address->getQuote();
55
+
56
+ $baseGrandTotal = floatval($address->getBaseGrandTotal());
57
+ $grandTotal = floatval($address->getGrandTotal());
58
+ $baseShipping = floatval($address->getBaseShippingInclTax());
59
+ $shipping = floatval($address->getShippingInclTax());
60
+ if ($baseGrandTotal)
61
+ $baseSubtotal = $baseGrandTotal - $baseShipping;
62
+ else
63
+ $baseSubtotal = floatval($address->getBaseSubtotalInclTax());
64
+ if ($grandTotal)
65
+ $subtotal = $grandTotal - $shipping;
66
+ else
67
+ $subtotal = floatval($address->getSubtotalInclTax());
68
+
69
+ $quote = $address->getQuote();
70
+ $store = $quote->getStore();
71
+ $quoteTotal = $baseSubtotal + $baseShipping;
72
+ $giftcardDiscount = array();
73
+ $giftcardDiscount[] = $session->getRybonsCouponDiscountAmount();
74
+ sort($giftcardDiscount, SORT_NUMERIC);
75
+ $discountAmount = $giftcardDiscount[0];
76
+
77
+ if ((int) $discountAmount >= (int) $address->getBaseGrandTotal())
78
+ $discountAmount = $address->getBaseGrandTotal();
79
+ $baseTax = floatval($address->getBaseTaxAmount());
80
+ $tax = floatval($address->getTaxAmount());
81
+
82
+ $taxAmount = Mage::helper('RybonsCoupon')->getRybonsCouponDiscountTax(
83
+ $discountAmount, true, $address, $address->getQuote()->getCustomerTaxClassId(), $store
84
+ );
85
+ $address->setBaseRybonsCouponDiscount($discountAmount);
86
+ $address->setRybonsCouponDiscount($store->convertPrice($discountAmount, false));
87
+
88
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() - $discountAmount);
89
+ $address->setGrandTotal($address->getGrandTotal() - $store->convertPrice($discountAmount, false));
90
+
91
+ $address->setBaseRybonsCouponDiscountTax($taxAmount);
92
+ $address->setRybonsCouponDiscountTax($store->convertPrice($taxAmount, false));
93
+ $session->setUseRybonsCouponDiscount(true);
94
+
95
+ return $this;
96
+ }
97
+
98
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
99
+ if (!Mage::helper('RybonsCoupon')->isEnabled())
100
+ return $this;
101
+
102
+ if ($address->getRybonsCouponDiscount() > 0) {
103
+ $quote = $address->getQuote();
104
+ $store = $quote->getStore();
105
+ $amount = $address->getRybonsCouponDiscount();
106
+
107
+ $address->addTotal(array(
108
+ 'code' => $this->getCode(),
109
+ 'title' => Mage::helper('RybonsCoupon')->__('RYBONS COUPON'),
110
+ 'value' => -$amount,
111
+ ));
112
+ }
113
+ }
114
+
115
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Quote/Total/Tax.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Quote_Total_Tax extends Mage_Sales_Model_Quote_Address_Total_Tax {
10
+
11
+ const CONFIG_XML_PATH_GIFTDISCOUNT_INCLUDES_TAX = 'tax/calculation/RybonsCoupon_includes_tax';
12
+ const CONFIG_XML_PATH_GIFTDISCOUNT_TAX_CLASS = 'tax/classes/RybonsCoupon_tax_class';
13
+
14
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
15
+ $store = $address->getQuote()->getStore();
16
+
17
+ $items = $address->getAllItems();
18
+ if (!count($items)) {
19
+ return $this;
20
+ }
21
+
22
+ $custTaxClassId = $address->getQuote()->getCustomerTaxClassId();
23
+
24
+ $taxCalculationModel = Mage::getSingleton('tax/calculation');
25
+ /* @var $taxCalculationModel Mage_Tax_Model_Calculation */
26
+ $request = $taxCalculationModel->getRateRequest(
27
+ $address, $address->getQuote()->getBillingAddress(), $custTaxClassId, $store
28
+ );
29
+ $giftcardTaxClass = Mage::helper('RybonsCoupon')->getRybonsCouponDiscountTaxClass($store);
30
+
31
+ $giftcardDiscountTax = 0;
32
+ $baseRybonsCouponDiscountTax = 0;
33
+
34
+ if ($giftcardTaxClass) {
35
+ if ($rate = $taxCalculationModel->getRate($request->setProductClassId($giftcardTaxClass))) {
36
+
37
+ $giftcardDiscountTax = $address->getRybonsCouponDiscountTax();
38
+ $baseRybonsCouponDiscountTax = $address->getBaseRybonsCouponDiscountTax();
39
+ $giftcardDiscountTax = $store->roundPrice($giftcardDiscountTax);
40
+ $baseRybonsCouponDiscountTax = $store->roundPrice($baseRybonsCouponDiscountTax);
41
+ $baseTax = $store->roundPrice($address->getBaseTaxAmount());
42
+ $tax = $store->roundPrice($address->getTaxAmount());
43
+ $address->setTaxAmount(floatval($tax - $giftcardDiscountTax));
44
+ $address->setBaseTaxAmount(floatval($baseTax - $baseRybonsCouponDiscountTax));
45
+
46
+ $this->_saveAppliedTaxes(
47
+ $address, $taxCalculationModel->getAppliedRates($request), $giftcardDiscountTax, $baseRybonsCouponDiscountTax, $rate
48
+ );
49
+ }
50
+ }
51
+
52
+ $address->setGrandTotal($address->getGrandTotal() - $address->getRybonsCouponDiscountTax());
53
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseRybonsCouponDiscountTax());
54
+
55
+ return $this;
56
+ }
57
+
58
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
59
+ $store = $address->getQuote()->getStore();
60
+ /**
61
+ * Modify subtotal
62
+ */
63
+ if (Mage::getSingleton('tax/config')->displayCartSubtotalBoth($store) ||
64
+ Mage::getSingleton('tax/config')->displayCartSubtotalInclTax($store)) {
65
+ if ($address->getSubtotalInclTax() > 0) {
66
+ $subtotalInclTax = $address->getSubtotalInclTax();
67
+ } else {
68
+ $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() -
69
+ $address->getShippingTaxAmount() - $address->getRybonsCouponDiscountTax();
70
+ }
71
+
72
+ $address->addTotal(
73
+ array(
74
+ 'code' => 'subtotal',
75
+ 'title' => Mage::helper('sales')->__('Subtotal'),
76
+ 'value' => $subtotalInclTax,
77
+ 'value_incl_tax' => $subtotalInclTax,
78
+ 'value_excl_tax' => $address->getSubtotal()
79
+ )
80
+ );
81
+ }
82
+
83
+ return $this;
84
+ }
85
+
86
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/RybonsCoupon.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_RybonsCoupon extends Mage_Core_Model_Abstract {
10
+
11
+ public function _construct() {
12
+ parent::_construct();
13
+ }
14
+
15
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Source/Discount.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Source_Discount {
10
+
11
+ const FIXED_TYPE = '1';
12
+ const PERCENTAGE_TYPE = '2';
13
+
14
+ /*
15
+ * Returns array of style options
16
+ * @return array Options array like id => name
17
+ */
18
+
19
+ public static function toShortOptionArray() {
20
+ $helper = Mage::helper('RybonsCoupon');
21
+ $result = array(
22
+ self::FIXED_TYPE => $helper->__('Fixed'),
23
+ self::PERCENTAGE_TYPE => $helper->__('Percentage')
24
+ );
25
+ return $result;
26
+ }
27
+
28
+ public static function toOptionArray() {
29
+ $options = self::toShortOptionArray();
30
+ $res = array();
31
+
32
+ foreach ($options as $k => $v)
33
+ $res[] = array(
34
+ 'value' => $k,
35
+ 'label' => $v
36
+ );
37
+
38
+ return $res;
39
+ }
40
+
41
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/Model/Status.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Model_Status extends Varien_Object {
10
+
11
+ const STATUS_ENABLED = 1;
12
+ const STATUS_DISABLED = 2;
13
+
14
+ static public function getOptionArray() {
15
+ return array(
16
+ self::STATUS_ENABLED => Mage::helper('RybonsCoupon')->__('Enabled'),
17
+ self::STATUS_DISABLED => Mage::helper('RybonsCoupon')->__('Disabled')
18
+ );
19
+ }
20
+
21
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/controllers/Adminhtml/ExtendoController.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_Adminhtml_ExtendoController extends Mage_Adminhtml_Controller_Action {
10
+
11
+ public function indexAction() {
12
+ $this->loadLayout();
13
+ $this->renderLayout();
14
+ }
15
+
16
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/controllers/IndexController.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Rybons Coupon Extension
5
+ * @category Magento Extensions
6
+ * @package PanthelopeTechnologies_RybonsCoupon
7
+ * @author Pathelope Technologies <info@panthelope.com>
8
+ */
9
+ class PanthelopeTechnologies_RybonsCoupon_IndexController extends Mage_Core_Controller_Front_Action {
10
+
11
+ protected function _getSession() {
12
+ return Mage::getSingleton('checkout/session');
13
+ }
14
+
15
+ public function indexAction() {
16
+ $this->loadLayout();
17
+ $this->renderLayout();
18
+ }
19
+
20
+ public function reorderAction() {
21
+ $orderId = $this->getRequest()->getParam('order_id');
22
+ $order = Mage::getModel('sales/order')->load($orderId);
23
+ }
24
+
25
+ public function getRybonsCouponAction() {
26
+ $data = $this->getRequest()->getPost();
27
+ if ($data) {
28
+ if ($data['submitAction'] == "remove") {
29
+ $this->_getSession()->getQuote()->setRybonsCouponCode('')->save();
30
+ $this->_getSession()->setUseRybonsCouponDiscount(false);
31
+ $this->_getSession()->setRybonsCouponDiscountAmount(0);
32
+ $this->_getSession()->setAppliedRybonsCouponCode("");
33
+ $this->_getSession()->addSuccess($this->__('Rybons coupon has been removed.'));
34
+ $this->_redirect('checkout/cart');
35
+ return;
36
+ }
37
+ if ($data['coupon'] == '') {
38
+ $this->_getSession()->addError($this->__('Please enter a Rybons coupon code.'));
39
+ $this->_redirect('checkout/cart');
40
+ return;
41
+ }
42
+
43
+
44
+ $array_config = Mage::getStoreConfig('RybonsCoupon/PanthelopeTechnologies_group', Mage::app()->getStore());
45
+ $merchantKey = $array_config['PanthelopeTechnologies_merchantKey'];
46
+ $mode = $array_config['PanthelopeTechnologies_connectionMode'];
47
+ $coupon_code = $data['coupon'];
48
+ //Mage::log("Mkey: {$merchantKey} | Mode: {$mode} | Coupon: {$coupon_code} | SubTotal: {$this->_getSession()->getQuote()->getSubtotal()}", null, 'rybons.log');
49
+
50
+ $url = "http://rybons.com.ng/webservice/coupons/get.json";
51
+ if ($mode == "1") {
52
+ $url = "http://rybons.com.ng/webservice/coupons/get.json";
53
+ }
54
+
55
+ $postFields = "?coupon_code={$coupon_code}&merchant_key={$merchantKey}";
56
+ $url .= $postFields;
57
+ $curl = curl_init();
58
+ curl_setopt_array($curl, array(
59
+ CURLOPT_RETURNTRANSFER => 1,
60
+ CURLOPT_URL => $url,
61
+ CURLOPT_USERAGENT => 'RYBONS Magento Extension'
62
+ ));
63
+ $result = curl_exec($curl);
64
+ curl_close($curl);
65
+
66
+ //Mage::log($result, null, 'rybons.log');
67
+ if ($result != false) {
68
+ $response = json_decode($result, true);
69
+ if (isset($response["PayLoad"]["status"]) && $response["PayLoad"]["status"]) {
70
+ $couponResponse = $response["PayLoad"]["data"]["Coupon"];
71
+ $error = "";
72
+ $couponValue = $this->getRybonsCouponValue($couponResponse, $error);
73
+ if ($couponValue > 0) {
74
+ $this->_getSession()->setAppliedRybonsCouponCode($coupon_code);
75
+ $this->_getSession()->getQuote()->setRybonsCouponCode($coupon_code)->save();
76
+ $this->_getSession()->addSuccess($this->__('Your Rybons Coupon has been applied.'));
77
+ $this->_getSession()->setUseRybonsCouponDiscount(true);
78
+ $this->_getSession()->setRybonsCouponDiscountAmount($couponValue);
79
+ } else {
80
+ $this->_getSession()->setAppliedRybonsCouponCode("");
81
+ $this->_getSession()->getQuote()->setRybonsCouponCode('')->save();
82
+ $this->_getSession()->setUseRybonsCouponDiscount(false);
83
+ $this->_getSession()->setRybonsCouponDiscountAmount(0);
84
+ $this->_getSession()->addError($this->__($error));
85
+ }
86
+ } else {
87
+ $this->_getSession()->setAppliedRybonsCouponCode("");
88
+ $this->_getSession()->getQuote()->setRybonsCouponCode('')->save();
89
+ $this->_getSession()->setUseRybonsCouponDiscount(false);
90
+ $this->_getSession()->setRybonsCouponDiscountAmount(0);
91
+ $this->_getSession()->addError($this->__($response["PayLoad"]["data"]));
92
+ }
93
+ }
94
+ }
95
+ $this->_redirect('checkout/cart');
96
+ }
97
+
98
+ private function getRybonsCouponValue($couponResponse, &$error = null) {
99
+ if ($this->_getSession()->getQuote()->getSubtotal() > $couponResponse['minimum_purchase_value']) {
100
+ return $couponResponse["percentage_coupon_value"] > 0 ? (($couponResponse["percentage_coupon_value"] / 100) * $this->_getSession()->getQuote()->getSubtotal()) : $couponResponse['flat_coupon_value'];
101
+ } else {
102
+ $error = "A minimum purchase amount of N" . number_format($couponResponse['minimum_purchase_value'], 2) . " is required.";
103
+ }
104
+ return 0.00;
105
+ }
106
+
107
+ }
app/code/community/PanthelopeTechnologies/RybonsCoupon/etc/config.xml ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <PanthelopeTechnologies_RybonsCoupon>
5
+ <version>1.0.0</version>
6
+ </PanthelopeTechnologies_RybonsCoupon>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <RybonsCoupon>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>PanthelopeTechnologies_RybonsCoupon</module>
14
+ <frontName>RybonsCoupon</frontName>
15
+ </args>
16
+ </RybonsCoupon>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <RybonsCoupon>
21
+ <file>RybonsCoupon.xml</file>
22
+ </RybonsCoupon>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <PanthelopeTechnologies_RybonsCoupon>
28
+ <files>
29
+ <default>PanthelopeTechnologies_RybonsCoupon.csv</default>
30
+ </files>
31
+ </PanthelopeTechnologies_RybonsCoupon>
32
+ </modules>
33
+ </translate>
34
+ </frontend>
35
+ <adminhtml>
36
+ <translate>
37
+ <modules>
38
+ <PanthelopeTechnologies_RybonsCoupon>
39
+ <files>
40
+ <default>PanthelopeTechnologies_RybonsCoupon.csv</default>
41
+ </files>
42
+ </PanthelopeTechnologies_RybonsCoupon>
43
+ </modules>
44
+ </translate>
45
+ <acl>
46
+ <resources>
47
+ <admin>
48
+ <children>
49
+ <system>
50
+ <children>
51
+ <config>
52
+ <children>
53
+ <RybonsCoupon translate="title" module="RybonsCoupon">
54
+ <title>Options</title>
55
+ <sort_order>100</sort_order>
56
+ </RybonsCoupon>
57
+ </children>
58
+ </config>
59
+ </children>
60
+ </system>
61
+ </children>
62
+ </admin>
63
+ </resources>
64
+ </acl>
65
+ <default>
66
+ <RybonsCoupon>
67
+ <PanthelopeTechnologies_group>
68
+ <PanthelopeTechnologies_mode>0</PanthelopeTechnologies_mode>
69
+ </PanthelopeTechnologies_group>
70
+ </RybonsCoupon>
71
+ </default>
72
+ </adminhtml>
73
+ <global>
74
+
75
+ <events>
76
+ <core_block_abstract_to_html_before>
77
+ <observers>
78
+ <RybonsCoupon_observer>
79
+ <type>singleton</type>
80
+ <class>RybonsCoupon/observer</class>
81
+ <method>insertBlock</method>
82
+ </RybonsCoupon_observer>
83
+ </observers>
84
+ </core_block_abstract_to_html_before>
85
+ <sales_order_save_before>
86
+ <observers>
87
+ <RybonsCoupon_observer>
88
+ <type>singleton</type>
89
+ <class>RybonsCoupon/observer</class>
90
+ <method>salesOrderSaveBefore</method>
91
+ </RybonsCoupon_observer>
92
+ </observers>
93
+ </sales_order_save_before>
94
+ <sales_order_save_after>
95
+ <observers>
96
+ <RybonsCoupon_observer>
97
+ <type>singleton</type>
98
+ <class>RybonsCoupon/observer</class>
99
+ <method>salesOrderSaveAfter</method>
100
+ </RybonsCoupon_observer>
101
+ </observers>
102
+ </sales_order_save_after>
103
+ <sales_order_invoice_pay>
104
+ <observers>
105
+ <RybonsCoupon_observer>
106
+ <type>singleton</type>
107
+ <class>RybonsCoupon/observer</class>
108
+ <method>salesInvoiceCreateAfter</method>
109
+ </RybonsCoupon_observer>
110
+ </observers>
111
+ </sales_order_invoice_pay>
112
+ </events>
113
+ <models>
114
+ <RybonsCoupon>
115
+ <class>PanthelopeTechnologies_RybonsCoupon_Model</class>
116
+ <resourceModel>RybonsCoupon_mysql4</resourceModel>
117
+ </RybonsCoupon>
118
+ <RybonsCoupon_mysql4>
119
+ <class>PanthelopeTechnologies_RybonsCoupon_Model_Mysql4</class>
120
+ </RybonsCoupon_mysql4>
121
+ </models>
122
+ <resources>
123
+ <RybonsCoupon_setup>
124
+ <setup>
125
+ <module>PanthelopeTechnologies_RybonsCoupon</module>
126
+ </setup>
127
+ <connection>
128
+ <use>core_setup</use>
129
+ </connection>
130
+ </RybonsCoupon_setup>
131
+ <RybonsCoupon_write>
132
+ <connection>
133
+ <use>core_write</use>
134
+ </connection>
135
+ </RybonsCoupon_write>
136
+ <RybonsCoupon_read>
137
+ <connection>
138
+ <use>core_read</use>
139
+ </connection>
140
+ </RybonsCoupon_read>
141
+ </resources>
142
+ <blocks>
143
+ <RybonsCoupon>
144
+ <class>PanthelopeTechnologies_RybonsCoupon_Block</class>
145
+ </RybonsCoupon>
146
+ </blocks>
147
+ <helpers>
148
+ <RybonsCoupon>
149
+ <class>PanthelopeTechnologies_RybonsCoupon_Helper</class>
150
+ </RybonsCoupon>
151
+ </helpers>
152
+ <sales>
153
+ <quote>
154
+ <totals>
155
+ <RybonsCoupon>
156
+ <class>RybonsCoupon/quote_total_RybonsCoupon</class>
157
+ <after>grand_total</after>
158
+ </RybonsCoupon>
159
+ <RybonsCoupon_tax>
160
+ <class>RybonsCoupon/quote_total_tax</class>
161
+ <after>subtotal,discount,shipping,tax</after>
162
+ <before>grand_total</before>
163
+ </RybonsCoupon_tax>
164
+ </totals>
165
+ </quote>
166
+ <order_invoice>
167
+ <totals>
168
+ <RybonsCoupon>
169
+ <class>RybonsCoupon/invoice_total_RybonsCoupon</class>
170
+ </RybonsCoupon>
171
+ <RybonsCoupon_tax>
172
+ <class>RybonsCoupon/invoice_total_tax</class>
173
+ </RybonsCoupon_tax>
174
+ </totals>
175
+ </order_invoice>
176
+ <order_creditmemo>
177
+ <totals>
178
+ <RybonsCoupon>
179
+ <class>RybonsCoupon/creditmemo_total</class>
180
+ </RybonsCoupon>
181
+ </totals>
182
+ </order_creditmemo>
183
+ </sales>
184
+ <fieldsets>
185
+ <sales_convert_quote_address>
186
+ <RybonsCoupon_code>
187
+ <to_order>*</to_order>
188
+ </RybonsCoupon_code>
189
+ <RybonsCoupon_discount>
190
+ <to_order>*</to_order>
191
+ </RybonsCoupon_discount>
192
+ <base_RybonsCoupon_discount>
193
+ <to_order>*</to_order>
194
+ </base_RybonsCoupon_discount>
195
+ <RybonsCoupon_discount_tax>
196
+ <to_order>*</to_order>
197
+ </RybonsCoupon_discount_tax>
198
+ <base_RybonsCoupon_discount_tax>
199
+ <to_order>*</to_order>
200
+ </base_RybonsCoupon_discount_tax>
201
+ </sales_convert_quote_address>
202
+ </fieldsets>
203
+ <pdf>
204
+ <totals>
205
+ <RybonsCoupon translate="title">
206
+ <title>PanthelopeTechnologies Rybons Coupon</title>
207
+ <source_field>RybonsCoupon_discount</source_field>
208
+ <font_size>7</font_size>
209
+ <display_zero>0</display_zero>
210
+ <sort_order>590</sort_order>
211
+ <amount_prefix>-</amount_prefix>
212
+ </RybonsCoupon>
213
+ </totals>
214
+ </pdf>
215
+ </global>
216
+ </config>
app/code/community/PanthelopeTechnologies/RybonsCoupon/etc/system.xml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <PanthelopeTechnologies_tab module="RybonsCoupon" translate="label">
5
+ <label>Rybons Coupon</label>
6
+ <sort_order>100</sort_order>
7
+ </PanthelopeTechnologies_tab>
8
+ </tabs>
9
+ <sections>
10
+ <RybonsCoupon module="RybonsCoupon" translate="label">
11
+ <label>Options</label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>PanthelopeTechnologies_tab</tab>
17
+ <groups>
18
+ <PanthelopeTechnologies_group translate="label">
19
+ <label>Rybons Coupon Configuration</label>
20
+ <comment>Configure your shop with your merchant details</comment>
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <PanthelopeTechnologies_merchantKey translate="label">
27
+ <label>Merchant Key </label>
28
+ <comment>Type in your merchant Key, don't have one? Visit rybons.com.ng or send an email to info@rybons.com.ng</comment>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>20</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </PanthelopeTechnologies_merchantKey>
35
+ <PanthelopeTechnologies_connectionMode translate="label">
36
+ <label>Connection Mode </label>
37
+ <comment>Set connection mode. LIVE or DEV</comment>
38
+ <frontend_type>select</frontend_type>
39
+ <sort_order>60</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <source_model>adminhtml/system_config_source_yesno</source_model>
44
+ </PanthelopeTechnologies_connectionMode>
45
+ </fields>
46
+ </PanthelopeTechnologies_group>
47
+ </groups>
48
+ </RybonsCoupon>
49
+ </sections>
50
+ <sections>
51
+ <sales>
52
+ <groups>
53
+ <totals_sort>
54
+ <fields>
55
+ <RybonsCoupon module="RybonsCoupon" translate="label">
56
+ <label>RybonsCoupon Discount</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>5</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </RybonsCoupon>
63
+ </fields>
64
+ </totals_sort>
65
+ </groups>
66
+ </sales>
67
+ <tax translate="label" module="tax">
68
+ <groups>
69
+ <classes translate="label">
70
+ <fields>
71
+ <RybonsCoupon_tax_class translate="label">
72
+ <label>RybonsCoupon Tax Class</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_shipping_taxclass</source_model>
75
+ <sort_order>20</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </RybonsCoupon_tax_class>
80
+ </fields>
81
+ </classes>
82
+ <calculation translate="label">
83
+ <fields>
84
+ <RybonsCoupon_includes_tax translate="label comment">
85
+ <label>RybonsCoupon Discount</label>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>tax/system_config_source_priceType</source_model>
88
+ <sort_order>35</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </RybonsCoupon_includes_tax>
93
+ </fields>
94
+ </calculation>
95
+ </groups>
96
+ </tax>
97
+ </sections>
98
+ </config>
app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->endSetup();
app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.2-0.4.3.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->endSetup();
app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.3-0.4.4.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+
8
+ $installer->endSetup();
app/code/community/PanthelopeTechnologies/RybonsCoupon/sql/giftcardapi_setup/mysql4-upgrade-0.4.4-0.4.5.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
6
+ $setup->addAttribute('quote', 'RybonsCoupon_code', array('type' => 'varchar'));
7
+ $setup->addAttribute('order', 'RybonsCoupon_code', array('type' => 'varchar'));
8
+ $setup->addAttribute('invoice', 'RybonsCoupon_code', array('type' => 'varchar'));
9
+ $setup->addAttribute('quote', 'RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
10
+ $setup->addAttribute('quote', 'base_RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
11
+ $setup->addAttribute('order', 'RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
12
+ $setup->addAttribute('order', 'base_RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
13
+ $setup->addAttribute('order', 'RybonsCoupon_discount_invoiced', array('type' => 'decimal', 'visible' => false));
14
+ $setup->addAttribute('order', 'base_RybonsCoupon_discount_invoiced', array('type' => 'decimal', 'visible' => false));
15
+ $setup->addAttribute('order', 'RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
16
+ $setup->addAttribute('order', 'base_RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
17
+ $setup->addAttribute('order', 'RybonsCoupon_discount_tax_invoiced', array('type' => 'decimal', 'visible' => false));
18
+ $setup->addAttribute('order', 'base_RybonsCoupon_discount_tax_invoiced', array('type' => 'decimal', 'visible' => false));
19
+ $setup->addAttribute('invoice', 'RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
20
+ $setup->addAttribute('invoice', 'base_RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
21
+ $setup->addAttribute('invoice', 'RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
22
+ $setup->addAttribute('invoice', 'base_RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
23
+ $setup->addAttribute('creditmemo', 'RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
24
+ $setup->addAttribute('creditmemo', 'base_RybonsCoupon_discount', array('type' => 'decimal', 'visible' => false));
25
+ $setup->addAttribute('creditmemo', 'RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
26
+ $setup->addAttribute('creditmemo', 'base_RybonsCoupon_discount_tax', array('type' => 'decimal', 'visible' => false));
27
+
28
+ $installer->endSetup();
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>RybonsCoupon</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Offer your shoppers discount coupons from Rybons.com.ng. Visit rybons.com.ng to register your store.</summary>
10
+ <description>Rybons Coupon allows you offer coupon discounts on store. With this extension, shoppers can apply coupons gotten from the rybons platform. To get started, visit rybons.com.ng, and register your store. Once store has been verified, you will receive and email containing your merchant key.Now install this extension and navigate to &amp;quot;System -&amp;gt; Configuration -&amp;gt; Rybons Coupon&amp;quot;. Supply your merchant key and save.</description>
11
+ <notes>Release version</notes>
12
+ <authors><author><name>Panthelope Tech</name><user>klipsedeville</user><email>klipsedeville@gmail.com</email></author></authors>
13
+ <date>2015-06-07</date>
14
+ <time>09:29:56</time>
15
+ <contents><target name="magecommunity"><dir name="PanthelopeTechnologies"><dir name="RybonsCoupon"><dir name="Block"><file name="Discount.php" hash="1866849dc55b297f4eed446e1ef615e5"/><dir name="Sales"><dir name="Creditmemo"><dir name="Totals"><file name="Discount.php" hash="11390aff0b503e226db117c8aee30f05"/><file name=".DS_Store" hash="a278208cea07145951791913cfbfbc8e"/></dir><file name=".DS_Store" hash="1d53ae408c8da30109191e8110eee850"/></dir><dir name="Invoice"><dir name="Totals"><file name="Discount.php" hash="6c8cb568ce5543ffc7bf5fc59fe70a69"/><file name=".DS_Store" hash="a278208cea07145951791913cfbfbc8e"/></dir><file name=".DS_Store" hash="f08dc1857ec27fdb7a55cc6c969e54ac"/></dir><dir name="Order"><dir name="Totals"><file name="Discount.php" hash="86a5bd5bb9e4af869d875f91fcb66f83"/><file name=".DS_Store" hash="a278208cea07145951791913cfbfbc8e"/></dir><file name=".DS_Store" hash="bd9a6f4e371d15245389d9d3b4aa9674"/></dir><file name=".DS_Store" hash="1c46e799bab36c056e802c2c91c26ea0"/></dir><file name=".DS_Store" hash="a3ad0e0f30ca8d3dd02e41ffe234a3d4"/></dir><dir name="Helper"><file name="Data.php" hash="88d9eb45eb05adc3e356531bc2cc2d19"/></dir><dir name="Model"><dir name="Creditmemo"><file name="Total.php" hash="84304d4359aa4ce90ba887adb55a62ab"/></dir><dir name="Invoice"><dir name="Total"><file name="RybonsCoupon.php" hash="0e9c2346cd1442f4ed09631d670f9561"/><file name="Tax.php" hash="c961a16f7c0e29aca8a9774f67038547"/></dir></dir><file name="Observer.php" hash="5b75fa4c4850cc7250dc9115403f3ba1"/><dir name="Quote"><dir name="Total"><file name="RybonsCoupon.php" hash="0a3684c9967ff93dcc4778c404f2620c"/><file name="Tax.php" hash="040f9b981a3db8105169f1cc703b7c94"/></dir></dir><file name="RybonsCoupon.php" hash="bc73c20f33e4c37851dda145a3192247"/><dir name="Source"><file name="Discount.php" hash="fa2936183d843019c998786ff4cd19cb"/></dir><file name="Status.php" hash="0cc005f46dc0ff045c0c9b053fd3c3e8"/><file name=".DS_Store" hash="8cf7463e9a6300ebce43fa7d99cecb7c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExtendoController.php" hash="efa9422f954eb5ce57bcd6a1ad2b024b"/></dir><file name="IndexController.php" hash="69b12ec293015115c87b780a3dbc21f6"/></dir><dir name="etc"><file name="config.xml" hash="065b9b7fb782c1c00d90d1b9e3a4dfb5"/><file name="system.xml" hash="9e2e3ae01f1d0cd4ed5dbf7ba9b45551"/></dir><dir name="sql"><dir name="giftcardapi_setup"><file name="mysql4-install-0.1.0.php" hash="b403d80422a7f4d80957d0405d55e2d7"/><file name="mysql4-upgrade-0.4.2-0.4.3.php" hash="b403d80422a7f4d80957d0405d55e2d7"/><file name="mysql4-upgrade-0.4.3-0.4.4.php" hash="6ddcf85b14daaf05fd5efd1e20a32965"/><file name="mysql4-upgrade-0.4.4-0.4.5.php" hash="b2124c56d7fc498ea2cdf988e2217541"/></dir></dir><file name=".DS_Store" hash="0c92d43764f483fa1ee905babacd5028"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.6.1</max></php></required></dependencies>
18
+ </package>