This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98b4260
commit 6eb3efa
Showing
51 changed files
with
217 additions
and
3,129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,6 @@ class Afterpay_Afterpay_Block_Form_Payovertime extends Afterpay_Afterpay_Block_F | |
|
||
const CONFIG_PATH_SHOW_DETAILS = 'afterpay/payovertime_checkout/show_checkout_details'; | ||
|
||
const TEMPLATE_OPTION_TITLE_DEFAULT = 'afterpay/checkout/title.phtml'; | ||
|
||
const TEMPLATE_OPTION_DETAILS_DEFAULT = 'afterpay/form/payovertime.phtml'; | ||
|
||
const TEMPLATE_OPTION_TITLE_CUSTOM = 'afterpay/checkout/title_custom.phtml'; | ||
|
@@ -54,6 +52,16 @@ public function getInstalmentAmount() | |
return $this->getData('instalment_amount'); | ||
} | ||
|
||
public function getInstalmentAmountCreditUsed() | ||
{ | ||
if (!$this->hasData('instalment_amount_credit_used')) { | ||
$formatted = Mage::helper('afterpay')->calculateInstalment(true); | ||
$this->setData('instalment_amount_credit_used', $formatted); | ||
} | ||
|
||
return $this->getData('instalment_amount_credit_used'); | ||
} | ||
|
||
public function getInstalmentAmountLast() | ||
{ | ||
if (!$this->hasData('instalment_amount_last')) { | ||
|
@@ -64,12 +72,32 @@ public function getInstalmentAmountLast() | |
return $this->getData('instalment_amount_last'); | ||
} | ||
|
||
public function getInstalmentAmountLastCreditUsed() | ||
{ | ||
if (!$this->hasData('instalment_amount_last_credit_used')) { | ||
$formatted = Mage::helper('afterpay')->calculateInstalmentLast(true); | ||
$this->setData('instalment_amount_last_credit_used', $formatted); | ||
} | ||
|
||
return $this->getData('instalment_amount_last_credit_used'); | ||
} | ||
|
||
public function getOrderTotal() | ||
{ | ||
$total = Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal(); | ||
return Mage::app()->getStore()->formatPrice($total, false); | ||
} | ||
|
||
public function getOrderTotalCreditUsed() | ||
{ | ||
$total = Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal(); | ||
$total = $total - Mage::helper('afterpay')->getCustomerBalance(); | ||
if ($total < 0) { | ||
$total = 0; | ||
} | ||
return Mage::app()->getStore()->formatPrice($total, false); | ||
} | ||
|
||
public function getDetailsConfiguration() | ||
{ | ||
$config = $this->_getCommonConfiguration(); | ||
|
@@ -111,23 +139,27 @@ private function _getCommonConfiguration() | |
{ | ||
return array( | ||
'afterpayLogoSubstitution' => '{afterpay_logo}', | ||
'afterpayLogo' => $this->getSkinUrl('afterpay/images/ap-logo-152x31.png'), | ||
'afterpayLogo' => 'https://static.afterpay.com/integration/logo-afterpay-colour-72x15@2x.png', | ||
'orderAmountSubstitution' => '{order_amount}', | ||
'orderAmount' => $this->getOrderTotal(), | ||
'orderAmountCreditUsed' => $this->getOrderTotalCreditUsed(), | ||
'regionSpecificSubstitution' => '{region_specific_text}', | ||
'regionText' => $this->getRegionSpecificText(), | ||
'installmentAmountSubstitution' => '{instalment_amount}', | ||
'installmentAmount' => $this->getInstalmentAmount(), | ||
'installmentAmountCreditUsed' => $this->getInstalmentAmountCreditUsed(), | ||
'installmentAmountSubstitutionLast' => '{instalment_amount_last}', | ||
'installmentAmountLast' => $this->getInstalmentAmountLast(), | ||
'installmentAmountLastCreditUsed' => $this->getInstalmentAmountLastCreditUsed(), | ||
'imageCircleOneSubstitution' => '{img_circle_1}', | ||
'imageCircleOne' => $this->getSkinUrl('afterpay/images/checkout/[email protected]'), | ||
'imageCircleOne' => 'https://static.afterpay.com/checkout/[email protected]', | ||
'imageCircleTwoSubstitution' => '{img_circle_2}', | ||
'imageCircleTwo' => $this->getSkinUrl('afterpay/images/checkout/[email protected]'), | ||
'imageCircleTwo' => 'https://static.afterpay.com/checkout/[email protected]', | ||
'imageCircleThreeSubstitution' => '{img_circle_3}', | ||
'imageCircleThree' => $this->getSkinUrl('afterpay/images/checkout/[email protected]'), | ||
'imageCircleThree' => 'https://static.afterpay.com/checkout/[email protected]', | ||
'imageCircleFourSubstitution' => '{img_circle_4}', | ||
'imageCircleFour' => $this->getSkinUrl('afterpay/images/checkout/[email protected]') | ||
'imageCircleFour' => 'https://static.afterpay.com/checkout/[email protected]', | ||
'creditUsedSelector' => '#use_customer_balance' | ||
); | ||
} | ||
|
||
|
@@ -140,4 +172,4 @@ private function _getCustomTitleTemplate() | |
{ | ||
return Mage::getStoreConfig(self::CONFIG_PATH_CHECKOUT_TITLE_TEMPLATE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.