Skip to content

Commit

Permalink
Allow configuring the notification security code from envs (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz authored Oct 7, 2024
2 parents 4901882 + b972398 commit e660409
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions config/config/sylius_fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
'gatewayConfig' => [
'client_id' => '%env(string:TPAY_CLIENT_ID)%',
'client_secret' => '%env(string:TPAY_CLIENT_SECRET)%',
'cards_api' => '%env(string:TPAY_CARDS_API)%',
'notification_security_code' => '%env(string:TPAY_NOTIFICATION_SECURITY_CODE)%',
'type' => 'redirect',
'production_mode' => false,
],
Expand All @@ -76,6 +78,7 @@
'client_id' => '%env(string:TPAY_CLIENT_ID)%',
'client_secret' => '%env(string:TPAY_CLIENT_SECRET)%',
'cards_api' => '%env(string:TPAY_CARDS_API)%',
'notification_security_code' => '%env(string:TPAY_NOTIFICATION_SECURITY_CODE)%',
'type' => 'card',
'production_mode' => false,
],
Expand All @@ -93,6 +96,7 @@
'client_id' => '%env(string:TPAY_CLIENT_ID)%',
'client_secret' => '%env(string:TPAY_CLIENT_SECRET)%',
'type' => 'blik',
'notification_security_code' => '%env(string:TPAY_NOTIFICATION_SECURITY_CODE)%',
'production_mode' => false,
],
'channels' => [
Expand All @@ -109,6 +113,7 @@
'client_id' => '%env(string:TPAY_CLIENT_ID)%',
'client_secret' => '%env(string:TPAY_CLIENT_SECRET)%',
'type' => 'pay-by-link',
'notification_security_code' => '%env(string:TPAY_NOTIFICATION_SECURITY_CODE)%',
'production_mode' => false,
],
'channels' => [
Expand Down
1 change: 1 addition & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
->set('env(TPAY_CLIENT_ID)', '')
->set('env(TPAY_CLIENT_SECRET)', '')
->set('env(TPAY_CARDS_API)', '')
->set('env(TPAY_NOTIFICATION_SECURITY_CODE)', '')
->set('commerce_weavers_tpay.payum.create_transaction.success_route', 'sylius_shop_order_thank_you')
->set('commerce_weavers_tpay.payum.create_transaction.error_route', 'sylius_shop_order_thank_you')
->set('commerce_weavers_tpay.payum.create_transaction.notify_route', 'commerce_weavers_tpay_payment_notification')
Expand Down
1 change: 1 addition & 0 deletions tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ PAYUM_CYPHER_KEY=<edit_me>
TPAY_CLIENT_ID=<edit_me>
TPAY_CLIENT_SECRET=<edit_me>
TPAY_CARDS_API=<edit_me>
TPAY_NOTIFICATION_SECURITY_CODE=<edit_me>
###< commerce-weavers/sylius-tpay-plugin ###
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Tpay\OpenApi\Api\Transactions\TransactionsApi;
use Webmozart\Assert\InvalidArgumentException;

final class CreatePayByLinkTransactionActionTest extends TestCase
{
Expand Down Expand Up @@ -125,11 +124,13 @@ public function test_it_creates_a_payment_and_redirects_to_a_payment_page(): voi
$payment->setDetails([
'tpay' => [
'transaction_id' => 'tr4ns4ct!0n_id',
'payment_url' => 'https://tpay.org/pay',
'status' => 'pending',
'result' => null,
'status' => 'pending',
'blik_token' => null,
'card' => null,
'payment_url' => 'https://tpay.org/pay',
'success_url' => null,
'failure_url' => null,
],
])->shouldBeCalled();

Expand Down

0 comments on commit e660409

Please sign in to comment.