diff --git a/Block/Info/Klarna.php b/Block/Info/Klarna.php
index 4501606..8842cef 100644
--- a/Block/Info/Klarna.php
+++ b/Block/Info/Klarna.php
@@ -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';
}
/**
diff --git a/Test/Integration/_files/fixtures/cart_fixed_2_34_discount.php b/Test/Integration/_files/fixtures/cart_fixed_2_34_discount.php
index 2ee984e..139b6ff 100644
--- a/Test/Integration/_files/fixtures/cart_fixed_2_34_discount.php
+++ b/Test/Integration/_files/fixtures/cart_fixed_2_34_discount.php
@@ -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;
@@ -35,4 +34,4 @@
]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/cart_fixed_9999_discount.php b/Test/Integration/_files/fixtures/cart_fixed_9999_discount.php
index b82a022..30ef6d9 100644
--- a/Test/Integration/_files/fixtures/cart_fixed_9999_discount.php
+++ b/Test/Integration/_files/fixtures/cart_fixed_9999_discount.php
@@ -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;
@@ -35,4 +34,4 @@
]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/cart_percent_100_discount.php b/Test/Integration/_files/fixtures/cart_percent_100_discount.php
index 81bda62..20101fa 100644
--- a/Test/Integration/_files/fixtures/cart_percent_100_discount.php
+++ b/Test/Integration/_files/fixtures/cart_percent_100_discount.php
@@ -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;
@@ -31,4 +30,4 @@
'website_ids' => [$websiteId]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/cart_percent_12_34_discount.php b/Test/Integration/_files/fixtures/cart_percent_12_34_discount.php
index 13e7929..f62a185 100644
--- a/Test/Integration/_files/fixtures/cart_percent_12_34_discount.php
+++ b/Test/Integration/_files/fixtures/cart_percent_12_34_discount.php
@@ -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;
@@ -31,4 +30,4 @@
'website_ids' => [$websiteId]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_100_discount.php b/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_100_discount.php
index 2c7dbd4..e23c7ef 100644
--- a/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_100_discount.php
+++ b/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_100_discount.php
@@ -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;
@@ -32,4 +31,4 @@
'website_ids' => [$websiteId]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_12_34_discount.php b/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_12_34_discount.php
index c832b1a..7073d36 100644
--- a/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_12_34_discount.php
+++ b/Test/Integration/_files/fixtures/cart_percent_apply_to_shipping_12_34_discount.php
@@ -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;
@@ -32,4 +31,4 @@
'website_ids' => [$websiteId]
]
);
-$objectManager->get(RuleResourceModel::class)->save($salesRule);
+$salesRule->save();
diff --git a/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product.php b/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product.php
new file mode 100644
index 0000000..daf9fc3
--- /dev/null
+++ b/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product.php
@@ -0,0 +1,30 @@
+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();
diff --git a/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product_rollback.php b/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product_rollback.php
new file mode 100644
index 0000000..4891f2f
--- /dev/null
+++ b/Test/Integration/_files/fixtures/klarna_order_setup1_single_simple_product_rollback.php
@@ -0,0 +1,37 @@
+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'
+);
diff --git a/Test/Integration/_files/fixtures/order_setup1_single_simple_product.php b/Test/Integration/_files/fixtures/order_setup1_single_simple_product.php
index ab02ba7..cb9567e 100644
--- a/Test/Integration/_files/fixtures/order_setup1_single_simple_product.php
+++ b/Test/Integration/_files/fixtures/order_setup1_single_simple_product.php
@@ -1,13 +1,12 @@
submit($quote);
-$increment_id = $service->getRealOrderId();
\ No newline at end of file
+$increment_id = $service->getRealOrderId();
diff --git a/Test/Integration/_files/fixtures/order_setup1_single_simple_product_rollback.php b/Test/Integration/_files/fixtures/order_setup1_single_simple_product_rollback.php
new file mode 100644
index 0000000..9eab276
--- /dev/null
+++ b/Test/Integration/_files/fixtures/order_setup1_single_simple_product_rollback.php
@@ -0,0 +1,44 @@
+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');
diff --git a/Test/Integration/_files/fixtures/product_bundled_fixed_two.php b/Test/Integration/_files/fixtures/product_bundled_fixed_two.php
index 3777fca..5157ae5 100644
--- a/Test/Integration/_files/fixtures/product_bundled_fixed_two.php
+++ b/Test/Integration/_files/fixtures/product_bundled_fixed_two.php
@@ -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);
@@ -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);
-}
\ No newline at end of file
+}
diff --git a/Test/Integration/_files/fixtures/product_downloadable.php b/Test/Integration/_files/fixtures/product_downloadable.php
index 8d8558d..673fd84 100644
--- a/Test/Integration/_files/fixtures/product_downloadable.php
+++ b/Test/Integration/_files/fixtures/product_downloadable.php
@@ -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);
@@ -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,
];
diff --git a/Test/Integration/_files/fixtures/product_simple_rollback.php b/Test/Integration/_files/fixtures/product_simple_rollback.php
new file mode 100644
index 0000000..c88b516
--- /dev/null
+++ b/Test/Integration/_files/fixtures/product_simple_rollback.php
@@ -0,0 +1,35 @@
+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);
diff --git a/Test/Integration/_files/fixtures/quote_setup1_single_simple_product.php b/Test/Integration/_files/fixtures/quote_setup1_single_simple_product.php
new file mode 100644
index 0000000..52e030b
--- /dev/null
+++ b/Test/Integration/_files/fixtures/quote_setup1_single_simple_product.php
@@ -0,0 +1,101 @@
+requireDataFixture('Klarna_Base::Test/Integration/_files/fixtures/product_simple.php');
+Resolver::getInstance()->requireDataFixture('Klarna_Base::Test/Integration/_files/fixtures/tax_rule_us_postal_36104.php');
+
+$objectManager = Bootstrap::getObjectManager();
+
+/** @var StoreManagerInterface $storeManager */
+$storeManager = $objectManager->get(StoreManagerInterface::class);
+/** @var Product $productLoader */
+$productLoader = $objectManager->get(Product::class);
+/** @var QuoteFactory $mQuoteFactory */
+$mQuoteFactory = $objectManager->get(QuoteFactory::class);
+/** @var QuoteManagement $quoteManagement */
+$quoteManagement = $objectManager->get(QuoteManagement::class);
+/** @var CustomerFactory $customerFactory */
+$customerFactory = $objectManager->get(CustomerFactory::class);
+/** @var CustomerRepositoryInterface $customerRepository */
+$customerRepository = $objectManager->get(CustomerRepositoryInterface::class);
+/** @var \Klarna\Kco\Model\QuoteFactory $kQuoteFactory */
+$kQuoteFactory = $objectManager->create(\Klarna\Kco\Model\QuoteFactory::class);
+
+$store = $storeManager->getStore();
+$websiteId = $storeManager->getStore()->getWebsiteId();
+$customer = $customerFactory->create();
+$customer->setWebsiteId($websiteId)
+ ->setStore($store)
+ ->setFirstname('Jhon')
+ ->setLastname('Deo')
+ ->setEmail('sdfds@sdfsd.de')
+ ->setPassword("password");
+$customer->save();
+$customer = $customerRepository->getById($customer->getEntityId());
+
+$product = $productLoader->load(99999);
+$quote = $mQuoteFactory->create();
+$quote->setStore($store);
+$quote->setGlobalCurrencyCode('USD')
+ ->setBaseCurrencyCode('USD')
+ ->setStoreCurrencyCode('USD')
+ ->setQuoteCurrencyCode('USD');
+$quote->assignCustomer($customer);
+$quote->setSendConfirmation(1);
+$quote->addProduct($product, 1);
+
+$addressData = [
+ AddressInterface::KEY_TELEPHONE => '3468676',
+ AddressInterface::KEY_POSTCODE => '36104',
+ AddressInterface::KEY_COUNTRY_ID => 'US',
+ AddressInterface::KEY_CITY => 'CityM',
+ AddressInterface::KEY_COMPANY => 'CompanyName',
+ AddressInterface::KEY_STREET => 'Green str, 67',
+ AddressInterface::KEY_LASTNAME => 'Smith',
+ AddressInterface::KEY_FIRSTNAME => 'John',
+ AddressInterface::KEY_REGION => 'CA',
+ AddressInterface::KEY_REGION_ID => '12',
+ AddressInterface::KEY_EMAIL => 'any_mail@mail.me'
+];
+
+$billingAddress = $quote->getBillingAddress()->addData($addressData);
+$shippingAddress = $quote->getShippingAddress()->addData($addressData);
+
+$shippingAddress->setCollectShippingRates(true)
+ ->collectShippingRates()
+ ->setShippingMethod('flatrate_flatrate')
+ ->setPaymentMethod('checkmo');
+$quote->setPaymentMethod('checkmo');
+$quote->setInventoryProcessed(false);
+$quote->save();
+$quote->getPayment()->importData(array('method' => 'checkmo'));
+
+$quote->setReservedOrderId('100000001');
+
+$quote->setTotalsCollectedFlag(false);
+$quote->getShippingAddress()->setCollectShippingRates(true);
+$quote->collectTotals()->save();
+
+$klarnaQuote = $kQuoteFactory->create();
+$klarnaQuote->setQuoteId($quote->getId());
+$klarnaQuote->setKlarnaCheckoutId('123456-1234-1234-1234-1234567890');
+$klarnaQuote->setIsActive(true);
+$klarnaQuote->save();
diff --git a/Test/Integration/_files/fixtures/quote_setup1_single_simple_product_rollback.php b/Test/Integration/_files/fixtures/quote_setup1_single_simple_product_rollback.php
new file mode 100644
index 0000000..2ae9532
--- /dev/null
+++ b/Test/Integration/_files/fixtures/quote_setup1_single_simple_product_rollback.php
@@ -0,0 +1,43 @@
+get(QuoteFactory::class);
+/** @var \Klarna\Kco\Model\QuoteFactory $kQuoteFactory */
+$kQuoteFactory = $objectManager->get(\Klarna\Kco\Model\QuoteFactory::class);
+/** @var Registry $registry */
+$registry = $objectManager->get(Registry::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+$klarnaQuote = $kQuoteFactory->create()->load('123456-1234-1234-1234-1234567890', 'klarna_checkout_id');
+if ($klarnaQuote->getId()) {
+ $klarnaQuote->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');
diff --git a/Test/Integration/_files/fixtures/tax_rule_us_postal_36104_rollback.php b/Test/Integration/_files/fixtures/tax_rule_us_postal_36104_rollback.php
new file mode 100644
index 0000000..b70d2fe
--- /dev/null
+++ b/Test/Integration/_files/fixtures/tax_rule_us_postal_36104_rollback.php
@@ -0,0 +1,40 @@
+get(Registry::class);
+/** @var RateFactory $rateFactory */
+$rateFactory = $objectManager->create(RateFactory::class);
+/** @var RuleFactory $ruleFactory */
+$ruleFactory = $objectManager->create(RuleFactory::class);
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', true);
+
+$rate = $rateFactory->create()->load('US-AL-*-Rate-1', 'code');
+if ($rate->getId()) {
+ $rate->delete();
+}
+
+$rule = $ruleFactory->create()->load('36104 Test Rule', 'code');
+if ($rule->getId()) {
+ $rule->delete();
+}
+
+$registry->unregister('isSecureArea');
+$registry->register('isSecureArea', false);
diff --git a/Test/Unit/Block/Info/KlarnaTest.php b/Test/Unit/Block/Info/KlarnaTest.php
index ff23c84..1b00699 100644
--- a/Test/Unit/Block/Info/KlarnaTest.php
+++ b/Test/Unit/Block/Info/KlarnaTest.php
@@ -42,7 +42,7 @@ public function testGetLogoUrlReturnsCorrectUrl(): void
{
$this->setUpKlarna('adminhtml');
- $expected = 'https://x.klarnacdn.net/payment-method/assets/badges/generic/white/klarna.png?width=300';
+ $expected = 'https://cdn.kustom.co/assets/badges/kustom_logo_black.png';
$result = $this->klarna->getLogoUrl();
static::assertEquals($expected, $result);
diff --git a/Test/Unit/Model/System/MerchantPortalTest.php b/Test/Unit/Model/System/MerchantPortalTest.php
index 7303436..569881c 100644
--- a/Test/Unit/Model/System/MerchantPortalTest.php
+++ b/Test/Unit/Model/System/MerchantPortalTest.php
@@ -51,7 +51,7 @@ protected function setUp(): void
$merchantId = 'MERCHANT-123';
$this->dependencyMocks['apiConfiguration']
- ->method('getUsername')
+ ->method('getClientIdentifier')
->willReturn($merchantId);
$this->klarnaOrder
->method('getKlarnaOrderId')
diff --git a/etc/acl.xml b/etc/acl.xml
index c9b163f..3906178 100644
--- a/etc/acl.xml
+++ b/etc/acl.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/etc/adminhtml/menu.xml b/etc/adminhtml/menu.xml
index 26f98ef..0cabaf5 100644
--- a/etc/adminhtml/menu.xml
+++ b/etc/adminhtml/menu.xml
@@ -10,7 +10,7 @@