Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Sep 16, 2024
1 parent 222a20c commit 7e51d33
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ jobs:
e2e_js: "yes"
node_version: '18.x'

- name: Check dependencies
continue-on-error: true
run: vendor/bin/composer-dependency-analyser

- name: Static analysis
run: vendor/bin/phpstan

- name: Check coding standard
run: vendor/bin/ecs check

- name: Run tests (Unit)
run: vendor/bin/phpunit --testsuite unit
# - name: Check dependencies
# continue-on-error: true
# run: vendor/bin/composer-dependency-analyser
#
# - name: Static analysis
# run: vendor/bin/phpstan
#
# - name: Check coding standard
# run: vendor/bin/ecs check
#
# - name: Run tests (Unit)
# run: vendor/bin/phpunit --testsuite unit

- name: Run tests (E2E)
run: vendor/bin/phpunit --testsuite e2e
Expand Down
26 changes: 26 additions & 0 deletions assets/shop/js/card_encoder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
import * as JSEncrypt from './jsencrypt.min';
import * as Sentry from "@sentry/browser";

Sentry.init({
dsn: "https://b4aeb8f84d49fdbae7d336d446bf46b6@o4507962673725440.ingest.de.sentry.io/4507962677395536",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
Sentry.captureConsoleIntegration(),
],
// Tracing
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});

document.addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('[name="sylius_checkout_complete"]');
Expand All @@ -13,13 +30,22 @@ document.addEventListener('DOMContentLoaded', () => {
e.preventDefault();

const card_number = document.getElementById('sylius_checkout_complete_tpay_card_number').value.replace(/\s/g, '');
console.log(card_number);
const cvc = document.getElementById('sylius_checkout_complete_tpay_card_cvv').value.replace(/\s/g, '');
console.log(cvc);
const expiration_date_month = document.getElementById('sylius_checkout_complete_tpay_card_expiration_date_month').value.replace(/\s/g, '');
console.log(expiration_date_month);
const expiration_date_year = document.getElementById('sylius_checkout_complete_tpay_card_expiration_date_year').value.replace(/\s/g, '');
console.log(expiration_date_year);
const expiration_date = [expiration_date_month, expiration_date_year].join('/');
console.log(expiration_date);
console.log(encrypted_card_field);
console.log(encrypt.encrypt([card_number, expiration_date, cvc, document.location.origin].join('|')));

encrypted_card_field.value = encrypt.encrypt([card_number, expiration_date, cvc, document.location.origin].join('|'));

console.error('test');

form.submit();
})
});
4 changes: 2 additions & 2 deletions src/Form/DataTransformer/CardTypeDataTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

final class CardTypeDataTransformer implements DataTransformerInterface
{
public function transform($value): ?array
public function transform($value): mixed
{
return null;
return $value;
}

/**
Expand Down
12 changes: 11 additions & 1 deletion src/Form/Type/TpayCardType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;

final class TpayCardType extends AbstractType
{
Expand Down Expand Up @@ -78,7 +79,16 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'commerce_weavers_sylius_tpay.shop.order_summary.card.expiration_date.year',
],
)
->add('card', HiddenType::class)
->add(
'card',
HiddenType::class,
[
'validation_groups' => ['sylius_checkout_complete'],
'constraints' => [
new NotBlank(),
],
]
)
;

$builder->addModelTransformer($this->cardTypeDataTransformer);
Expand Down
3 changes: 3 additions & 0 deletions tests/Application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
},
"devDependencies": {
"@sylius-ui/frontend": "^1.0"
},
"dependencies": {
"@sentry/browser": "^8.30.0"
}
}
1 change: 1 addition & 0 deletions tests/E2E/Helper/Order/CartTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function processWithPaymentMethod(string $paymentMethodCode): void
$paymentMethodCode,
),
);

$this->client->submitForm('Next');
}

Expand Down

0 comments on commit 7e51d33

Please sign in to comment.