-
Notifications
You must be signed in to change notification settings - Fork 50
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
40b41ea
commit 1efa79d
Showing
20 changed files
with
305 additions
and
84 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Magento 2 extensions for Afterpay Payment | ||
* | ||
* @author Afterpay | ||
* @copyright 2016-2020 Afterpay https://www.afterpay.com | ||
*/ | ||
namespace Afterpay\Afterpay\Observer; | ||
|
||
use \Magento\Framework\Event\ObserverInterface; | ||
use \Afterpay\Afterpay\Helper\Data as Helper; | ||
|
||
/** | ||
* Class BeforeCreditmemoLoad | ||
* @package Afterpay\Afterpay\Observer | ||
*/ | ||
class BeforeCreditmemoLoad implements ObserverInterface | ||
{ | ||
protected $_helper; | ||
protected $_layout; | ||
protected $_registry; | ||
|
||
public function __construct( | ||
Helper $helper, | ||
\Magento\Framework\View\LayoutInterface $layout, | ||
\Magento\Framework\Registry $registry | ||
) | ||
{ | ||
$this->_helper = $helper; | ||
$this->_layout = $layout; | ||
$this->_registry = $registry; | ||
} | ||
|
||
public function execute(\Magento\Framework\Event\Observer $observer) | ||
{ | ||
$block = $observer->getEvent()->getBlock(); | ||
$layout = $block->getLayout(); | ||
|
||
if($layout->hasElement('sales_creditmemo_create')){ | ||
$creditmemo = $this->_registry->registry('current_creditmemo'); | ||
if($creditmemo){ | ||
$order = $creditmemo->getOrder(); | ||
$payment = $order->getPayment(); | ||
|
||
if($payment->getMethod() == \Afterpay\Afterpay\Model\Payovertime::METHOD_CODE ){ | ||
$afterpayPaymentStatus = $payment->getAdditionalInformation(\Afterpay\Afterpay\Model\Payovertime::PAYMENT_STATUS); | ||
if($afterpayPaymentStatus == \Afterpay\Afterpay\Model\Response::PAYMENT_STATUS_AUTH_APPROVED || $afterpayPaymentStatus == \Afterpay\Afterpay\Model\Response::PAYMENT_STATUS_PARTIALLY_CAPTURED){ | ||
$block->unsetChild( | ||
'submit_offline' | ||
); | ||
if($layout->hasElement('customerbalance.creditmemo')){ | ||
$layout->unsetElement('customerbalance.creditmemo'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
?> |
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 |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
product_page1 = "or 4 installments of " | ||
product_page2 = 'by <img class="afterpay_instalments_logo" src="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png" srcset="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png 1x,https://static.afterpay.com/integration/[email protected] 2x,https://static.afterpay.com/integration/[email protected] 3x" height="15"/><a href="[modal-href]" class="afterpay-modal-popup-trigger-us">More info</a>' | ||
product_page_from = "or 4 installments from " | ||
cart_page = "Check out with Afterpay and pay by installments.</span></h3><span>Pay 4 installments.<br> Use your payment card, instant approval.</span> | ||
cart_page1 = "Check out with Afterpay and pay by installments.</span></h3> | ||
<span>Pay 4 installments of " | ||
cart_page2 = "<br> Use your payment card, approval decision online.</span> | ||
<span><a href="[modal-href]" class="afterpay-modal-popup-trigger-us">More info</a></span>" | ||
|
||
[AUD] | ||
|
@@ -14,8 +16,9 @@ | |
product_page2 = '<img class="afterpay_instalments_logo" src="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png" srcset="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png 1x,https://static.afterpay.com/integration/[email protected] 2x,https://static.afterpay.com/integration/[email protected] 3x" height="15"/> | ||
<a href="[modal-href]" class="afterpay-modal-popup-trigger">Learn more</a>' | ||
product_page_from = "or 4 interest-free payments from " | ||
cart_page = "Check out with Afterpay and pay by instalment.</span></h3> | ||
<span>Simply pay 4 fortnightly instalments.<br> Use your payment card, instant approval.</span> | ||
cart_page1 = "Check out with Afterpay and pay by instalment.</span></h3> | ||
<span>Simply pay 4 fortnightly instalments of " | ||
cart_page2 = "<br> Use your payment card, instant approval.</span> | ||
<span><a href="[modal-href]" class="afterpay-modal-popup-trigger">Learn more</a></span>" | ||
|
||
[NZD] | ||
|
@@ -24,6 +27,7 @@ | |
product_page2 = '<img class="afterpay_instalments_logo" src="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png" srcset="https://static.afterpay.com/integration/logo-afterpay-colour-72x15.png 1x,https://static.afterpay.com/integration/[email protected] 2x,https://static.afterpay.com/integration/[email protected] 3x" height="15"/> | ||
<a href="[modal-href]" class="afterpay-modal-popup-trigger">Learn more</a>' | ||
product_page_from = "or 4 interest-free payments from " | ||
cart_page = "Check out with Afterpay and pay by instalment.</span></h3> | ||
<span>Simply pay 4 fortnightly instalments.<br> Use your payment card, instant approval.</span> | ||
cart_page1 = "Check out with Afterpay and pay by instalment.</span> | ||
<span>Simply pay 4 fortnightly instalments of " | ||
cart_page2 = "<br> Use your payment card, instant approval.</span> | ||
<span><a href="[modal-href]" class="afterpay-modal-popup-trigger">Learn more</a></span>" |
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.