Skip to content

Commit

Permalink
Merge pull request #392 from mollie/1.26.0
Browse files Browse the repository at this point in the history
1.26.0
  • Loading branch information
Marvin-Magmodules authored Jun 1, 2021
2 parents 35c1b99 + 710cadf commit 5e3af33
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 295 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ jobs:
strategy:
matrix:
include:
- PHP_VERSION: php7-fpm
MAGENTO_VERSION: 2.2.11
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.2.11
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php73-fpm
Expand All @@ -25,7 +23,7 @@ jobs:
run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d

- name: Upload the code into the docker container
run: docker cp $(pwd)/. magento-project-community-edition:/data/extensions && docker exec magento-project-community-edition composer require mollie/magento2:@dev && docker exec magento-project-community-edition bash -c "rm -rf /data/vendor/mollie/magento2 && ln -s /data/extensions /data/vendor/mollie/magento2"
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require mollie/magento2 @dev

- name: Enable developer mode
run: docker exec magento-project-community-edition php bin/magento deploy:mode:set developer
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
strategy:
matrix:
include:
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.3.5-p1
- PHP_VERSION: php72-fpm
MAGENTO_VERSION: 2.3.5-p1
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
runs-on: ubuntu-latest
Expand All @@ -24,7 +24,7 @@ jobs:
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Install the extensions in Magento
run: docker exec magento-project-community-edition composer require mollie/magento2:@dev fooman/phpstan-magento2-magic-methods:0.7.1
run: docker exec magento-project-community-edition composer require mollie/magento2:@dev fooman/phpstan-magento2-magic-methods:^0.7

- name: Run PHPStan
run: docker exec magento-project-community-edition /bin/bash -c "./vendor/bin/phpstan analyse -c /data/extensions/*/phpstan.neon /data/extensions"
6 changes: 3 additions & 3 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
strategy:
matrix:
include:
- PHP_VERSION: php7-fpm
MAGENTO_VERSION: 2.2.11
- PHP_VERSION: php72-fpm
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ jobs:
strategy:
matrix:
include:
- PHP_VERSION: php7-fpm
MAGENTO_VERSION: 2.2.11
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.2.11
- PHP_VERSION: php71-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php72-fpm
MAGENTO_VERSION: 2.3.6-p1
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.4.2
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
runs-on: ubuntu-latest
Expand All @@ -28,7 +20,7 @@ jobs:
run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d

- name: Upload the code into the docker container
run: docker cp $(pwd)/. magento-project-community-edition:/data/extensions && docker exec magento-project-community-edition composer require mollie/magento2:@dev && docker exec magento-project-community-edition bash -c "rm -rf /data/vendor/mollie/magento2 && ln -s /data/extensions /data/vendor/mollie/magento2"
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require mollie/magento2 @dev

- name: Run tests
run: docker exec magento-project-community-edition bash -c "vendor/bin/phpunit extensions/Test/Unit"
run: docker exec magento-project-community-edition bash -c "vendor/bin/phpunit extensions/*/Test/Unit"
7 changes: 7 additions & 0 deletions Api/MollieCustomerRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function save(
*/
public function get($id);

/**
* Retrieve Mollie Customer connection by Mollie Customer ID
* @param string $customerId
* @return \Mollie\Payment\Api\Data\MollieCustomerInterface
*/
public function getByMollieCustomerId(string $customerId);

/**
* Retrieve Mollie Customer by Magento customer
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
Expand Down
19 changes: 19 additions & 0 deletions GraphQL/DataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Mollie\Payment\GraphQL;

use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;

class DataProvider implements AdditionalDataProviderInterface
{
public function getData(array $data): array
{
return [
'selected_issuer' => $data['mollie_selected_issuer'] ?? null,
'card_token' => $data['mollie_card_token'] ?? null,
];
}
}
75 changes: 75 additions & 0 deletions GraphQL/Resolver/Checkout/PlaceOrderAndReturnRedirectUrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\GraphQL\Resolver\Checkout;

use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Sales\Api\OrderRepositoryInterface;
use Mollie\Payment\Api\PaymentTokenRepositoryInterface;
use Mollie\Payment\Model\Mollie;
use Mollie\Payment\Service\PaymentToken\Generate;

class PlaceOrderAndReturnRedirectUrl implements ResolverInterface
{
/**
* @var OrderRepositoryInterface
*/
private $orderRepository;

/**
* @var SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;

/**
* @var Mollie
*/
private $mollie;

public function __construct(
OrderRepositoryInterface $orderRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
Mollie $mollie
) {
$this->orderRepository = $orderRepository;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->mollie = $mollie;
}

public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
$order = $this->getOrderByIncrementId($value['order_id']);
if (!$order) {
return null;
}

if ($order->getPayment()->getAdditionalInformation('checkout_url')) {
return $order->getPayment()->getAdditionalInformation('checkout_url');
}

$this->mollie->startTransaction($order);

return $order->getPayment()->getAdditionalInformation('checkout_url');
}

/**
* @param string $incrementId
* @return \Magento\Sales\Api\Data\OrderInterface|null
*/
private function getOrderByIncrementId($incrementId)
{
$this->searchCriteriaBuilder->addFilter('increment_id', $incrementId);

$items = $this->orderRepository->getList($this->searchCriteriaBuilder->create())->getItems();

return array_shift($items);
}
}
196 changes: 0 additions & 196 deletions LegacySupport/GraphQl/Field.php

This file was deleted.

Loading

0 comments on commit 5e3af33

Please sign in to comment.