-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
856 additions
and
233 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace BlueMedia\BluePayment\Api; | ||
|
||
interface RefundStatusUpdaterInterface | ||
{ | ||
/** | ||
* Aktualizuje statusy zwrotów | ||
* | ||
* @return void | ||
*/ | ||
public function updateRefundStatuses(): void; | ||
} |
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BlueMedia\BluePayment\Console\Command; | ||
|
||
use BlueMedia\BluePayment\Api\RefundStatusUpdaterInterface; | ||
use Magento\Framework\App\Area; | ||
use Magento\Framework\App\State; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class UpdateRefundStatusCommand extends Command | ||
{ | ||
/** | ||
* @var RefundStatusUpdaterInterface | ||
*/ | ||
protected $refundStatusUpdater; | ||
|
||
/** | ||
* @var State | ||
*/ | ||
protected $state; | ||
|
||
public function __construct( | ||
RefundStatusUpdaterInterface $refundStatusUpdater, | ||
State $state | ||
) { | ||
$this->refundStatusUpdater = $refundStatusUpdater; | ||
$this->state = $state; | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Initialization of the command. | ||
*/ | ||
protected function configure() | ||
{ | ||
$this->setName('bluepayment:refund:update-status'); | ||
$this->setDescription('Refresh refund statuses from the external Autopay API.'); | ||
parent::configure(); | ||
} | ||
|
||
/** | ||
* CLI command description. | ||
* | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return void | ||
* @throws LocalizedException | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$this->state->setAreaCode(Area::AREA_ADMINHTML); | ||
|
||
$this->refundStatusUpdater->updateRefundStatuses(); | ||
|
||
$output->writeln('Refund statuses updated.'); | ||
|
||
return 0; | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BlueMedia\BluePayment\Cron; | ||
|
||
use BlueMedia\BluePayment\Api\RefundStatusUpdaterInterface; | ||
use BlueMedia\BluePayment\Service\RefundStatusUpdaterService as RefundStatusUpdaterService; | ||
|
||
class RefundStatusUpdater | ||
{ | ||
/** | ||
* @var RefundStatusUpdaterService | ||
*/ | ||
protected $refundStatusUpdater; | ||
|
||
public function __construct( | ||
RefundStatusUpdaterInterface $refundStatusUpdater | ||
) { | ||
$this->refundStatusUpdater = $refundStatusUpdater; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$this->refundStatusUpdater->updateRefundStatuses(); | ||
} | ||
} |
Oops, something went wrong.