Skip to content

Commit

Permalink
Bunch of PR comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arti0090 committed Sep 5, 2024
1 parent 690790a commit 7a375fb
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 35 deletions.
5 changes: 1 addition & 4 deletions config/packages/events.php → config/config/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
'events' => [
'sylius.shop.checkout.complete.summary' => [
'blocks' => [
'my_block_name' => [
'blik' => [
'template' => '@CommerceWeaversSyliusTpayPlugin/blik.html.twig',
'priority' => 5,
'context' => [
'message' => 'Hello!',
],
],
],
],
Expand Down
9 changes: 0 additions & 9 deletions config/packages.php

This file was deleted.

7 changes: 1 addition & 6 deletions config/services/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@

$services->set(PreventSavingEmptyClientSecretListener::class);

$services->set(CompleteTypeExtension::class)
->tag(
'form.type_extension',
['extended_type' => CompleteType::class]
)
;
$services->set(CompleteTypeExtension::class)->tag('form.type_extension');
};
1 change: 1 addition & 0 deletions config/services/payum/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use CommerceWeavers\SyliusTpayPlugin\Payum\Action\Api\CreateBlik0TransactionAction;
use CommerceWeavers\SyliusTpayPlugin\Payum\Action\Api\CreateTransactionAction;
use CommerceWeavers\SyliusTpayPlugin\Payum\Action\Api\NotifyAction;
use CommerceWeavers\SyliusTpayPlugin\Payum\Action\CaptureAction;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/DataTransformer/PaymentDetailsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function transform($value): string
}
public function reverseTransform($value): array
{
return ['blik' => $value];
return $value ? ['blik' => $value] : [];
}
}
1 change: 0 additions & 1 deletion src/Form/Type/CompleteTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'commerce_weavers_sylius_tpay.payment.blik.token',
// TODO missing validation
'property_path' => 'payments[0].details', // TODO looks awfull and what about other payments?
// 'mapped' => false,
'required' => false,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Payum/Action/Api/CreateBlik0TransactionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function execute($request): void
],
]);

// blik token could be removed here from $details
unset($details['blik']);
$details['tpay']['transaction_id'] = $response['transactionId'];

$model->setDetails($details);
Expand Down
3 changes: 2 additions & 1 deletion src/Payum/Action/CaptureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace CommerceWeavers\SyliusTpayPlugin\Payum\Action;

use CommerceWeavers\SyliusTpayPlugin\Payum\Factory\CreateTransactionFactoryInterface;
use CommerceWeavers\SyliusTpayPlugin\Payum\Request\Api\CreateBlik0Transaction;
use Payum\Core\Action\ActionInterface;
use Payum\Core\GatewayAwareInterface;
use Payum\Core\GatewayAwareTrait;
Expand All @@ -31,7 +32,7 @@ public function execute($request): void

if ($this->transactionIsBlik($model)) {
$this->gateway->execute(
new CreateBlik0Transaction($request->getToken()->getAfterUrl(), $model),
new CreateBlik0Transaction($request->getToken()),
);

return;
Expand Down
6 changes: 0 additions & 6 deletions src/Payum/Request/Api/CreateBlik0Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
class CreateBlik0Transaction extends Generic
{
public function __construct (
private string $afterUrl,
mixed $model,
) {
parent::__construct($model);
}

public function getAfterUrl(): string
{
return $this->afterUrl;
}
}
4 changes: 0 additions & 4 deletions templates/blik.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
<p {{ sylius_test_html_attribute('payment-price') }}>{{ money.format(payment.amount, payment.currencyCode) }}</p>

{{ form_row(form.others) }}
<label for="blik-token">
{{ 'commerce_weavers_sylius_tpay.payment.blik.token'|trans }}
</label>
<input id="blik-token" name="blik token" type="text" minlength="6" maxlength="6" required />

{% if state != 'cart' %}
<p id="payment-status" {{ sylius_test_html_attribute('payment-state') }}>
Expand Down
2 changes: 1 addition & 1 deletion translations/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ commerce_weavers_sylius_tpay:

payment:
blik:
token: 'BLIK token'
token: 'BLIK code'

2 changes: 1 addition & 1 deletion translations/messages.pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ commerce_weavers_sylius_tpay:

payment:
blik:
token: 'Token BLIK'
token: 'Kod BLIK'

0 comments on commit 7a375fb

Please sign in to comment.