-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All methods now have pending_payment and new as valid states.
Added setting for sofort and bank transfer, set on-hold Quote is reactivated immediately after starting the payment, so the back button works from the payment page.
- Loading branch information
Andy Pieters
committed
Dec 6, 2017
1 parent
11e0e43
commit 65d6a9b
Showing
7 changed files
with
114 additions
and
60 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 |
---|---|---|
@@ -1,58 +1,48 @@ | ||
<?php | ||
|
||
namespace Paynl\Payment\Model\Paymentmethod; | ||
|
||
use Magento\Sales\Model\Order; | ||
use Magento\Sales\Model\OrderRepository; | ||
|
||
/** | ||
* | ||
* @author Andy Pieters <[email protected]> | ||
*/ | ||
class Paylink extends PaymentMethod { | ||
protected $_code = 'paynl_payment_paylink'; | ||
|
||
/** | ||
* Paylink payment block paths | ||
* | ||
* @var string | ||
*/ | ||
protected $_formBlockType = \Paynl\Payment\Block\Form\Paylink::class; | ||
|
||
/** | ||
* @var OrderRepository | ||
*/ | ||
protected $_orderRepository; | ||
class Paylink extends PaymentMethod | ||
{ | ||
protected $_code = 'paynl_payment_paylink'; | ||
|
||
/** | ||
* Paylink payment block paths | ||
* | ||
* @var string | ||
*/ | ||
protected $_formBlockType = \Paynl\Payment\Block\Form\Paylink::class; | ||
|
||
// this is an admin only method | ||
protected $_canUseCheckout = false; | ||
|
||
function __construct( | ||
\Magento\Framework\Model\Context $context, | ||
\Magento\Framework\Registry $registry, | ||
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, | ||
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, | ||
\Magento\Payment\Helper\Data $paymentData, | ||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, | ||
\Magento\Payment\Model\Method\Logger $logger, | ||
OrderRepository $orderRepository, | ||
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, | ||
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, | ||
array $data = [] ) { | ||
parent::__construct( $context, $registry, $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, $logger, $resource, $resourceCollection, $data ); | ||
$this->_orderRepository = $orderRepository; | ||
} | ||
|
||
public function initialize( $paymentAction, $stateObject ) { | ||
if($paymentAction == 'order') { | ||
/** @var Order $order */ | ||
$order = $this->getInfoInstance()->getOrder(); | ||
$this->_orderRepository->save($order); | ||
$transaction = $this->doStartTransaction( $order ); | ||
$state = $this->getConfigData('order_status'); | ||
parent::initialize( $paymentAction, $stateObject ); | ||
$order->addStatusHistoryComment('Betaallink: '.$transaction->getRedirectUrl(), $state); | ||
} | ||
} | ||
public function assignData( \Magento\Framework\DataObject $data ) { | ||
$this->getInfoInstance()->setAdditionalInformation('valid_days', $data->getData('additional_data')['valid_days']); | ||
return parent::assignData( $data ); | ||
} | ||
|
||
public function initialize($paymentAction, $stateObject) | ||
{ | ||
if ($paymentAction == 'order') { | ||
/** @var Order $order */ | ||
$order = $this->getInfoInstance()->getOrder(); | ||
$this->orderRepository->save($order); | ||
|
||
$transaction = $this->doStartTransaction($order); | ||
|
||
$status = $this->getConfigData('order_status'); | ||
|
||
$order->addStatusHistoryComment('Betaallink: ' . $transaction->getRedirectUrl(), $status); | ||
parent::initialize($paymentAction, $stateObject); | ||
} | ||
} | ||
|
||
public function assignData(\Magento\Framework\DataObject $data) | ||
{ | ||
$this->getInfoInstance()->setAdditionalInformation('valid_days', $data->getData('additional_data')['valid_days']); | ||
|
||
return parent::assignData($data); | ||
} | ||
} |
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