Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Model/ConfigProvider/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getConfig($store = null)
'order_status_failed' => $this->getOrderStatusFailed($store),
'create_order_before_transaction' => $this->getCreateOrderBeforeTransaction($store),
'ip_header' => $this->getIpHeader($store),
'cart_keep_alive' => $this->getCartKeepAlive($store),//can be changed from cli/db only
'cart_keep_alive' => true,
'selection_type' => $this->getSelectionType($store),
'customer_additional_info' => $this->getCustomerAdditionalInfo($store),
'buckaroo_fee_tax_class' => $this->getBuckarooFeeTaxClass($store),
Expand Down
16 changes: 11 additions & 5 deletions Model/Ideal/QuoteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2\Model\Ideal;

use Magento\Customer\Model\Group;
Expand Down Expand Up @@ -64,11 +65,12 @@ class QuoteBuilder implements QuoteBuilderInterface
protected $quote;

public function __construct(
QuoteFactory $quoteFactory,
QuoteFactory $quoteFactory,
ProductRepositoryInterface $productRepository,
DataObjectFactory $dataObjectFactory,
CustomerSession $customer
) {
DataObjectFactory $dataObjectFactory,
CustomerSession $customer
)
{
$this->quoteFactory = $quoteFactory;
$this->productRepository = $productRepository;
$this->dataObjectFactory = $dataObjectFactory;
Expand All @@ -80,6 +82,7 @@ public function setFormData(string $formData)
{
$this->formData = $this->formatFormData($formData);
}

/**
* Build quote from form data and session without persisting it
*
Expand All @@ -88,6 +91,7 @@ public function setFormData(string $formData)
public function build()
{
$this->quote = $this->quoteFactory->create();
$this->quote->setIsCheckoutCart(true);
$this->addProduct();
$this->setUser();
return $this->quote;
Expand All @@ -111,6 +115,7 @@ protected function setUser()
->setCustomerGroupId(Group::NOT_LOGGED_IN_ID);
}
}

/**
* Add product to quote
*
Expand All @@ -134,7 +139,8 @@ protected function addProduct()
throw new IdealException($exceptionMessage, 1);
}
}
/**

/**
* Format form data
*
* @param string $form_data
Expand Down
11 changes: 5 additions & 6 deletions Service/Sales/Quote/Recreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,29 @@ public function recreate($quote, $response = [])
{
// @codingStandardsIgnoreStart
try {
$quote->setIsActive(true);
// $quote->setTriggerRecollect('1');
$quote->setIsActive(1);
$quote->setReservedOrderId(null);

$quote->setBuckarooFee(null);
$quote->setBaseBuckarooFee(null);
$quote->setBuckarooFeeTaxAmount(null);
$quote->setBuckarooFeeBaseTaxAmount(null);
$quote->setBuckarooFeeInclTax(null);
$quote->setBaseBuckarooFeeInclTax(null);

if (isset($response['add_service_action_from_magento']) && $response['add_service_action_from_magento'] === 'payfastcheckout') {
if (isset($response['add_service_action_from_magento'])
&& $response['add_service_action_from_magento'] === 'payfastcheckout'
) {
$this->logger->addDebug(__METHOD__ . '|Handling payfastcheckout specific logic.');

$quote->setCustomerEmail(null);

// Remove existing addresses if they exist
if ($billingAddress = $quote->getBillingAddress()) {
$quote->removeAddress($billingAddress->getId());
$billingAddress->addData([]); // Optionally clear address data
}

if ($shippingAddress = $quote->getShippingAddress()) {
$quote->removeAddress($shippingAddress->getId());
$shippingAddress->addData([]); // Optionally clear address data
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if ($block->canShowButton('Product')): ?>
"components": {
"fastCheckoutIdeal": {
"component":"buckaroo/ideal-fast-checkout/pay",
"template":"Buckaroo_Magento2/catalog/product/view/ideal-fast-checkout",
"config": {
"page": "product",
"paymentData": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if ($block->canShowButton('Cart')): ?>
<img src="<?= $block->escapeHtml($block->getLogo()) ?>" alt="<?= __('Ideal Fast Checkout') ?>"/>
</button>
</div>

<script type="text/x-magento-init">
{
"#fast-checkout-ideal-btn-component": {
Expand All @@ -39,7 +40,7 @@ if ($block->canShowButton('Cart')): ?>
"paymentData": {
"method": "buckaroo_magento2_ideal",
"additional_data": {
"issuer" : "fastcheckout"
"issuer": "fastcheckout"
}
}
}
Expand Down
Loading