Skip to content

Commit

Permalink
[fix] keep quote (cart) active until affirm loan process is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Holder-Chow Lin On committed Jul 17, 2014
1 parent df3e322 commit 1ea0b3f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
class Affirm_Affirm_Model_Order_Observer
{
public function reactivate_quote($observer)
{
// TODO(brian): get object once
// TODO(brian): don't hardcode the payment method code. get it from an
// instance of the model object
if (Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getCode() == 'affirm') {
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(true);
Mage::getSingleton('checkout/session')->getQuote()->save();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function redirectAction()

public function confirmAction()
{
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false);
Mage::getSingleton('checkout/session')->getQuote()->save();
$session = $this->_getCheckoutSession();
$checkout_token = $this->getRequest()->getParam("checkout_token");
if (!$checkout_token)
Expand Down
13 changes: 12 additions & 1 deletion extension/app/code/community/Affirm/Affirm/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Affirm_Affirm>
<version>0.4.1</version>
<version>0.5.0</version>
</Affirm_Affirm>
</modules>
<global>
Expand All @@ -11,6 +11,17 @@
<class>Affirm_Affirm_Model</class>
</affirm>
</models>
<events>
<checkout_type_onepage_save_order_after>
<observers>
<affirm_affirm_model_order_observer>
<type>singleton</type>
<class>Affirm_Affirm_Model_Order_Observer</class>
<method>reactivate_quote</method>
</affirm_affirm_model_order_observer>
</observers>
</checkout_type_onepage_save_order_after>
</events>
<blocks>
<affirm>
<class>Affirm_Affirm_Block</class>
Expand Down

0 comments on commit 1ea0b3f

Please sign in to comment.