Skip to content

Commit

Permalink
feat: finish processor for cheking payment state
Browse files Browse the repository at this point in the history
  • Loading branch information
alroniks committed Jul 19, 2021
1 parent 8422eda commit d71c8a4
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions core/mspoplati/processors/web/check.class.php
Expand Up @@ -15,16 +15,32 @@ class mspOplatiCheckPaymentProcessor extends modObjectGetProcessor

public $languageTopics = ['mspoplati:default'];

// protected $status;
private OplatiService $oplatiService;

// public function process()
// {
// }
public function __construct(modX $modx, array $properties = [])
{
parent::__construct($modx, $properties);

/** @var OplatiService $service */
$service = $this->modx->getService('oplati', OplatiService::class);

$this->oplatiService = $service;
}

public function beforeOutput()
/**
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \JsonException
* @throws \League\Uri\Contracts\UriException
*/
public function beforeOutput(): void
{
// делаем проверку через сервис и записываем в свойства
// print_r($this->getProperties());
/** @var msOrder $order */
$order = $this->object;

$status = $this->oplatiService->processOrderStatus($order);

$this->object->set('properties', array_merge($this->object->get('properties'), $status->toArray()));
$this->object->save(true);
}
}

Expand Down

0 comments on commit d71c8a4

Please sign in to comment.