-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from mollie/1.26.0
1.26.0
- Loading branch information
Showing
16 changed files
with
169 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
75
GraphQL/Resolver/Checkout/PlaceOrderAndReturnRedirectUrl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.