Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #728

Merged
merged 37 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8e24284
Improvement: Download the Apple Pay certificate
michielgerritsen Nov 27, 2023
0d9fe1e
Bugfix: Support vowel mutations #714
michielgerritsen Nov 27, 2023
bbf568d
Bugfix: Check that the limited methods is an array #718
michielgerritsen Nov 27, 2023
af70dc9
Improvement: Add a noreferrer to the second chance link
michielgerritsen Nov 27, 2023
2d6668c
Feature: Show chargebacks in the comments of an order
michielgerritsen Nov 27, 2023
1bcd8ec
Feature: Add endpoint to fetch the available issuers and terminals
michielgerritsen Dec 4, 2023
9cfd3c1
Feature: Add Point of sale to the available payment methods list
michielgerritsen Dec 4, 2023
c645e47
Bugfix: Use the payment link setting when multiple methods are selected
michielgerritsen Dec 7, 2023
7d99c15
Bugfix: Make the adjustment the last rule
michielgerritsen Dec 21, 2023
5c82b56
Bugfix: Do not include order lines that are not appliccable
michielgerritsen Dec 18, 2023
dc814e0
Merge branch 'bugfix/limited-methods-array-check' into release-week-01
michielgerritsen Jan 8, 2024
e575d6f
Merge branch 'improvement/download-apple-pay-certificate' into releas…
michielgerritsen Jan 8, 2024
bca1f17
Merge branch 'bugfix/support-vowel-mutations' into release-week-01
michielgerritsen Jan 8, 2024
d062bf6
Merge branch 'improvement/noreferrer-link' into release-week-01
michielgerritsen Jan 8, 2024
f045678
Merge branch 'feature/show-chargebacks' into release-week-01
michielgerritsen Jan 8, 2024
6e23785
Merge branch 'feature/rest-api-issuers-terminals' into release-week-01
michielgerritsen Jan 8, 2024
4e228db
Merge branch 'feature/test-if-pos-is-available' into release-week-01
michielgerritsen Jan 8, 2024
07592e9
Merge branch 'bugfix/paymentlink-expiry-with-multiple-methods' into r…
michielgerritsen Jan 8, 2024
b989957
Merge branch 'bugfix/remove-non-applied-orderlines' into release-week-01
michielgerritsen Jan 8, 2024
8a0100b
Merge branch 'bugfix/adjustment-rules-order' into release-week-01
michielgerritsen Jan 8, 2024
3587541
Feature: New payment method TWINT
michielgerritsen Jan 8, 2024
572f37c
Merge branch 'feature/twint' into release-week-01
michielgerritsen Jan 8, 2024
454b684
Add missing configuration
michielgerritsen Jan 10, 2024
11839fc
Merge branch 'feature/twint' into release-week-01
michielgerritsen Jan 10, 2024
78bbfd9
Use allAvailable instead of allActive
michielgerritsen Jan 10, 2024
90c1304
Merge branch 'feature/twint' into release-week-01
michielgerritsen Jan 10, 2024
18d1140
Fix tests
michielgerritsen Jan 10, 2024
c5f09b3
Fix tests
michielgerritsen Jan 10, 2024
b7adc44
Merge branch 'feature/twint' into release-week-01
michielgerritsen Jan 10, 2024
6758f13
Disabled PayPal CSS class test
michielgerritsen Jan 10, 2024
5d8a155
Merge branch 'release' into release-week-01
michielgerritsen Jan 10, 2024
01321c8
Bugfix: Use the correct method to retrieve the available methods
michielgerritsen Jan 15, 2024
8ce5a1e
Merge branch 'release-week-01-paypal-fix' into release-week-01
michielgerritsen Jan 15, 2024
2b9e39a
Bugfix: Call startTransaction when the customer clicks the paymentLin…
michielgerritsen Jan 18, 2024
460e16d
Merge branch 'bugfix/call-starttransaction-later-for-paymentlink' int…
michielgerritsen Jan 22, 2024
ed13b7e
Merge branch 'release-week-01' into release
michielgerritsen Jan 22, 2024
aabc842
Remove days before expire field
michielgerritsen Jan 22, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/end-2-end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ jobs:

- name: Activate the extension
run: |
docker exec magento-project-community-edition php /data/merge-config.php
docker exec magento-project-community-edition ./retry "php bin/magento module:enable Mollie_Payment"
docker exec magento-project-community-edition ./retry "php bin/magento setup:upgrade"
docker exec magento-project-community-edition ./retry "php bin/magento setup:upgrade --no-interaction"
docker exec magento-project-community-edition /bin/bash /data/configure-mollie.sh
docker exec magento-project-community-edition ./retry "bin/magento config:set payment/mollie_general/use_webhooks custom_url"
docker exec magento-project-community-edition ./retry "bin/magento config:set payment/mollie_general/custom_webhook_url ${{ env.magento_url }}/mollie/checkout/webhook"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/templates/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
volumes:
- ../../../magento-logs:/data/var/log
- ./magento/configure-mollie.sh:/data/configure-mollie.sh
- ./magento/merge-config.php.stub:/data/merge-config.php
depends_on:
- ngrok

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates/e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cypress/included:12.1.0
FROM cypress/included:13.6.2

WORKDIR /e2e

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/templates/magento/configure-mollie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bin/magento config:set payment/mollie_methods_paymentlink/active 1 &
bin/magento config:set payment/mollie_methods_paysafecard/active 1 &
bin/magento config:set payment/mollie_methods_pointofsale/active 1 &
bin/magento config:set payment/mollie_methods_sofort/active 1 &
bin/magento config:set payment/mollie_methods_twint/active 1 &

# Enable Components
bin/magento config:set payment/mollie_methods_creditcard/use_components 1 &
Expand All @@ -38,6 +39,11 @@ bin/magento config:set payment/mollie_methods_ideal/add_qr 1 &

bin/magento config:set payment/mollie_general/use_webhooks disabled &

# Configure currency for the swiss store view
bin/magento config:set currency/options/allow EUR,CHF &
bin/magento config:set currency/options/default CHF --scope=ch &
bin/magento config:set payment/mollie_general/currency 0 --scope=ch &

wait

if grep -q Magento_TwoFactorAuth "app/etc/config.php"; then
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/templates/magento/merge-config.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

# Merge the config.php file generated by Magento with our own scopes to create multiple store views.

$magentoConfig = require('app/etc/config.php');
$magentoConfig['scopes'] = [
'websites' => [
'admin' => [
'website_id' => '0',
'code' => 'admin',
'name' => 'Admin',
'sort_order' => '0',
'default_group_id' => '0',
'is_default' => '0'
],
'base' => [
'website_id' => '1',
'code' => 'base',
'name' => 'Main Website',
'sort_order' => '0',
'default_group_id' => '1',
'is_default' => '1'
]
],
'groups' => [
[
'group_id' => '0',
'website_id' => '0',
'name' => 'Default',
'root_category_id' => '0',
'default_store_id' => '0',
'code' => 'default'
],
[
'group_id' => '1',
'website_id' => '1',
'name' => 'Main Website Store',
'root_category_id' => '2',
'default_store_id' => '1',
'code' => 'main_website_store'
]
],
'stores' => [
'admin' => [
'store_id' => '0',
'code' => 'admin',
'website_id' => '0',
'group_id' => '0',
'name' => 'Admin',
'sort_order' => '0',
'is_active' => '1'
],
'default' => [
'store_id' => '1',
'code' => 'default',
'website_id' => '1',
'group_id' => '1',
'name' => 'Default Store View',
'sort_order' => '0',
'is_active' => '1'
],
'ch' => [
'store_id' => '2',
'code' => 'ch',
'website_id' => '1',
'group_id' => '1',
'name' => 'Swiss',
'sort_order' => '0',
'is_active' => '1'
]
]
];

file_put_contents(
'app/etc/config.php',
'<?php return ' . var_export($magentoConfig, true) . ';' . PHP_EOL
);
45 changes: 45 additions & 0 deletions Api/Data/IssuerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Api\Data;

interface IssuerInterface
{
/**
* @return string
*/
public function getId(): string;

/**
* @return string
*/
public function getName(): string;

/**
* @return string
*/
public function getImage(): string;

/**
* @return array
*/
public function getImages(): array;

/**
* @return string
*/
public function getImage1x(): string;

/**
* @return string
*/
public function getImage2x(): string;

/**
* @return string
*/
public function getImageSvg(): string;
}
27 changes: 27 additions & 0 deletions Api/Data/MethodMetaInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Mollie\Payment\Api\Data;

interface MethodMetaInterface
{
/**
* @return string
*/
public function getCode(): string;

/**
* @return \Mollie\Payment\Api\Data\IssuerInterface[]
*/
public function getIssuers(): array;

/**
* @return \Mollie\Payment\Api\Data\TerminalInterface[]
*/
public function getTerminals(): array;
}
35 changes: 35 additions & 0 deletions Api/Data/TerminalInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Api\Data;

interface TerminalInterface
{
/**
* @return string
*/
public function getId(): string;

/**
* @return string
*/
public function getBrand(): string;

/**
* @return string
*/
public function getModel(): string;

/**
* @return string|null
*/
public function getSerialNumber(): ?string;

/**
* @return string
*/
public function getDescription(): string;
}
15 changes: 15 additions & 0 deletions Api/Webapi/PaymentInformationMetaInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Api\Webapi;

interface PaymentInformationMetaInterface
{
/**
* @return \Mollie\Payment\Api\Data\MethodMetaInterface[]
*/
public function getPaymentMethodsMeta(): array;
}
50 changes: 35 additions & 15 deletions Block/Info/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

namespace Mollie\Payment\Block\Info;

use Magento\Framework\Encryption\EncryptorInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Registry;
use Magento\Framework\UrlInterface;
use Magento\Payment\Block\Info;
use Magento\Framework\View\Element\Template\Context;
use Magento\Framework\Stdlib\DateTime;
use Magento\Sales\Api\Data\OrderInterface;
use Mollie\Payment\Config;
use Mollie\Payment\Helper\General as MollieHelper;
use Mollie\Payment\Model\Methods\Billie;
use Mollie\Payment\Model\Methods\Klarna;
Expand All @@ -21,7 +24,6 @@

class Base extends Info
{

/**
* @var string
*/
Expand All @@ -42,26 +44,36 @@ class Base extends Info
* @var PriceCurrencyInterface
*/
private $price;

/**
* Base constructor.
*
* @param Context $context
* @param MollieHelper $mollieHelper
* @param Registry $registry
* @param PriceCurrencyInterface $price
* @var EncryptorInterface
*/
private $encryptor;
/**
* @var Config
*/
private $config;
/**
* @var UrlInterface
*/
private $urlBuilder;

public function __construct(
Context $context,
Config $config,
MollieHelper $mollieHelper,
Registry $registry,
PriceCurrencyInterface $price
PriceCurrencyInterface $price,
EncryptorInterface $encryptor,
UrlInterface $urlBuilder
) {
parent::__construct($context);
$this->mollieHelper = $mollieHelper;
$this->timezone = $context->getLocaleDate();
$this->registry = $registry;
$this->price = $price;
$this->encryptor = $encryptor;
$this->config = $config;
$this->urlBuilder = $urlBuilder;
}

public function getCheckoutType(): ?string
Expand All @@ -87,16 +99,24 @@ public function getExpiresAt(): ?string
return null;
}

/**
* @param mixed $storeId
*/
public function getPaymentLink($storeId = null): ?string
{
if ($checkoutUrl = $this->getCheckoutUrl()) {
return $this->mollieHelper->getPaymentLinkMessage($checkoutUrl, $storeId);
if (!$this->config->addPaymentLinkMessage($storeId)) {
return null;
}

return null;
return str_replace(
'%link%',
$this->getPaymentLinkUrl(),
$this->config->paymentLinkMessage($storeId)
);
}

public function getPaymentLinkUrl(): string
{
return $this->urlBuilder->getUrl('mollie/checkout/paymentlink', [
'order' => base64_encode($this->encryptor->encrypt($this->getInfo()->getParentId())),
]);
}

public function getCheckoutUrl(): ?string
Expand Down
18 changes: 18 additions & 0 deletions Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class Config
const PAYMENT_METHOD_PAYMENT_TITLE = 'payment/mollie_methods_%s/title';
const PAYMENT_PAYMENTLINK_ALLOW_MARK_AS_PAID = 'payment/mollie_methods_paymentlink/allow_mark_as_paid';
const PAYMENT_PAYMENTLINK_NEW_STATUS = 'payment/mollie_methods_paymentlink/order_status_new';
const PAYMENT_PAYMENTLINK_ADD_MESSAGE = 'payment/mollie_methods_paymentlink/add_message';
const PAYMENT_PAYMENTLINK_MESSAGE = 'payment/mollie_methods_paymentlink/message';
const PAYMENT_POINTOFSALE_ALLOWED_CUSTOMER_GROUPS = 'payment/mollie_methods_pointofsale/allowed_customer_groups';
const PAYMENT_VOUCHER_CATEGORY = 'payment/mollie_methods_voucher/category';
const PAYMENT_VOUCHER_CUSTOM_ATTRIBUTE = 'payment/mollie_methods_voucher/custom_attribute';
Expand Down Expand Up @@ -495,6 +497,22 @@ public function statusNewPaymentLink($storeId = null)
);
}

public function addPaymentLinkMessage($storeId = null): string
{
return (string)$this->getPath(
static::PAYMENT_PAYMENTLINK_ADD_MESSAGE,
$storeId
);
}

public function paymentLinkMessage($storeId = null): string
{
return (string)$this->getPath(
static::PAYMENT_PAYMENTLINK_MESSAGE,
$storeId
);
}

/**
* @param string $method
* @param int|null $storeId
Expand Down
Loading
Loading