Skip to content
2 changes: 1 addition & 1 deletion Block/Info/Klarna.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function isStringUrl($string)
*/
public function getLogoUrl(): string
{
return 'https://x.klarnacdn.net/payment-method/assets/badges/generic/white/klarna.png?width=300';
return 'https://cdn.kustom.co/assets/badges/kustom_logo_black.png';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand Down Expand Up @@ -35,4 +34,4 @@
]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand Down Expand Up @@ -35,4 +34,4 @@
]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand All @@ -31,4 +30,4 @@
'website_ids' => [$websiteId]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand All @@ -31,4 +30,4 @@
'website_ids' => [$websiteId]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand All @@ -32,4 +31,4 @@
'website_ids' => [$websiteId]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
declare(strict_types=1);

use Magento\Customer\Model\GroupManagement;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResourceModel;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand All @@ -32,4 +31,4 @@
'website_ids' => [$websiteId]
]
);
$objectManager->get(RuleResourceModel::class)->save($salesRule);
$salesRule->save();
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* Copyright © Klarna Bank AB (publ)
*
* For the full copyright and license information, please view the NOTICE
* and LICENSE files that were distributed with this source code.
*/

declare(strict_types=1);

use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Workaround\Override\Fixture\Resolver;

Resolver::getInstance()->requireDataFixture(
'Klarna_Base::Test/Integration/_files/fixtures/order_setup1_single_simple_product.php'
);

$objectManager = Bootstrap::getObjectManager();

/** @var \Klarna\Base\Model\OrderFactory $kOrderFactory */
$kOrderFactory = $objectManager->get(\Klarna\Base\Model\OrderFactory::class);
/** @var \Magento\Sales\Model\OrderFactory $mOrderFactory */
$mOrderFactory = $objectManager->get(\Magento\Sales\Model\OrderFactory::class);

$order = $mOrderFactory->create()->loadByIncrementId('100000001');
$klarnaOrder = $kOrderFactory->create();
$klarnaOrder->setKlarnaOrderId('123456-1234-1234-1234-1234567890');
$klarnaOrder->setOrderId($order->getId());
$klarnaOrder->save();
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* Copyright © Klarna Bank AB (publ)
*
* For the full copyright and license information, please view the NOTICE
* and LICENSE files that were distributed with this source code.
*/

declare(strict_types=1);

use Klarna\Base\Model\OrderFactory;
use Magento\Framework\Registry;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Workaround\Override\Fixture\Resolver;

$objectManager = Bootstrap::getObjectManager();

/** @var OrderFactory $kOrderFactory */
$kOrderFactory = $objectManager->get(OrderFactory::class);
/** @var Registry $registry */
$registry = $objectManager->get(Registry::class);

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);

$klarnaOrder = $kOrderFactory->create()->load('123456-1234-1234-1234-1234567890', 'klarna_order_id');
if ($klarnaOrder->getId()) {
$klarnaOrder->delete();
}

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);

Resolver::getInstance()->requireDataFixture(
'Klarna_Base::Test/Integration/_files/fixtures/order_setup1_single_simple_product_rollback.php'
);
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright © Klarna Bank AB (publ)
*
* For the full copyright and license information, please view the NOTICE
* and LICENSE files that were distributed with this source code.
*/

declare(strict_types=1);

use Magento\Backend\App\Action\Context;
Expand Down Expand Up @@ -102,4 +101,4 @@

// Create Order From Quote
$service = $quoteManagement->submit($quote);
$increment_id = $service->getRealOrderId();
$increment_id = $service->getRealOrderId();
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* Copyright © Klarna Bank AB (publ)
*
* For the full copyright and license information, please view the NOTICE
* and LICENSE files that were distributed with this source code.
*/

declare(strict_types=1);

use Magento\Framework\Registry;
use Magento\Quote\Model\QuoteFactory;
use Magento\Sales\Model\OrderFactory;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Workaround\Override\Fixture\Resolver;

$objectManager = Bootstrap::getObjectManager();

/** @var QuoteFactory $quoteFactory */
$quoteFactory = $objectManager->get(QuoteFactory::class);
/** @var OrderFactory $orderFactory */
$orderFactory = $objectManager->get(OrderFactory::class);
/** @var Registry $registry */
$registry = $objectManager->get(Registry::class);

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);

$order = $orderFactory->create()->loadByIncrementId('100000001');
if ($order->getId()) {
$order->delete();
}

$quote = $quoteFactory->create()->load('100000001', 'reserved_order_id');
if ($quote->getId()) {
$quote->delete();
}

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);

Resolver::getInstance()->requireDataFixture('Klarna_Base::Test/Integration/_files/fixtures/tax_rule_us_postal_36104_rollback.php');
Resolver::getInstance()->requireDataFixture('Klarna_Base::Test/Integration/_files/fixtures/product_simple_rollback.php');
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
$product->setExtensionAttributes($extension);
}

$productRepository->save($product, true);
$product = $productRepository->save($product, true);

$productHelper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Catalog\Helper\Product::class);
$productHelper->setSkipSaleableCheck(true);
Expand All @@ -112,4 +112,4 @@
$stockSql = "INSERT INTO cataloginventory_stock_status (product_id, website_id, stock_id, qty, stock_status) " .
"VALUES (" . $product->getId() . ",0,1,12345,1)";
$connection->query($stockSql);
}
}
6 changes: 1 addition & 5 deletions Test/Integration/_files/fixtures/product_downloadable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
* See COPYING.txt for license details.
*/

use Magento\Downloadable\Api\DomainManagerInterface;

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$domainManager = $objectManager->get(DomainManagerInterface::class);
$domainManager->addDomains(['placeholder.test']);

/** @var \Magento\Catalog\Model\Product $product */
$product = $objectManager->create(\Magento\Catalog\Model\Product::class);
Expand Down Expand Up @@ -41,7 +37,7 @@
'title' => 'Downloadable Product Link',
'type' => \Magento\Downloadable\Helper\Download::LINK_TYPE_URL,
'is_shareable' => \Magento\Downloadable\Model\Link::LINK_SHAREABLE_CONFIG,
'link_url' => 'http://placeholder.test',
'link_url' => 'http://localhost',
'link_id' => 0,
'is_delete' => null,
];
Expand Down
35 changes: 35 additions & 0 deletions Test/Integration/_files/fixtures/product_simple_rollback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* Copyright © Klarna Bank AB (publ)
*
* For the full copyright and license information, please view the NOTICE
* and LICENSE files that were distributed with this source code.
*/

declare(strict_types=1);

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Registry;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

/** @var ProductRepositoryInterface $productRepository */
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
/** @var Registry $registry */
$registry = $objectManager->get(Registry::class);

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', true);

try {
$product = $productRepository->get('simple');
$productRepository->delete($product);
} catch (NoSuchEntityException $exception) {
// Already deleted
}

$registry->unregister('isSecureArea');
$registry->register('isSecureArea', false);
Loading